Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
use-character-maps optional | Whitespace-separated list of lexical QNames | A list of the names of |
output-version optional | Attribute value template returning an NMTOKEN | Defines the version of the output format (corresponds to the version attribute of |
Content
The content of the
The
version=“2.0”
on the
Effect
When the
The Content of the Document
on page 303. The tree rooted at this document node is referred to as a final result tree.
Validation of the result tree also follows the same rules as
Validating and Annotating the Document
on page 305. Note that although the validation process (if requested) conceptually creates a result tree in which the elements and attributes are annotated with types, these type annotations will never be seen if the result tree is immediately serialized. But a very useful processing model is to run a series of transformations in a pipeline, where the output of one stylesheet provides the input to the next. The pipeline might also include non-XSLT applications. The new XProc specification from W3 C (
www.w3.org/TR/XProc
) is designed to standardize the way such pipelines are written.
The difference between
What actually happens to a final result tree is to some degree system-dependent, and it is likely that vendors will provide a degree of control over this through the processor API.
Often, the result tree will be serialized (perhaps as XML or HTML) and written to a file on disk. The location of the file on disk is controlled using the
href
attribute, and the format in which it is serialized is controlled using the
format
attribute, supplemented by the serialization attributes (
method
,
byte-order-mark
,
cdata-section-elements
,
doctype-public
,
doctype-system
,
encoding
,
escape-uri-attributes
,
include-content-type
,
indent
,
media-type
,
normalization-form
,
omit-xml-declaration
,
standalone
,
undeclare-prefixes
,
use-character-maps
, and
output-version
).
If the
format
attribute is present then its value must be a lexical QName, which must match the
name
attribute of an
use-character-maps
are attribute value templates, which means that their values may be calculated at runtime, perhaps based on a stylesheet parameter or on data in the source document. If there is no
format
attribute, then the result tree (assuming it is serialized at all) will be serialized as specified by the unnamed
The way in which the
href
attribute is used is deliberately left a little vague in the specification, because the details are likely to be implementation-dependent. Its value is a relative or absolute URI. Details of the URI schemes that may be specified are left entirely to the implementation. The specification is also written in such a way that the URI can be interpreted as referring either to the result tree itself or to its serialized representation. The important thing that the specification says is that it is safe to use relative URIs as links from one output document to another: if you create one result document with
href=“chap1.html”
and another with
href=“chap2.html”
, then the content of the first document can include an element such as
href=“chap2.html”>next
chapter
and expect the link to work, whether the result trees are actually serialized or not. The specification achieves this by saying that any relative URI used in the
href
attribute of an
Base Output URI
, which in effect is supplied in the API that invokes the transformation.
We are used to thinking of URIs rather like filenames: as addresses of documents found somewhere on the disk. In fact, URIs are intended to be used as unique names for any kind of resource, hence their use for identifying namespaces and collations. Using URIs to identify final result trees (which might exist only as a data structure in memory) is no different. Implementations are expected to provide some kind of mechanism in their API to allow the application to process the result tree, given its URI.
One way this might be done is to allow the application, when the transformation is complete, to use a method call such as
getResultDocument(URI)
to get a reference to the result tree with a given URI, perhaps returned in the form of a DOM document.
Another possible mechanism is for the application to supply a resolver or listener object, which is notified whenever a result tree is created. This is the technique Saxon uses: if a user-written
OutputURIResolver
has been registered, then it is handed the result tree and the URI, and has free rein in deciding what to do with it.
The specification of