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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
4.22Mb size Format: txt, pdf, ePub

The XHTML output method also inherits two specific features of the HTML output method:

  • Non-ASCII characters in URI-valued attributes are escaped using the %HH convention, unless you suppress this by specifying
    escape-uri-attributes=“no”
    .
  • A

    element is added as the child of the

    element, unless you suppress this using
    include-content-type=“no”
    .

You can control whether an XML declaration is output using the
omit-xml-declaration
attribute. The XHTML 1.0 specification advises against using an XML declaration, but points out that under the XML rules, it may be omitted only if the encoding is UTF-8 or UTF-16.

The Text Output Method

When you specify
method=“text”
, the result tree is output as a plain text file. The values of the text nodes of the tree are copied to the output, and all other nodes are ignored. Within text nodes, all character values are output using the relevant encoding as determined by the
encoding
attribute; there are no special characters such as
&
to be escaped.

The way in which line endings are output (for example LF or CRLF) is not defined; the implementation might choose to use the default line-ending conventions of the platform on which it is running.

The attributes that are relevant to text output are listed below. All other attributes are ignored.

Attribute
Interpretation
encoding
This specifies the preferred character encoding for the output document. The default value is implementation-defined, and may depend on the platform on which it is running.
If the encoding is one that does not allow all XML characters to be represented directly, for example
iso-8859-1
, then any character outside this subset will be reported as an error.
media-type
This parameter defines the media type of the output file (often referred to as its MIME type). The default value is
text/plain
. 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.

Other books

The Pearl of Bengal by Sir Steve Stevenson
Wicked Forest by VC Andrews
The Hidden Prince by Jodi Meadows
Mike's Mystery by Gertrude Warner
Diamond Duo by Marcia Gruver
Snow Blind-J Collins 4 by Lori G. Armstrong
MacGowan's Ghost by Cindy Miles