XPath

Author Thread:how to iterate xsl:for-loop
chiru123
how to iterate xsl:for-loop
Posted:Friday, July 15, 2005 8:50 AM (UMST)

Hi,

 

Can we find any function similar to "for(x;y;z) loop" in xsl or xpath.

 

Thanks


Average Rating:


Comments:


Author Thread:
asktech
how to iterate xsl:for-loop
Posted: Friday, July 15, 2005 9:40 AM (UMST)

Hi,

Once a variable is defined, you cannot change its value so if you just want to iterate over the integers, for example below code extract the first ten:

 

 <xsl:for-each select="//*[position() &lt;= 10]">
    ...
 </xsl:for-each>


where position() will go from 1 to 10

 

Hope it helps!!

Average Rating:
timsmith
how to iterate xsl:for-loop
Posted: Friday, July 15, 2005 10:02 AM (UMST)

Hi,
To loop it you can use something like this

 

<xsl:for-each select="catalog/cd">
      <tr>
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="artist"/></td>
      </tr>
</xsl:for-each>

 

Thanks
Tim

Average Rating:

Ferotech Solution Services Inc.