Outputting the Results
So, how do you get output from the XSL processor? The answer depends on how you invoke the processor. For our purposes, let’s assume that this is a static style sheet stored in a file called invoice.xsl. Now, you can attach the style to the XML source document in one of two ways. The easiest is to include an <?xml-stylesheet> directive in the source document. If you leaf back to Listing 2.1, you’ll notice the following statement at the top of the listing:
<?xml-stylesheet type="text/xsl" href="invoice.xsl"?>
When the XML parser sees this line, invoice.xsl is loaded and applied to the source document. The resulting output is shown in Listing 2.4.
Listing 2.4. Output from the XSLT Processor
<HTML> <HEAD> <TITLE>First ... |
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.