Found this useful? Love this post

Compare the current and next node names using XPATH

In your XSL, if you need to test to see if the next element is named the same as the current one you can use the following piece of code to get the result using a combination of XPATH axes and the name() function.

<xsl:if test="name(./following-sibling::*) = name(.)">
            <!-- Do something -->
</xsl:if>

This little test got me stumped for a good half an hour. Hopefully this helps some other people.

Subscribe

You'll only get 1 email per month containing new posts (I hate spam as much as you!). You can opt out at anytime.

Categories

Leave a Reply

Your email address will not be published. Required fields are marked *

Preview Comment

css.php