An XSLT 1.0 stylesheet for working with XHTML

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns="http://www.w3.org/1999/xhtml" 
  xmlns:html="http://www.w3.org/1999/xhtml" 
>

  <xsl:output method="html" encoding="ISO-8859-1"/>

  <xsl:template match="week">
    <html xml:lang="en" lang="en">
      <head><title><xsl:value-of select="//html:h1[1]"/></title></head>
      <body bgcolor="#ffffff" text="#000000">

        <xsl:apply-templates select="html:body"/>

        <font size="-1">Last Modified Mon June 5, 2001<br />
          Copyright 2001 Elliotte Rusty Harold<br />
          <a href="mailto:elharo@metalab.unc.edu">elharo@metalab.unc.edu</a>
        </font>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="html:body">
    <xsl:apply-templates 
      select="text()[count(following-sibling::html:hr)>1]|*[count(following-sibling::html:hr)>1]" />

    <hr/>
  </xsl:template>

  <xsl:template match="html:*">
    <xsl:copy>
      <xsl:for-each select="@*">
        <xsl:copy-of select="."/>
      </xsl:for-each>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="html:font[@size='-1']"></xsl:template>

  <xsl:template match="html:a">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="html:applet">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="html:param"/>

</xsl:stylesheet>

Previous | Next | Top | Cafe con Leche

Copyright 2002, 2003 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified February 18, 2001