Sorting the Table of Contents

xsl:for-each can have an xsl:sort child just like xsl:apply-templates

  <xsl:template match="catalog">
       <title><xsl:value-of select="category"/></title>      
       <!-- Header -->            
       <h1><xsl:value-of select="category"/></h1>
         <xsl:for-each select="composition">
           <xsl:sort select="title"/>
           <li><xsl:value-of select="title"/></li>
       <!-- Body -->            
       <xsl:apply-templates select="composer">
         <xsl:sort select="name/last_name"/>
         <xsl:sort select="name/first_name"/>
         <xsl:sort select="name/middle_name"/>
       <!-- Signature -->      
       Copyright <xsl:value-of select="copyright"/><br/>
       Last Modified: <xsl:value-of select="last_updated"/><br/>
       <xsl:apply-templates select="maintainer"/>

View Transformed Document in Netscape
Previous | Next | Top | Cafe con Leche

Copyright 2000 Elliotte Rusty Harold
Last Modified September 23, 1999