What Is XSLT?

  • W3C Recommendation Extensible Stylesheet Language Transformations.
  • The standard for defining the transformation of XML data.
  • A methodology for preparing data for input to a program or preparing output data for displaying, printing or processing by another program.
  • A powerful, easy-to-learn and use tool for processing XML documents into new output forms.
  • A commonly-used technique to render XML to HTML for dynamic Web delivery.
  • When coupled with XSL Formatting Objects, a way to render XML documents for printing and high-quality (print-like) online display.

Benefits:

Application Development

  • Removes need to build purpose-built XML transformation systems.
  • Easy to learn and use.
  • Enables rapid development and deployment of XML transformation processes.

Application Maintenance

  • Lots of skilled XSLT programmers ensures ability to maintain XSLT applications over time.
  • Separates input or output XML transforms from core business logic.
  • Style sheets can be modularized into re-usable code modules.

How XSLT works:

Most XML documents are designed to hold data in terms of the kinds of real-world things that data represents, whether it be parts in a parts catalog, components of technical documents, or structured messages passed between applications. For many uses of XML documents there is a requirement to transform the XML data into some other format, either another XML document or into non-XML data. That is, many, if not most, XML processes involve transforming input XML documents into some kind of output. One very common case of this is transforming XML documents into HTML for display in Web browsers.

The XSLT recommendation provides a powerful but fundamentally simple mechanism for transforming XML documents into new forms. An XSLT stylesheet is a set of rules, called templates , that map input elements to some output. These templates use XPath pointers to specificy which elements are processed by which templates. For example, to map the input element “section” to the HTML element “div”, you would use a template like this:

<xsl:template match="section"> <div> <xsl:apply-templates/> </div> </xsl:template>

The “match='section'” attribute says this template will match every <section> element in the input document. The output result will be the start tag <div>, followed by whatever is done with the content of the input <section> element, followed by the end tag “</div>”.

The XSLT processor handles the task of walking the input document's element tree, applying the appropriate template at each step. Simple templates that just map input elements to corresponding output elements can be as simple as the example shown here: a collection of individually-simple templates that, together, form a complete transformation script. When the output document is in XML or HTML format, the XSLT processor handles all the details of making sure the generated markup is correct.

All XSLT processors must and do provide some form of extension mechanism by which you can add new functions to XSLT to support specialized requirements that XSLT does not support by itself. Such customizations include functions for accessing custom applications or data sources, custom sort algorithms for different national languages, and functions that implement complex business rules that would be inefficient to implement directly in XSLT.

XSLT is simply a transformation mechanism. If your requirement is to produce printed documents from XML, you can use XSLT to transform your input XML documents into XSL Formatting Objects documents, which can then be processed by XSL engines into high-quality print documents (including PDF).

 
 

 

InfoMedia offers a wide range of XML services:

 

CSS
DOM
GROVEs
HTML
HyTime
RDF
SAX
SOAP
SGML
SVG

XLink
XML
XMLNamespace
XMLSchemas
XPath
XPointer
XQuery
XLT Formatting
XSLT
XTM

 
 
 
 

InfoMedia has developed and is on the verge of securing patent rights for the Remote Medical Imaging (RMI) System (TM), a computer based prototype that transmits and stores full motion medical diagnostic images in real time over existing telephone lines. Click here to learn more about our Telemetric services....