XML technologies / XML / Python & XML / Transforming XML with XSLT
(Excerpt from "Python & XML" by Christopher A. Jones & Fred L. Drake, Jr.)
We have already discussed capturing XML parsing events with SAX and outputting corresponding HTML for display in a browser. XML’s power lies in representing data for its own sake, without concern for presentation on web pages, portable devices, in PostScript files and so on. Instead, XML describes only the structure of the information. We therefore routinely parse XML and convert it to another format, such as HTML, for viewing.
This section explains the eXtensible Stylesheet Language Transformations (XSLT). One of XSLT’s simplest uses is transforming XML documents into HTML documents browsers can handle. We will create an XSLT stylesheet performing the transformation previously done with SAX, with much less effort. Remember, however, that XSLT does much more than produce HTML: it can transform an XML document written for a particular DTD or in a particular dialect into another dialect. These XML-to-XML transformations are powerful when business documents are exchanged between Internet domains using different dialects. Dialects and validation are covered in XML validation and dialects.
Copyright © 2002 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from the book "Python & XML" is subject to the same conditions as the printed edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de
back to top