- The local-name function returns the name of its argument (without the namespace) or the name of the current element if it's called without an argument;
- The parent:: axis selects the current element's parent;
- The parent::* matches any node that is the parent of the current element.
<book>… this XSL template will output “My parent is: section”
<chapter>
<section>
<title>My section</title>
<para>My paragraph</para>
</section>
</chapter>
</book>
<xsl:template match="para">
My parent is: <xsl:value-of select="local-name(parent::*)" />
</xsl:template>
This post is part of You've asked for it series of articles.
No comments:
Post a Comment