Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT WHILE LOOP

Status
Not open for further replies.

kurtmo5

Programmer
Jul 16, 2004
18
US
I want to loop through an XML file five times. What is the best way to go about this?
 
Your question isn't realy clear; if you want to use xsl and just parse the source 5 times the same you could do it like this:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL] xmlns="[URL unfurl="true"]http://www.w3.org/TR/xhtml1/strict">[/URL]
   <xsl:template match="/">
      <xsl:call-template name="ParseRoot">
         <xsl:with-param name="counter" select="1" />
      </xsl:call-template>
   </xsl:template>

   <xsl:template name="ParseRoot">
      <xsl:param name="counter" />
      <xsl:apply-templates/>

      <xsl:if test="$counter != 6">
         <xsl:call-template name="ParseRoot">
            <xsl:with-param name="counter" select="$counter+1" />
         </xsl:call-template>
      </xsl:if>
   </xsl:template>
   
   <xsl:template match="whatever"/>
   
</xsl:stylesheet>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top