Inside Xslt

Part 1 of XPath Location Steps: Axes

In the location path ancestor :: NAME , which refers to a <NAME> element that is an ancestor of the context node, ancestor is the axis. XPath supports many different axes, and heres the complete list:

In the following example template I use the descendant axis to indicate that I want to match descendants of the context node, which include child nodes, grandchild nodes, great-grandchild nodes, and so on:

<xsl:template match="PLANET"> <DATA> <NAME> <xsl:value-of select="descendant::NAME"/> </NAME> <MASS> <xsl:value-of select="descendant::MASS"/> </MASS> <DAY> <xsl:value-of select="descendant::DAY"/> </DAY> </DATA> </xsl:template>

This chapter looks at each of these axes. In this example, descendant is the axis, and the element names NAME , MASS , and DAY are node tests .

Категории