Getting the Content of an Element
As you scan down Listing 2.3, you’ll see the first XSLT element, <xsl:value-of>. The purpose of the <value-of> element is to retrieve the content from an element or an attribute. The <value-of> element takes an optional select attribute and a pattern (or location path) that allows you to specify a node or collection of nodes from which to get content. In this case, Listing 2.3 uses <xsl:value-of select="invoice/clientName"> to grab the content from the <clientName> element in the source tree and insert it into the result tree.
In constructing the pattern, you’ll notice that the step pattern does not contain a beginning slash to tell the processor to begin its search at the root node. The reason is that the template ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access