Practical Considerations
Because a style sheet is simply a valid document, you can easily load one into a DOM parser. What’s more, you can create a DOM and write it out to a file just as you would with any other XML document.
The easiest way to do this—and the way that works with the widest range of parsers—is to load a skeletal XSLT document into the DOM. Then you can alter the DOM to suit your needs. Of course, you can generate the document based on the data, but you can also modify the styles based on other criteria such as user preference, the current date, or any other variable you can incorporate into your script or program.
Consider Listing 11.1, which shows a simple XML document that contains a magazine article. You can see that there ...
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.