1

Topic: The previous value of a node in a cycle

Cycle for each, inside it is necessary to deduce certain values, only if they differ from the previous.
Tried to get a variable and in a cycle to write to it the previous value, but she should be declared before.
But if to declare it before a cycle works not correctly.
Probably, there is a variant without a variable to address to value of the previous position in a cycle for each?

2

Re: The previous value of a node in a cycle

<xsl:for-each select = "*">
<xsl:if test = "position ()> 1">
<xsl:value-of select = "./* [position () - 1]" /
</xsl:if>
</xsl:for-each>

In the presence of sorting will not work.
As a variant - to use not "the previous value", and classical grouping

<xsl:for-each select = "*">
<xsl:if test = "not (preceding-sibling:: * [. = current ()]">
<xsl:value-of select = "." /
</xsl:if>
</xsl:for-each>