Accessing Node Values

The <xsl:value-of> element writes the string value of an expression to the result document; in particular, you can use it to return the value of a node, which, for an element, is the element’s enclosed text.

You can assign the <xsl:value-of> element’s select attribute an XPath expression that specifies a node or node set. When you’re in the template that matches <PLANET> elements, you can use the XPath expression "child::MASS" to refer to the <MASS> child element. As you’ll see in Chapter 4, you can abbreviate XPath expressions in a number of ways, and in particular, "child::MASS" can also be written simply as "MASS". That means you can recover the data from the child elements such as <MASS>, <DAY>, and so on in this way: ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.