Almost correct.
<xsl:if test="preceding-sibling::recurso[1]/unidad != unidad">
</xsl:if>
The ::
is for axes, not for moving along a path ("making a location step"). In XPath terminology:
preceding-sibling::recurso[1]/unidad != unidad
''''''''''''''''' ++++++++++ ++++++
###
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
' = axis name (optional, defaults to "child")
+ = node test (required)
# = predicate (optional, for filtering)
~ = location step (required at least once per select expression)
The [1]
is a shorthand for [position()=1]
.
The child
axis is implicit in a location step, so this
preceding-sibling::recurso[1]/unidad != unidad
is equivalent to this:
preceding-sibling::recurso[1]/child::unidad != unidad
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…