Adding New Template Rules

The style sheets presented thus far have used <value-of> to retrieve the content of top-level elements and attributes. However, the XML document instance in Listing 2.1 also contains subelements, namely, the address element:

<invoice num=”2317” invoiceDate=”07-09-01”> 
        <streetAddress>123 Fourth Street</streetAddress> 
        <province /> 

To retrieve the content from, say, <streetAddress>, you could assign a step pattern in the select attribute of a <value-of> element. That might look something like:

<xsl:value-of select="invoice/address/streetAddress" /> 

This approach works fine for this example because ...

Get Special Edition Using XSLT now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.