Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development

  • Print
  • + Share This
From the author of

Use of XSL

Separating format from content is all well and good, but sooner or later you need to format information for presentation. XML by itself is not acceptable for display to the average user. The technology for formatting XML presentation is eXtensible Stylesheet Language (XSL). Unlike traditional style sheets, which provide only formatting commands, XSL is a powerful mechanism for both transforming and formatting XML documents.

XSL is an XML markup language itself and as such, can

  • Format content for online display or for paper-based delivery

  • Add constant text or graphics (such as the icons in the "warning" example)

  • Filter content

  • Sort or reorder text

There are actually three parts to XSL:

  • XPath

  • XSL Transformations

  • XSL-FO (formatting objects)

Traditional style definitions are very restricted in the way they identify elements for formatting. XPath is a mechanism for identifying and formatting specific elements in an XML document. XPath enables you to apply logic to your formatting. In the XSL style sheet, you can identify and apply specific formatting or transformation to elements, such as a title following a chapter, the first paragraph in a section, and every other bullet in a list.

Other style sheets enable you to describe all your formatting needs, including fonts, colors, sizes, margins, bullets, list numbers, and so on, in a WYSIWYG editor.

But rather than simply formatting the information in a document, XSL gives you the capability to transform it into something else. That is, you can manipulate the information to reorder, repeat, filter out information, or even add information based on details in the file. This is where XSL transformations, also known as XSLT, fit in. XSLT enables you to transform an XML document into another markup language. The most common use of XSLT is to transform information to HTML for display on the Web. But XSLT can also be used to convert information from XML into markup for wireless display, for transmission to PDAs and web-enabled cell phones.

The flexibility of XSL and its pieces is extremely valuable for information publication and presentation. Unlike traditional tools, which associate one style sheet with one document, you can create any number of style sheets for a single XML document or information type. If you want to post the document on the Web, create an XSL style sheet to HTML. For wireless, create an XSL style sheet to WML.

Despite the unstoppable growth of the Internet and display technologies, paper will continue to be a required output for information. XSL-FO has been designed for that purpose. If you want paper, create an XSL-FO style sheet. XSL Formatting Objects (XSL-FO) provides style sheet capabilities for converting XML to paper-based formats such as PDF. It provides for all the required formatting, including page layouts, headers, footers, recto/verso (odd/even) pages, portrait and landscape pages, and so on.

When the information is ready to publish, you can process the file against all style sheets simultaneously and get all required outputs at the same time.


Personalization is very popular for web delivery of content. Personalization, simply defined, is information that can be manipulated to serve the needs of a specific user. It can be user defined, or it can be managed by software, based on a user's login information. Personalization that is "managed by software" may be controlled by observing user behavior, and/or combined with preferences to create a personalized experience.

With XML, documents can be broken down, stored as separate physical pieces in a database, and then assembled in any order to meet user demands.


XML is not the only technology solution for reuse, but it is the most powerful by far. XML combines the best functionality of SGML with the ease-of-use of HTML, which provides the best of both worlds.

  • + Share This
  • 🔖 Save To Your Account