An XSLT 2.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" 
  default-xpath-namespace="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="//h1[1]"/></title></head>
      <body bgcolor="#ffffff" text="#000000">

        <xsl:apply-templates select="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="body">
    <xsl:apply-templates 
     select="text()[count(following-sibling::hr)>1]|*[count(following-sibling::hr)>1]"/>

    <hr/>
  </xsl:template>

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

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

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

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

  <xsl:template match="param"/>

</xsl:stylesheet>

Previous | Next | Top | Cafe con Leche

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