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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access