I am now using xpath to test a node's parent node's immediate following sibling(uncle or ant) node.
My xml looks like
<MyParent>
<A>
<B>
<C>
</MyParent>
<Uncle>
..
</Uncle>
Now I am in the template match for child node B, and I want to test if the immeididate following-sibling of my parent is called "Uncle",
I tried the following two xpaths:
<xsl:if test="parent::MyParent/following-sibling::*[1][self::Uncle]">
<xsl:text>we have it</xsl:text>
</xsl:if>
and
<xsl:if test="parent::MyParent[following-sibling::*[1][self::Uncle]]">
<xsl:text>we have it</xsl:text>
</xsl:if>
neither of them will work, could experts help debug where I made mistakes? Thanks :).
Try this.
../following-sibling::*[position()=1][name()='Uncle']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With