home *** CD-ROM | disk | FTP | other *** search
/ MacFormat UK 160 - Disc 2 / MF_UK_160_2.iso / pc / DiscContent / Trials / oxygen / samples / debugger / Variables / sample1.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2005-07-21  |  1001 b   |  26 lines

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--    Category:     Variables
  3.     Sample from Zvon XSLT tutorial (www.zvon.org)  
  4.     Description:    This stylesheet demonstrates setting of xsl:variable -->
  5. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  6.     <xsl:variable name="totalChapters">
  7.         <xsl:value-of select="count(//chapter)"/>
  8.     </xsl:variable>
  9.     <xsl:template match="/">
  10.         <TABLE>
  11.             <xsl:for-each select="//chapter">
  12.                 <TR>
  13.                     <TD>
  14.                         <xsl:value-of select="."/>
  15.                         <xsl:text> (</xsl:text>
  16.                         <xsl:value-of select="position()"/>
  17.                         <xsl:text>/</xsl:text>
  18.                         <xsl:value-of select="$totalChapters"/>
  19.                         <xsl:text>)</xsl:text>
  20.                     </TD>
  21.                 </TR>
  22.             </xsl:for-each>
  23.         </TABLE>
  24.     </xsl:template>
  25. </xsl:stylesheet>
  26.