I have a structure with repeating elements like this:
<a>
<b>
<a>
</a>
</b>
<a>
<b>
<a>
<c att="val" />
</a>
</b>
</a>
</a>
When using c-node is $ currentNode when I use XPath
<xsl:value-of select="($currentNode/ancestor-or-self::a)" />
I get an unordered list of nodes matching the expression. What I need is to always bring the node closer to the tree, as to the deepest in the branches or to the highest level.
I cannot use the maximum XPath 2 function, like this, unfortunately:
<xsl:value-of select="($currentNode/ancestor-or-self::a)[max(@level)]" />
Note that the closest a-node is not always exactly above the context, somewhere there ...
Any suggestions appreciated!
Relationship Alex
source
share