home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F24616_loop.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-08-19  |  1.1 KB  |  37 lines

  1. <?xml version="1.0"?>
  2. <!--loop.xsl-->
  3. <!--XSLT 1.0 - http://www.CraneSoftwrights.com/training -->
  4. <!DOCTYPE xsl:stylesheet [
  5.     <!ENTITY nl " ">
  6. ]>
  7.  
  8. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  9.     <xsl:output method="text"/>
  10.     
  11.     <xsl:param name="count" select="3"/>
  12.  
  13.     <!--allow override-->
  14.     <xsl:template match="/">
  15.         <xsl:text>Dan:   "Say goodnight, Dick."&nl;</xsl:text>
  16.         <xsl:call-template name="countdown">
  17.             <!--begin countdown-->
  18.             <!--convert to number in case supplied as string-->
  19.             <xsl:with-param name="countdown" select="number($count)"/>
  20.         </xsl:call-template>
  21.     </xsl:template>
  22.     
  23.     
  24.     <xsl:template name="countdown">
  25.         <!--recursive loop until done-->
  26.         <xsl:param name="countdown"/>
  27.         <xsl:if test="$countdown">
  28.             <!--count not zero; more work-->
  29.             <xsl:text>Dick:  "Goodnight Dick!"&nl;</xsl:text>
  30.             <xsl:call-template name="countdown">
  31.                 <!--next; one less-->
  32.                 <xsl:with-param name="countdown" select="$countdown - 1"/>
  33.             </xsl:call-template>
  34.         </xsl:if>
  35.     </xsl:template>
  36. </xsl:stylesheet>
  37.