Home > Articles

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Summary

XSL transformations can be carried out from the command line of most XLST processors, but their real power comes when you add them to an application.

The most common way to carry out transformations within an application is to use some variation of TrAX (Transformation API for XML). Using this method, a source, style sheet, and result are designated; a Transformer object is created using the style sheet object; and this Transformer object transforms the source into the result. In some languages, a similar approach is used, where the object itself carries out the transformation using the style information.

Transformations can be integrated with SAX applications. A SAX stream can serve as the source or the result of the transformation, and a reader can use a transformer as the ContentHandler to perform the transformation as part of the natural parsing process. Transformations can be chained together with or without XMLFilters.

Programming can also take place within the spreadsheet itself. We looked at JavaScript and Java, but most other languages can also be added to a style sheet as long as the processor supports them. XSLT 1.0 allows extension through functions, which can have a parameter passed in, and elements, which can pass in attribute values and can access the context of the request to pull information directly from the original document.

  • + Share This
  • 🔖 Save To Your Account