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 ...
Get Special Edition Using 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.