How Stylesheets Work

Page Index

Introduction

Stylesheets can be used for any (or all) of the following purposes:

Why XSL Stylesheets specifically?

XSL (Extensible Stylesheet Language) is the W3C recommended stylesheet standard

An XML document typically contains no information on presentation: it is simply a representation of the information hierarchy present in the document. For example, a sentence might be represented in XML as follows.

<sentence>
   <noun>Jack</noun>
   <verbphrase>
         <verb>kissed</verb>
         <noun>Jill</noun>
   </verbphrase>
</sentence>

While this is rich in information that might be useful to a syntactician, the non-linguist would prefer to view this sentence without all the syntactic markup and non-linear formatting, probably marked-up with simply a period at the end. Unfortunately, no web-browser yet developed knows what a sentence, verbphrase or noun tag means, let alone how to display it.

Therefore there must be something in addition to the XML document that describes how the document should be displayed; and that is XSL!

How does XSL work?

XSL consists of three parts:

Simply put, XSLT is the most important part of the XSL standard. It is used to transform an XML document into another XML document, or any plain text format. One such format is XHTML. Normally, XSLT does this by transforming each XML element into an XHTML element.

With XSLT you have the ability to control and manipulate the elements in the output file. You can add new elements, remove elements, and rearrange and sort elements. You can also test to make decisions about which elements to display.

More about creating an XSL page.

See example XSL files.

User Contributed Notes
How Stylesheets Work
+ Add a comment
  + View comments

Back to top Credits | Glossary | Help | Navigation | Site Map | Site Search