XML

Summary

XSL (Extensible Style Language) is an extremely powerful style sheet technology that is aimed at providing a purely XML-based solution for the transformation and formatting of XML documents. XSL consists of three fundamental technologies: XSL Transformation (XSLT), XPath, and XSL Formatting Objects (XSL-FO). XSLT tackles the transformation aspect of XSL and is capable of transforming an XML document in a particular language into a completely different XML-based language. XPath is used within XSLT to identify portions of an XML document for transformation. XSL-FO addresses the need for a high-powered XML-based formatting language. XSL-FO has limited support in current web browsers, but XSLT and XPath are more than ready to deliver for web-based applications.

This tutorial introduced you to the different technologies that comprise XSL. Perhaps more important is the practical knowledge you gained of XSLT, which culminated in a complete XSLT style sheet example. Just in case you're worried that this tutorial hit only the high points of XSLT, the next tutorial digs deeper into the technology and uncovers topics such as sorting nodes and using expressions to perform mathematical computations.

Q&A

Q.

Why bother with XSLT when I can just use CSS to create style sheets for XML documents?

A.

If all you need to do is simply display the content in an XML document, CSS may in fact be your best option. However, XSLT allows you to process XML content and gives you a fine degree of control over what content is displayed and the order in which it appears. So, even though XSLT doesn't directly play a role in formatting documents for display, it provides a considerable amount of indirect control when it comes to isolating data, sorting data (numerically or alphabetically, for example), and performing calculations on data within XML documents.

Q.

How can there be separate namespaces for XSLT and XSL-FO if they are both part of XSL?

A.

XSLT and XSL-FO have different namespaces because they are different languages. Keep in mind that each of these technologies is implemented as an XML-based markup language. Because it is possible to use the two technologies independently of one another, they occupy separate namespaces. You can certainly use both XSLT and XSL-FO in the same XSL style sheet, in which case you would declare both namespaces with their own prefixes. For the time being, however, you will likely create XSL style sheets using only XSLT, in which case you can refer to the style sheet as an XSLT style sheet.

by BrainBellupdated
Advertisement: