Formatting the XML Specification


In this worked example, we'll study the stylesheet used for formatting the XML specifications themselves . You may have noticed that on the W3C Web site, you can get the specifications for standards such as XML, XSLT, and XPath either in XML format or in HTML. We'll look at a stylesheet for converting the XML Recommendation from its XML form to its HTML form, shown in Figure 10-1.

click to expand
Figure 10-1

The DTDs and stylesheets used for the XSLT, XQuery, and XPath specifications are adapted from the version used for the XML specification, and we'll take a look at the adaptations too.

The download file for this chapter on http://www.wrox.com/ contains the version of the stylesheet modules that were actually used to publish the last-call working draft of XSLT 2.0 on November 12, 2003. These may differ slightly from the version presented in the text.

This stylesheet is a classic example of the rule-based design pattern, which was introduced on page 620 in Chapter 9. It makes minimal assumptions about where all the different elements in the XML source document appear relative to each other, and it allows new rules to be added freely as the document structure evolves.

You'll probably find it helpful while reading this stylesheet to have the XML source document readily accessible. The official version of XML 1.0 Second Edition (the document shown above) is on the Web at http://www.w3.org/TR/2000/REC-xml-20001006.xml .

There is also a DTD called xmlspec.dtd . You can view the source either in a text editor, or in an XML editor such as XML Spy, or using the default XML viewer in Internet Explorer or Netscape.

Now let's look at the stylesheet, xmlspec.xsl .




XSLT 2.0 Programmer's Reference
NetBeansв„ў IDE Field Guide: Developing Desktop, Web, Enterprise, and Mobile Applications (2nd Edition)
ISBN: 764569090
EAN: 2147483647
Year: 2003
Pages: 324

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net