So to follow up on the original question, I have a very similar question but can't seem to get this working...
In the case i have a for-loop and i'm doing something like this:
Code:
<xsl:for-each select="sample/number">
<xsl:choose>
<xsl:when test="@number=1">
<xsl:variable name="xAns" select="@answer"/>
<sample-1 answer="{$xAns}"/>&newline;
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="@number=2">
<xsl:variable name="xAns" select="@answer"/>
<sample-2 answer="{$xAns}"/>&newline;
</xsl:when>
</xsl:choose>
etc...
So saying the original XML looks something like this....
Code:
<sample number=1 answer=434/>
<sample number=2 answer=438/>
...
<sample number=5 answer=534/>
<sample number=1 answer=538/> and then the numbering restarts back to one
What I would like to know is how to turn that sample number=1 where the numbering RESTARTS to 6. So I would like it to say
Code:
<sample number=5 answer=534/>
<sample number=6 answer=538/>
<sample number=7 answer=542/>
etc...
I was thinking something like
Code:
<xsl:choose>
<xsl:when test="@number=1[2]">
<xsl:variable name="xAns" select="@answer"/>
<sample-6 answer="{$xAns}"/>&newline;
</xsl:when>
</xsl:choose>
But the above doens't seem to work.