X hits on this document





40 / 142

Chapter 6. Transforming XML with XSLT


Besides CSS files, there is another method for transforming XML documents into something more hu- man readable. Its called eXtensible Stylesheet Language: Transormation (XSLT). XSLT is a program- ming language implemented as an XML semantic. Like CSS, you first write/create an XML file, you then write an XSLT file and use a computer program to combine the two to make a third file. The third file can be any plain text file including another XML file, a narrative text, or even a set of sophisticated commands such as structured query language (SQL) queries intended to be applied against a relational database application.

Unlike CSS or XHTML, XSLT is a programming language. It is complete with input parameters, condi- tional processing, and function calls. Unlike most programming languages, XSLT is declarative and not procedural. This means parts of the computer program are executed as particular characteristics of the data are met and less in a linear top to bottom fashion. This also means it is not possible to change the value of variables once they have been defined.

There are a number of XSLT processors available for various Java, Perl, and operating-system specific platforms:

  • Xerces and Xalan [http://xml.apache.org/] - Java-based implementations

  • xsltproc [http://xmlsoft.org/XSLT/xsltproc2.html] - A binary application built using a number of C

libraries, and also comes with a program named xmllint used to validate XML documents

  • Sablotron [http://www.gingerall.com/charlie/ga/xml/p_sab.xml] - Another binary distribution built

using C++ libraries and has both a Perl and a Python API

  • Saxon [http://saxon.sourceforge.net/] - another Java implementation

A few XSLT elements


Document info
Document views503
Page views509
Page last viewedTue Jan 17 08:54:28 UTC 2017