RE: Testing for a following sibling node type that oc
I changed your test a little, so I detect all the last 'B' by testing if the name of the actual node differs from the name of the following node. I hope this will help you
Given that it is known, in this test, that the context node is a 'B', this could be
<xsl:for-each select="B"> <xsl:if test="not(following-sibling::B)"> <xsl:value-of select="." /> </xsl:if> </xsl:for-each>
... but I don't think it answers the OP's requirement.
As I recall, Mike suggested child::A/preceding-sibling::B, which isn't considered adequate because the context node is already a B, not the parent of the As and Bs. So the requirement is not to *select* all B nodes that have no Bs after them before As, but to test true on a B context node that is (as the OP said) "the last 'B' node that occurs before the next 'A' node".
In other words, the context node is a B, and the test should detect that the directly following sibling is not a B, but that there is an A following sibling.
test="following-sibling::*[not(self::B)] and following-sibling::A"
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format