Adding Templates to Read the Data That Isn't in the <Author> or <Publisher> Nodes

In the previous example, the data that was extracted from the XML file by the template was from the <Author> and <Publisher> nodes, both of which have child nodes. In the next example, you'll see how the data from the nodes without child nodes is extracted. Reopen listing12-4.xsl and modify it to match Listing 12.6. Save it as listing12-5.xsl. The additional lines are marked in bold.

Listing 12.6 Reading the Data That Isn't in the <Author> or <Publisher> Nodes
 1: <?xml version="1.0"?> 2: <!-- This file is an XSL style sheet file that is used to 3: read the data from the simple book catalog database. 4: --> 5: <xsl:stylesheet xmlns:xsl="uri:xsl"> 6: <xsl:template ...

Get Sams Teach Yourself XML in 24 Hours 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.