From my experiences with using XSL to transform XML documents, I frequently find the need to test the name of either the sibling directly following or directly preceding a given node. Unfortunately, there is not XPATH expression that provides this functionality. The following code should give you what you are looking for, however.
Check to see if the first preceding sibling is "car":
|
<xsl:if test="name(preceding-sibling::*[1]) = 'car'">
<!-- code to execute -->
</xsl:if>
|
Likewise, to test to see if the first following sibling is "car" use the following:
|
<xsl:if test="name(following-sibling::*[1]) = 'car'">
<!-- code to execute -->
</xsl:if>
|





