January 2003
Beginner to intermediate
1200 pages
23h 42m
English
The template I used in the previous section applied only to one node, the root node, and it performed a trivial action, replacing the entire XML document with an HTML document. However, you can also apply templates to the children of a node that you've matched, and you do that with the <xsl:apply-templates> element.
For example, say that I want to convert ch13_01.xml to HTML. The document node in that document is <PLANETS>, so I can match that element with a template, setting the match attribute to the name of the element I want to match. Then I can replace the <PLANETS> element with an <HTML> element, like this:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> ...