Chapter 4. Stylesheets and Schemas

One of the most important innovations in XSLT 2.0 is that stylesheets can take advantage of the schemas you have defined for your input and output documents. This chapter explores how this works.

This feature is an optional part of XSLT 2.0, in two significant ways:

  • Firstly, an XSLT 2.0 processor isn't required to implement this part of the standard. A processor that offers schema support is called a schema-aware processor; one that does not is referred to as a basic processor.

  • Secondly, even if the XSLT 2.0 processor you are using is a schema-aware processor, you can still process input documents, and produce output documents, for which there is no schema available.

There is no space in this book for a complete description of XML Schema. If you want to start writing schemas, I would recommend you read XML Schema by Eric van der Vlist (O'Reilly & Associates, 2002) or Definitive XML Schema by Priscilla Walmsley (Prentice Hall, 2002). XML Schema is a large and complicated specification, certainly as large as XSLT itself. However, it's possible that you are not writing your own schemas, but writing stylesheets designed to work with a schema that someone else has already written. If this is the case, I hope you will find the short overview of XML Schema in this chapter a useful introduction.

XML Schema: An Overview

The primary purpose of an XML Schema is to enable documents to be validated: they define a set of rules that XML documents must conform to, and ...

Get XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.