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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
8.04Mb size Format: txt, pdf, ePub
indent
If this attribute has the value
yes
, the idea is that the XML output should be indented to show its hierarchic structure. The XSLT processor is not obliged to respect this request, and if it does so, the precise form of the output is not defined.
There are some constraints on how indentation should be achieved. In effect, it can only be done by adding whitespace-only text nodes to the tree, and these cannot be added adjacent to an existing non-whitespace text node. XSLT 2.0 has introduced a rule that the added text node must be adjacent to an element node, that is, immediately before a start tag or after an end tag (in 1.0, it could be added as a child of an empty element).
Note that even with these restrictions, adding whitespace nodes to the output may affect the way the recipient interprets it. This is particularly true with mixed content models, where an element can have both elements and text nodes as its children.
The serializer is not allowed to add whitespace text nodes to the content of an element that has the attribute
xml:space=“preserve”
, and the spec advises against adding whitespace to an element that is known to have mixed content.
media-type
This parameter defines the media type of the output file (often referred to as its MIME type). The default value is
text/xml
. The specification doesn't say what use is made of this information: it doesn't affect the contents of the output file, but it may affect the way it is named, stored, or transmitted, depending on the environment. For example, the information might find its way into an HTTP protocol header.
normalization-form
One of the controversial features of Unicode has always been that it allows the same character to be represented in more than one way. For example, the letter
Ç
(lower-case
c
with cedilla) can be represented either as a single character (with codepoint xE7), or as the two codepoints:
c
(x63) and
,
(xB8). This fact causes considerable problems for software that performs comparison, search, and indexing operations on Unicode text. There have been long debates about whether XML should require such characters to be normalized (that is, to require one of these representations and disallow the other). The result of the debate is a compromise: XML 1.1 strongly encourages the use of normalized encodings. It encourages applications to output normalized text, and encourages parsers to provide an option that checks for normalized text, but it does not go so far as to say that non-normalized documents are not well formed.
XSLT 2.0 responds to this by providing an option to serialize the document in Unicode-normalized form. Specify
NFC
for composed normal form,
NFD
for decomposed normal form, any other supported normalization form, or
none

Other books

Tailspin (Better Than You) by Raquel Valldeperas
Rebellion by Stephanie Diaz
Solemn Vows by Don Gutteridge
Night Feast by Yvonne Bruton
NOLA by Alexie Aaron
The Shop by J. Carson Black