<?xml version = "1.0"?>

<!-- Fig. 12.9 : usage.xsl                        -->
<!-- Transformation of Book information into HTML -->

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

   <xsl:template match = "/">
      <html>
         <xsl:apply-templates/>
      </html>
   </xsl:template>
   
   <xsl:template match = "book">
      <head>
         <title>ISBN <xsl:value-of select = "@isbn"/> - 
            <xsl:value-of select = "title"/></title>
      </head>

      <body bgcolor = "white">
         <h1><xsl:value-of select = "title"/></h1>

         <h2>by <xsl:value-of select = "author/lastName"/>,
            <xsl:value-of select = "author/firstName"/></h2>

         <table border = "1">
            <xsl:for-each select = "chapters/preface">
               <xsl:sort select = "@num" order = "ascending"/>
               <tr>
                  <td align = "right">
                     Preface <xsl:value-of select = "@num"/>
                  </td>

                  <td>
                     <xsl:value-of select = "."/> (
                     <xsl:value-of select = "@pages"/> pages )
                  </td>
               </tr>
            </xsl:for-each>

            <xsl:for-each select = "chapters/chapter">
               <xsl:sort select = "@num" order = "ascending"/>
               <tr>
                  <td align = "right">
                     Chapter <xsl:value-of select = "@num"/>
                  </td>

                  <td>
                     <xsl:value-of select = "."/> (
                     <xsl:value-of select = "@pages"/> pages )
                  </td>
               </tr>
            </xsl:for-each>

            <xsl:for-each select = "chapters/appendix">
               <xsl:sort select = "@num" order = "ascending"/>
               <tr>
                  <td align = "right">
                     Appendix <xsl:value-of select = "@num"/>
                  </td>

                  <td>
                     <xsl:value-of select = "."/> (
                     <xsl:value-of select = "@pages"/> pages )
                  </td>
               </tr>
            </xsl:for-each>
         </table>
      </body>
   </xsl:template>

</xsl:stylesheet>

<!-- 
 **************************************************************************
 * (C) Copyright 2001 by Deitel & Associates, Inc. and Prentice Hall.     *
 * All Rights Reserved.                                                   *
 *                                                                        *
 * DISCLAIMER: The authors and publisher of this book have used their     *
 * best efforts in preparing the book. These efforts include the          *
 * development, research, and testing of the theories and programs        *
 * to determine their effectiveness. The authors and publisher make       *
 * no warranty of any kind, expressed or implied, with regard to these    *
 * programs or to the documentation contained in these books. The authors *
 * and publisher shall not be liable in any event for incidental or       *
 * consequential damages in connection with, or arising out of, the       *
 * furnishing, performance, or use of these programs.                     *
 **************************************************************************
-->