About Stylesheets

Page Index

What is an XSL stylesheet?

An XSL stylesheet contains a set of rules, which specify how a specific element in an XML document is to be presented.

Stylesheets define the layout of the document: they can specify which elements are to be displayed, and in what order. The rules can also specify the font to use, the size of the text, as well as spacing on the page and other display properties.

The use of a stylesheet does not change the original file, and this is one of its great assets. XML tags are typically used to mark the semantics of what is in a file, not its presentation. It is the stylesheet which takes that information and presents it in an appropriate format. Several presentation formats may in fact be used to display a single XML page, depending on the needs or preferences of the user.

XSL is the W3C recommended stylesheet standard. XSL Transformations can be used to transform an XML document into another XML document, into any plain text format, or even PDF and Word formats.

This part of the school is designed to be a Linguist's introduction to the use of stylesheets. For more tools for learning XSL, visit the following sites:

Why do I need stylesheets?

Stylesheets are helpful tools for displaying your data.

Do browsers support formatting via XSL stylesheets?

Yes, Internet Explorer 6 (on Windows), Netscape 7 (all platforms) and Firefox fully support the official W3C recommendation.

How can I view an XML document in a web-browser?

If there is no associated stylesheet specified in the XML document, you will see the bare tree structure of the XML document.

The XSL transformation engine is automatically invoked when the XML document contains an <?xml-stylesheet?> processing instruction at the beginning, which specifies the stylesheet that should be used. Thus all you need to do to view the file is to open the XML document with the browser.

What is XHTML (Extensible Hyper Text Markup Language)?

XHTML is almost identical to HTML 4.01, but it is a stricter and cleaner version of HTML: XHTML is HTML defined as XML. This means that:

More information is available from W3C Schools.

More about how XSL works.

Create an XSL page.

See example XSL files.

User Contributed Notes
XSL Stylesheets
+ Add a comment
  + View comments

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