XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (676 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
4.15Mb size Format: txt, pdf, ePub
The XPath data model, and therefore the result tree, is not tied to a particular version of XML. It supports the union of what can be represented in XML 1.0 and XML 1.1. This creates the possibility that the result tree uses features that cannot be represented faithfully (or at all) in XML 1.0. If such features are used, the serializer may need to fall back to a 1.0 representation, or if all else fails, report an error.

Do remember that the

element will only be effective if you actually use the XSLT processor to serialize the XML. If you write the output of the transformation to a DOM, and then use a serializer that comes with your DOM implementation (for example by using the
save
method or the
xml
property in the case of the Microsoft DOM implementation), then the

specifications will have no effect.

The HTML Output Method

When the
method
attribute is set to
html
, or when it is defaulted and the result tree is recognized as representing HTML, the output will be an HTML file. By default, it will follow the rules of HTML 4.0.

Requesting HTML serialization gives no guarantee that the result will be valid HTML. You can use any elements and attributes you like in the result tree, and the serializer will output them, following the HTML conventions where appropriate, but without enforcing any rules as to which elements can be used where.

HTML is output in the same way as XML, except where specific differences are noted. These differences are:

  • Certain elements are recognized as empty elements. They are recognized in any combination of upper and lower case, but they must not be in a namespace. These elements are output with a start tag and no end tag. For HTML 4.0 these elements are:















  • The