Hi,
Tempore 08:01:15, die Wednesday 10 August 2005 AD, hinc in foro {comp.text.xml} scripsit Cali <killycali007->:
> Please bear with me, I have been reading about XSL for a couple hours.
>
> I have an XML document that contains multiple <page> tags interspersed
> throughout the tree.
>
> <text>
> ...
> <page>1</page>
> ...
> <page>2</page>
> </text>
>
> I also want to evaluate whether the text value of the current <page>
> node is in sequence with the previous one, if not then mark the output.
> I would have imagined that it would be something like this but it
> doesnt work.
Instead of going to mess with 'position()', try the more reliable 'preceding' axis:
<xsl:template match="/">
<xsl:for-each select='.//page'>
<xsl:variable name="this_page_number" select="."/>
<xsl:variable name="prev_page_number" select="preceding:

age[1]"/>
<xsl:variable name="expected_prev_page_number" select="$this_page_number - 1"/>
<xsl:if test="$expected_prev_page_number != $prev_page_number">
<strong>Sequence broken!</strong>
</xsl:if>
Page <xsl:value-of select="$this_page_number"/><br/>
</xsl:for-each>
</xsl:template>
regards,
--
Joris Gillis (
http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple