xsl-list
[Top] [All Lists]

RE: FW: problem integrating xsl iteration

2004-09-27 09:46:57


which would be something like

<xsl:template match="TotalPages">
 <xsl:param name="x" select="."/>
 <xsl:if test="$x != 1">
 <xsl:apply-templates select="."/>
  <xsl:with-param name="x" select="$x - 1"/>  
</xsl:apply-templates>  </xsl:if>  <a 
href="page{$x}.html"><xsl:value-of select="$x"/></a> </xsl:template>

A potential (non head-recursive :) XSLT 2.0 solution would be:

<xsl:template match="TotalPages">
    <xsl:for-each select="for $i in 1 to . return $i">
      <a href="page{.}.html"><xsl:value-of select="."/></a>
    </xsl:for-each>
</xsl:template>

I'm still learning v.2.0 things - can this all be done in a single xpath
(create the element and the attribute)?

cheers
andrew


<Prev in Thread] Current Thread [Next in Thread>