Another abandoned server code base... this is kind of an ancestor of taskrambler.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

4837 lines
204 KiB

<?xml version="1.0" encoding="utf-8"?>
<!--{xml-fix} XSLT Processor: SAXON 9.3.0.5 from Saxonica SAXON EE 9.3.0.5--><!--This document was created at 20111214 1313-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for Windows (vers 14 February 2006), see www.w3.org" />
<title>XSLT and XQuery Serialization 3.0</title>
<style type="text/css">
/*<![CDATA[*/
code { font-family: monospace; }
div.constraint,
div.issue,
div.note,
div.notice { margin-left: 2em; }
div.issue
p.title { margin-left: -2em; }
ol.enumar { list-style-type: decimal; }
ol.enumla { list-style-type: lower-alpha; }
ol.enumlr { list-style-type: lower-roman; }
ol.enumua { list-style-type: upper-alpha; }
ol.enumur { list-style-type: upper-roman; }
li p { margin-top: 0.3em;
margin-bottom: 0.3em; }
sup small { font-style: italic;
color: #8F8F8F;
}
div.exampleInner pre { margin-left: 1em;
margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
border-bottom-width: 4px;
border-bottom-style: double;
border-bottom-color: #d3d3d3;
padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
margin: 4px}
div.issue { border-bottom-color: black;
border-bottom-style: solid;
border-bottom-width: 1pt;
margin-bottom: 20pt;
}
th.issue-toc-head { border-bottom-color: black;
border-bottom-style: solid;
border-bottom-width: 1pt;
}
dd.indent { margin-left: 2em; }
p.element-syntax { border: solid thin; background-color: #ffccff }
div.proto { border: solid thin; background-color: #ffccff }
div.example { border: solid thin; background-color: blue; padding: 1em }
span.verb { font: small-caps 100% sans-serif }
span.error { font-size: small }
table.small { font-size: x-small; }
a.judgment:visited, a.judgment:link { font-family: sans-serif;
color: black;
text-decoration: none }
a.processing:visited, a.processing:link { color: black;
text-decoration: none }
a.env:visited, a.env:link { color: black;
text-decoration: none }
/*]]>*/
</style>
<link rel="stylesheet" type="text/css" href=
"http://www.w3.org/StyleSheets/TR/W3C-WD.css" />
</head>
<body>
<div class="head">
<p><a href="http://www.w3.org/"><img src=
"http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width=
"72" /></a></p>
<h1><a name="title" id="title"></a>XSLT and XQuery Serialization
3.0</h1>
<h2><a name="w3c-doctype" id="w3c-doctype"></a>W3C Working Draft 13
December 2011</h2>
<dl>
<dt>This version:</dt>
<dd><a href=
"http://www.w3.org/TR/2011/WD-xslt-xquery-serialization-30-20111213/">
http://www.w3.org/TR/2011/WD-xslt-xquery-serialization-30-20111213/</a></dd>
<dt>Latest version:</dt>
<dd><a href=
"http://www.w3.org/TR/xslt-xquery-serialization-30/">http://www.w3.org/TR/xslt-xquery-serialization-30/</a></dd>
<dt>Previous versions:</dt>
<dd><a href=
"http://www.w3.org/TR/2011/WD-xslt-xquery-serialization-30-20110614/">
http://www.w3.org/TR/2011/WD-xslt-xquery-serialization-30-20110614/
,</a> <a href=
"http://www.w3.org/TR/2010/WD-xslt-xquery-serialization-30-20101214/">
http://www.w3.org/TR/2010/WD-xslt-xquery-serialization-30-20101214/
,</a> <a href=
"http://www.w3.org/TR/2009/WD-xslt-xquery-serialization-11-20091215/">
http://www.w3.org/TR/2009/WD-xslt-xquery-serialization-11-20091215/</a></dd>
<dt>Editor:</dt>
<dd>Henry Zongaro, IBM Canada Lab - Toronto Site <a href=
"http://www.ibm.com/software/ca/en/canadalabs/toronto_lab.html">&lt;http://www.ibm.com/software/ca/en/canadalabs/toronto_lab.html&gt;</a></dd>
</dl>
<p>See also <a href=
"http://www.w3.org/2003/03/Translations/byTechnology?technology=xslt-xquery-serialization-30">
<strong>translations</strong></a>.</p>
<p>This document is also available in these non-normative formats:
<a href=
"http://www.w3.org/TR/2011/WD-xslt-xquery-serialization-30-20111213/xslt-xquery-serialization-30.xml">
XML</a> and&#160;<a href=
"http://www.w3.org/TR/2011/WD-xslt-xquery-serialization-30-20111213/xslt-xquery-serialization-30-diff.html">Change
markings relative to previous Working Draft</a>.</p>
<p class="copyright"><a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>&#160;©&#160;2011&#160;<a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
(<a href="http://www.csail.mit.edu/"><acronym title=
"Massachusetts Institute of Technology">MIT</acronym></a>, <a href=
"http://www.ercim.eu/"><acronym title=
"European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
W3C <a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a href=
"http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
</div>
<hr />
<div>
<h2><a name="abstract" id="abstract"></a>Abstract</h2>
<p>This document defines serialization of an instance of the data
model as defined in <a href="#xpath-datamodel-30">[XQuery and XPath
Data Model (XDM) 3.0]</a> into a sequence of octets. Serialization
is designed to be a component that can be used by other
specifications such as <a href="#xslt-30">[XSL Transformations
(XSLT) Version 3.0]</a> or <a href="#xquery-30">[XQuery 3.0: An XML
Query Language]</a>.</p>
</div>
<div>
<h2><a name="status" id="status"></a>Status of this Document</h2>
<p><em>This section describes the status of this document at the
time of its publication. Other documents may supersede this
document. A list of current W3C publications and the latest
revision of this technical report can be found in the <a href=
"http://www.w3.org/TR/">W3C technical reports index</a> at
http://www.w3.org/TR/.</em></p>
<p>This is one document in a set of seven documents that are being
progressed to Recommendation together (XQuery 3.0, XQueryX 3.0,
XSLT 3.0, Data Model 3.0, Functions and Operators 3.0,
Serialization 3.0, XPath 3.0).</p>
<p>This is a <a href=
"http://www.w3.org/2005/10/Process-20051014/tr.html#last-call">Last
Call Working Draft</a> as described in the <a href=
"http://www.w3.org/2005/10/Process-20051014/tr.html">Process
Document</a>. It was jointly developed by the W3C <a href=
"http://www.w3.org/Style/XSL/">XSL Working Group</a> and the W3C
<a href="http://www.w3.org/XML/Query/">XML Query Working Group</a>,
each of which is part of the <a href=
"http://www.w3.org/XML/Activity">XML Activity</a>. Comments on this
document will be formally accepted at least through 10 February
2012. The Working Groups expect to advance this specification to
<a href=
"http://www.w3.org/2005/10/Process-20051014/tr.html#RecsW3C">Recommendation</a>
Status.</p>
<p>This Last Call Working Draft makes a number of substantive
technical changes (as well as many editorial changes), including
new features, adopted since the previous Working Draft was
published. Please note that this Working Draft of XSLT and XQuery
Serialization 3.0 represents the second version of <a href=
"http://www.w3.org/TR/2010/REC-xslt-xquery-serialization-20101214/">
a previous W3C Recommendation</a>.</p>
<p>Reviewers should note that this document does not currently
contain any specification of serialization into HTML5 or the
corresponding XHTML; those document sections are still under
construction and will be added to a revised Last Call WD as soon as
they are available.</p>
<p>This specification is designed to be referenced normatively from
other specifications defining a host language for it; it is not
intended to be implemented outside a host language. The
implementability of this specification has been tested in the
context of its normative inclusion in host languages defined by the
<a href="http://www.w3.org/TR/xquery-30/">XQuery 3.0</a> and XSLT
3.0 (expected in 2012) specifications; see the <a href=
"http://dev.w3.org/2011/xquery-30-test-suite/results/XQTSReport.html">
XQuery 3.0 implementation report</a> (and, in the future, the WGs
expect that there will also be a member-only XSLT 3.0
implementation report) for details.</p>
<p>This document incorporates changes made against the previous
publication of the Working Draft. Changes to this document since
the previous publication of the Working Draft are detailed in
<a href="#revision-log"><b>F Change Log</b></a>.</p>
<p>Please report errors in this document using W3C's <a href=
"http://www.w3.org/Bugs/Public/">public Bugzilla system</a>
(instructions can be found at <a href=
"http://www.w3.org/XML/2005/04/qt-bugzilla">http://www.w3.org/XML/2005/04/qt-bugzilla</a>).
If access to that system is not feasible, you may send your
comments to the W3C XSLT/XPath/XQuery public comments mailing list,
<a href=
"mailto:public-qt-comments@w3.org">public-qt-comments@w3.org</a>.
It will be very helpful if you include the string “[SER30]” in the
subject line of your report, whether made in Bugzilla or in email.
Please use multiple Bugzilla entries (or, if necessary, multiple
email messages) if you have more than one comment to make. Archives
of the comments and responses are available at <a href=
"http://lists.w3.org/Archives/Public/public-qt-comments/">http://lists.w3.org/Archives/Public/public-qt-comments/</a>.</p>
<p>Publication as a Working Draft does not imply endorsement by the
W3C Membership. This is a draft document and may be updated,
replaced or obsoleted by other documents at any time. It is
inappropriate to cite this document as other than work in
progress.</p>
<p>This document was produced by groups operating under the
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
February 2004 W3C Patent Policy</a>. W3C maintains a <a href=
"http://www.w3.org/2004/01/pp-impl/18797/status#disclosures">public
list of any patent disclosures</a> made in connection with the
deliverables of the XML Query Working Group and also maintains a
<a href=
"http://www.w3.org/2004/01/pp-impl/19552/status#disclosures">public
list of any patent disclosures</a> made in connection with the
deliverables of the XSL Working Group; those pages also include
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains
<a href=
"http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">
Essential Claim(s)</a> must disclose the information in accordance
with <a href=
"http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">
section 6 of the W3C Patent Policy</a>.</p>
</div>
<div class="toc">
<h2><a name="contents" id="contents"></a>Table of Contents</h2>
<p class="toc">1 <a href="#intro">Introduction</a><br />
&#160;&#160;&#160;&#160;1.1 <a href=
"#terminology">Terminology</a><br />
2 <a href="#serdm">Sequence Normalization</a><br />
3 <a href="#serparam">Serialization Parameters</a><br />
&#160;&#160;&#160;&#160;3.1 <a href=
"#serparams-in-xdm-instance">Setting Serialization Parameters by
Means of a Data Model Instance</a><br />
4 <a href="#serphases">Phases of Serialization</a><br />
5 <a href="#xml-output">XML Output Method</a><br />
&#160;&#160;&#160;&#160;5.1 <a href="#XML_PARAMS">The Influence of
Serialization Parameters upon the XML Output Method</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.1 <a href=
"#XML_VERSION">XML Output Method: the version Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.2 <a href=
"#XML_ENCODING">XML Output Method: the encoding Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.3 <a href=
"#xml-indent">XML Output Method: the indent and
suppress-indentation Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.4 <a href=
"#XML_CDATA-SECTION-ELEMENTS">XML Output Method: the
cdata-section-elements Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.5 <a href=
"#XML_OMIT-XML-DECLARATION">XML Output Method: the
omit-xml-declaration and standalone Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.6 <a href=
"#XML_DOCTYPE">XML Output Method: the doctype-system and
doctype-public Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.7 <a href=
"#xml-undeclare-NS">XML Output Method: the undeclare-prefixes
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.8 <a href=
"#XML_NORMALIZATION-FORM">XML Output Method: the normalization-form
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.9 <a href=
"#XML_MEDIA-TYPE">XML Output Method: the media-type
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.10 <a href=
"#XML_USE-CHARACTER-MAPS">XML Output Method: the use-character-maps
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.11 <a href=
"#XML_BYTE-ORDER-MARK">XML Output Method: the byte-order-mark
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.12 <a href=
"#XML_ESCAPE-URI-ATTRIBUTES">XML Output Method: the
escape-uri-attributes Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.1.13 <a href=
"#XML_INCLUDE-CONTENT-TYPE">XML Output Method: the
include-content-type Parameter</a><br />
6 <a href="#xhtml-output">XHTML Output Method</a><br />
&#160;&#160;&#160;&#160;6.1 <a href="#XHTML_PARAMS">The Influence
of Serialization Parameters upon the XHTML Output Method</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.1 <a href=
"#XHTML_VERSION">XHTML Output Method: the version
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.2 <a href=
"#XHTML_ENCODING">XHTML Output Method: the encoding
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.3 <a href=
"#XHTML_INDENT">XHTML Output Method: the indent and
suppress-indentation Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.4 <a href=
"#XHTML_CDATA-SECTION-ELEMENTS">XHTML Output Method: the
cdata-section-elements Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.5 <a href=
"#XHTML_OMIT-XML-DECLARATION">XHTML Output Method: the
omit-xml-declaration and standalone Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.6 <a href=
"#XHTML_DOCTYPE">XHTML Output Method: the doctype-system and
doctype-public Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.7 <a href=
"#XHTML_UNDECLARE-PREFIXES">XHTML Output Method: the
undeclare-prefixes Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.8 <a href=
"#XHTML_NORMALIZATION-FORM">XHTML Output Method: the
normalization-form Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.9 <a href=
"#XHTML_MEDIA-TYPE">XHTML Output Method: the media-type
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.10 <a href=
"#XHTML_USE-CHARACTER-MAPS">XHTML Output Method: the
use-character-maps Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.11 <a href=
"#XHTML_BYTE-ORDER-MARK">XHTML Output Method: the byte-order-mark
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.12 <a href=
"#XHTML_ESCAPE-URI-ATTRIBUTES">XHTML Output Method: the
escape-uri-attributes Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6.1.13 <a href=
"#XHTML_INCLUDE-CONTENT-TYPE">XHTML Output Method: the
include-content-type Parameter</a><br />
7 <a href="#html-output">HTML Output Method</a><br />
&#160;&#160;&#160;&#160;7.1 <a href="#HTML_MARKUP">Markup for
Elements</a><br />
&#160;&#160;&#160;&#160;7.2 <a href="#HTML_ATTRIBS">Writing
Attributes</a><br />
&#160;&#160;&#160;&#160;7.3 <a href="#HTML_CHARDATA">Writing
Character Data</a><br />
&#160;&#160;&#160;&#160;7.4 <a href="#HTML_PARAMS">The Influence of
Serialization Parameters upon the HTML Output Method</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.1 <a href=
"#HTML_VERSION">HTML Output Method: the version Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.2 <a href=
"#HTML_ENCODING">HTML Output Method: the encoding
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.3 <a href=
"#HTML_INDENT">HTML Output Method: the indent and
suppress-indentation Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.4 <a href=
"#HTML_CDATA-SECTION-ELEMENTS">HTML Output Method: the
cdata-section-elements Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.5 <a href=
"#HTML_OMIT-XML-DECLARATION">HTML Output Method: the
omit-xml-declaration and standalone Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.6 <a href=
"#HTML_DOCTYPE">HTML Output Method: the doctype-system and
doctype-public Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.7 <a href=
"#HTML_UNDECLARE-PREFIXES">HTML Output Method: the
undeclare-prefixes Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.8 <a href=
"#HTML_NORMALIZATION-FORM">HTML Output Method: the
normalization-form Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.9 <a href=
"#HTML_MEDIA-TYPE">HTML Output Method: the media-type
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.10 <a href=
"#HTML_USE-CHARACTER-MAPS">HTML Output Method: the
use-character-maps Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.11 <a href=
"#HTML_BYTE-ORDER-MARK">HTML Output Method: the byte-order-mark
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.12 <a href=
"#HTML_ESCAPE-URI-ATTRIBUTES">HTML Output Method: the
escape-uri-attributes Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.4.13 <a href=
"#HTML_INCLUDE-CONTENT-TYPE">HTML Output Method: the
include-content-type Parameter</a><br />
8 <a href="#text-output">Text Output Method</a><br />
&#160;&#160;&#160;&#160;8.1 <a href="#TEXT_PARAMS">The Influence of
Serialization Parameters upon the Text Output Method</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.1 <a href=
"#TEXT_VERSION">Text Output Method: the version Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.2 <a href=
"#TEXT_ENCODING">Text Output Method: the encoding
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.3 <a href=
"#TEXT_INDENT">Text Output Method: the indent and
suppress-indentation Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.4 <a href=
"#TEXT_CDATA-SECTION-ELEMENTS">Text Output Method: the
cdata-section-elements Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.5 <a href=
"#TEXT_OMIT-XML-DECLARATION">Text Output Method: the
omit-xml-declaration and standalone Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.6 <a href=
"#TEXT_DOCTYPE">Text Output Method: the doctype-system and
doctype-public Parameters</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.7 <a href=
"#TEXT_UNDECLARE-PREFIXES">Text Output Method: the
undeclare-prefixes Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.8 <a href=
"#TEXT_NORMALIZATION-FORM">Text Output Method: the
normalization-form Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.9 <a href=
"#TEXT_MEDIA-TYPE">Text Output Method: the media-type
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.10 <a href=
"#TEXT_USE-CHARACTER-MAPS">Text Output Method: the
use-character-maps Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.11 <a href=
"#TEXT_BYTE-ORDER-MARK">Text Output Method: the byte-order-mark
Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.12 <a href=
"#TEXT_ESCAPE-URI-ATTRIBUTES">Text Output Method: the
escape-uri-attributes Parameter</a><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.13 <a href=
"#TEXT_INCLUDE-CONTENT-TYPE">Text Output Method: the
include-content-type Parameter</a><br />
9 <a href="#character-maps">Character Maps</a><br />
10 <a href="#conformance">Conformance</a><br /></p>
<h3><a name="appendices" id="appendices"></a>Appendices</h3>
<p class="toc">A <a href="#references">References</a><br />
&#160;&#160;&#160;&#160;A.1 <a href=
"#normative-references">Normative References</a><br />
&#160;&#160;&#160;&#160;A.2 <a href=
"#informative-references">Informative References</a><br />
B <a href="#serparams-schema">Schema for Serialization
Parameters</a><br />
C <a href="#id-errors">Summary of Error Conditions</a><br />
D <a href="#list-of-uri-attributes">List of URI
Attributes</a><br />
E <a href="#implementation-defined-features">Checklist of
Implementation-Defined Features</a> (Non-Normative)<br />
F <a href="#revision-log">Change Log</a> (Non-Normative)<br />
&#160;&#160;&#160;&#160;F.1 <a href="#changes-for-this-WD">Changes
applied for the current Public Working Draft</a><br />
&#160;&#160;&#160;&#160;F.2 <a href="#changes-for-3rd-WD">Changes
applied for the third Public Working Draft</a><br />
&#160;&#160;&#160;&#160;F.3 <a href="#changes-for-2nd-WD">Changes
applied for the second Public Working Draft</a><br />
&#160;&#160;&#160;&#160;F.4 <a href="#changes-for-1st-WD">Changes
applied for the first Public Working Draft</a><br /></p>
</div>
<hr />
<div class="body">
<div class="div1">
<h2><a name="intro" id="intro"></a>1 Introduction</h2>
<p>This document defines serialization of the W3C XQuery and XPath
Data Model <span>3.0</span> (XDM), which is the data model of at
least <a href="#xpath-30">[XML Path Language (XPath) 3.0]</a>,
<a href="#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a>,
and <a href="#xquery-30">[XQuery 3.0: An XML Query Language]</a>,
and any other specifications that reference it.</p>
<p>In this document, examples and material labeled as "Note" are
provided for explanatory purposes and are not normative.</p>
<p>Serialization is the process of converting an instance of the
<a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM)
3.0]</a> into a sequence of octets. Serialization is well-defined
for most data model instances.</p>
<div class="div2">
<h3><a name="terminology" id="terminology"></a>1.1 Terminology</h3>
<p>In this specification, where they appear in upper case, the
words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", "MAY",
"REQUIRED", and "RECOMMENDED" are to be interpreted as described in
<a href="#RFC2119">[RFC2119]</a>.</p>
<p>[<a name="serializer" id="serializer" title=
"serializer">Definition</a>: As is indicated in <a href=
"#conformance"><b>10 Conformance</b></a>, conformance criteria for
serialization are determined by other specifications that refer to
this specification. A <b>serializer</b> is software that implements
some or all of the requirements of this specification in accordance
with such conformance criteria.] A serializer is not
<strong>REQUIRED</strong> to directly provide a programming
interface that permits a user to set serialization parameters or to
provide an input sequence for serialization. <span>In this
document, material labeled as "Note" and examples are provided for
explanatory purposes and are not normative.</span></p>
<p>Certain aspects of serialization are described in this
specification as <a title="implementation-defined" href=
"#impdef">implementation-defined</a> or <a title=
"implementation-dependent" href=
"#impdep">implementation-dependent</a>.</p>
<p>[<a name="impdef" id="impdef" title=
"implementation-defined">Definition</a>:
<b>Implementation-defined</b> indicates an aspect that
<strong>MAY</strong> differ between <a title="serializer" href=
"#serializer">serializers</a>, but whose actual behavior
<strong>MUST</strong> be specified either by another specification
that sets conformance criteria for serialization (see <a href=
"#conformance"><b>10 Conformance</b></a>) or in documentation that
accompanies the <a title="serializer" href=
"#serializer">serializer</a>.]</p>
<p>[<a name="impdep" id="impdep" title=
"implementation-dependent">Definition</a>:
<b>Implementation-dependent</b> indicates an aspect that
<strong>MAY</strong> differ between <a title="serializer" href=
"#serializer">serializers</a>, and whose actual behavior is not
<strong>REQUIRED</strong> to be specified either by another
specification that sets conformance criteria for serialization (see
<a href="#conformance"><b>10 Conformance</b></a>) or in
documentation that accompanies the <a title="serializer" href=
"#serializer">serializer</a>.]</p>
<p>[<a name="serial-err" id="serial-err" title=
"serialization error">Definition</a>: In some instances, the
sequence that is input to serialization cannot be successfully
converted into a sequence of octets given the set of serialization
parameter (<a href="#serparam"><b>3 Serialization
Parameters</b></a>) values specified. A <b>serialization error</b>
is said to occur in such an instance.] In some cases, a <a title=
"serializer" href="#serializer">serializer</a> is
<strong>REQUIRED</strong> to signal such an error. What it means to
signal a serialization error is determined by the relevant
conformance criteria (<a href="#conformance"><b>10
Conformance</b></a>) to which the <a title="serializer" href=
"#serializer">serializer</a> conforms. In other cases, there is an
<a title="implementation-defined" href=
"#impdef">implementation-defined</a> choice between signaling a
serialization error and performing a recovery action. Such a
recovery action will allow a <a title="serializer" href=
"#serializer">serializer</a> to produce a sequence of octets that
might not fully reflect the usual requirements of the parameter
settings that are in effect.</p>
<p>[<a name="caseless-compare" id="caseless-compare" title=
"without regard to case">Definition</a>: Where this specification
indicates that two strings are to be compared <b>without regard to
case</b>, the serializer <strong>MUST</strong> translate any
characters in the range #x41 (LATIN CAPITAL LETTER A) to #x5A
(LATIN CAPITAL LETTER Z), inclusive, to the corresponding
lower-case letters in the range #x61 (LATIN SMALL LETTER A) to #x7A
(LATIN SMALL LETTER Z) only for the purposes of making the
comparison. The comparison succeeds if the two strings are the same
length and the code point of each character in the first string is
equal to the code point of the character in the corresponding
position in the second string.]</p>
<p>Many terms used in this document are defined in the XPath
specification <a href="#xpath-30">[XML Path Language (XPath)
3.0]</a> or the Data Model specification <a href=
"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
Particular attention is drawn to the following:</p>
<ul>
<li>
<p>[<a name="dt-atomization" id="dt-atomization" title=
"atomize">Definition</a>: The term <b>atomization</b> is defined in
<a href="http://www.w3.org/TR/xpath-30/#id-atomization">Section
2.4.2 Atomization</a> <sup><small>XP30</small></sup>. It is a
process that takes as input a sequence of <a title="node" href=
"#dt-node">nodes</a> and <a href=
"http://www.w3.org/TR/xpath-30/#dt-atomic-value">atomic
values</a><sup><small>XP30</small></sup>, and returns a sequence of
<a href="http://www.w3.org/TR/xpath-30/#dt-atomic-value">atomic
values</a><sup><small>XP30</small></sup>, in which the <a title=
"node" href="#dt-node">nodes</a> are replaced by their <a href=
"http://www.w3.org/TR/xpath-30/#dt-typed-value">typed
values</a><sup><small>XP30</small></sup> as defined in <a href=
"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM)
3.0]</a>.]</p>
</li>
<li>
<p>[<a name="dt-node" id="dt-node" title="node">Definition</a>: The
term <b>Node</b> is defined as part of <a href=
"http://www.w3.org/TR/xpath-datamodel-30/#Node">Section 6 Nodes</a>
<sup><small>DM30</small></sup>. There are seven kinds of <a title=
"node" href="#dt-node">nodes</a> in the data model: document,
element, attribute, text, namespace, processing instruction, and
comment.]</p>
</li>
<li>
<p>[<a name="dt-sequence" id="dt-sequence" title=
"sequence">Definition</a>: The term <b>sequence</b> is defined in
<a href="http://www.w3.org/TR/xpath-30/#id-basics">Section 2
Basics</a> <sup><small>XP30</small></sup>. A <a title="sequence"
href="#dt-sequence">sequence</a> is an ordered collection of zero
or more items.]</p>
</li>
<li>
<p>[<a name="dt-function-item" id="dt-function-item" title=
"function item">Definition</a>: The term <b>function item</b> is
defined in <a href=
"http://www.w3.org/TR/xpath-datamodel-30/#function-items">Section
2.8.1 Functions</a> <sup><small>DM30</small></sup>.]</p>
</li>
<li>
<p>[<a name="dt-string-value" id="dt-string-value" title=
"string value">Definition</a>: The term <b>string value</b> is
defined in <a href=
"http://www.w3.org/TR/xpath-datamodel-30/#dm-string-value">Section
5.13 string-value Accessor</a> <sup><small>DM30</small></sup>.
Every <a title="node" href="#dt-node">node</a> has a <a title=
"string value" href="#dt-string-value">string value</a>. For
example, the <a title="string value" href="#dt-string-value">string
value</a> of an element is the concatenation of the <a title=
"string value" href="#dt-string-value">string values</a> of all its
descendant text <a title="node" href="#dt-node">nodes</a>.]</p>
</li>
<li>
<p>[<a name="dt-expanded-qname" id="dt-expanded-qname" title=
"expanded QName">Definition</a>: The term <b>expanded QName</b> is
defined in <a href=
"http://www.w3.org/TR/xpath-30/#id-basics">Section 2 Basics</a>
<sup><small>XP30</small></sup>. An <a title="expanded QName" href=
"#dt-expanded-qname">expanded QName</a> consists of an optional
namespace URI and a local name. An <a title="expanded QName" href=
"#dt-expanded-qname">expanded QName</a> also retains its original
namespace prefix (if any), to facilitate casting the expanded QName
into a string.]</p>
</li>
<li>
<p>[<a name="null-namespace-URI" id="null-namespace-URI" title=
"null namespace URI">Definition</a>: An element or attribute that
is in no namespace, or an <a title="expanded QName" href=
"#dt-expanded-qname">expanded-QName</a> whose namespace part is an
empty sequence, is referred to as having a <b>null namespace
URI</b>].</p>
</li>
<li>
<p>[<a name="non-null-namespace-URI" id="non-null-namespace-URI"
title="non-null namespace URI">Definition</a>: An element or
attribute that does not have a <a title="null namespace URI" href=
"#null-namespace-URI">null namespace URI</a>, is referred to as
having a <b>non-null namespace URI</b>].</p>
</li>
</ul>
</div>
</div>
<div class="div1">
<h2><a name="serdm" id="serdm"></a>2 Sequence Normalization</h2>
<p>An instance of the data model that is input to the serialization
process is a sequence. Prior to serializing a sequence using any of
the output methods whose behavior is specified by this document
(<a href="#serparam"><b>3 Serialization Parameters</b></a>), the
<a title="serializer" href="#serializer">serializer</a>
<strong>MUST</strong> first compute a normalized sequence for
serialization; it is the normalized sequence that is actually
serialized. [<a name="sequence-normalization" id=
"sequence-normalization" title=
"sequence normalization">Definition</a>: The purpose of <b>sequence
normalization</b> is to create a sequence that can be serialized as
a well-formed XML document or external general parsed entity, that
also reflects the content of the input sequence to the extent
possible.] [<a name="result-tree" id="result-tree" title=
"result tree">Definition</a>: The result of the <a title=
"sequence normalization" href="#sequence-normalization">sequence
normalization</a> process is a <b>result tree</b>.]</p>
<p>The normalized sequence for serialization is constructed by
applying all of the following rules in order, with the initial
sequence being input to the first step, and the sequence that
results from any step being used as input to the subsequent step.
For any <a title="implementation-defined" href=
"#impdef">implementation-defined</a> output method, it is <a title=
"implementation-defined" href="#impdef">implementation-defined</a>
whether this sequence normalization process takes place.</p>
<p>Where the process of converting the input sequence to a
normalized sequence indicates that a value <strong>MUST</strong> be
cast to <code>xs:string</code>, that operation is defined in
<a href=
"http://www.w3.org/TR/xpath-functions-30/#casting-to-string">Section
18.1.1 Casting to xs:string and xs:untypedAtomic</a>
<sup><small>FO30</small></sup> of <a href=
"#xpath-functions-30">[XQuery and XPath Functions and Operators
3.0]</a>. <span>Where a step in the sequence normalization process
indicates that a node should be copied, the copy is performed in
the same way as an XSLT <code>xsl:copy-of</code> instruction that
has a <code>validation</code> attribute whose value is
<code>preserve</code> and has a <code>select</code> attribute whose
effective value is the node, as described in <a href=
"http://www.w3.org/TR/xslt-30/#copy-of">Section 11.9.2 Deep
Copy</a><sup><small>XT30</small></sup> of <a href="#xslt-30">[XSL
Transformations (XSLT) Version 3.0]</a>, or equivalently in the
same way as an XQuery content expression as described in Step 1e of
<a href="http://www.w3.org/TR/xquery-30/#id-content">Section
3.9.1.3 Content</a> <sup><small>XQ30</small></sup> of <a href=
"#xquery-30">[XQuery 3.0: An XML Query Language]</a>, where the
construction mode is <code>preserve</code>.</span> The steps in
computing the normalized sequence are:</p>
<ol class="enumar">
<li>
<p>If the sequence that is input to serialization is empty, create
a sequence <em>S<sub>1</sub></em> that consists of a zero-length
string. Otherwise, copy each item in the sequence that is input to
serialization to create the new sequence
<em>S<sub>1</sub></em>.</p>
</li>
<li>
<p>For each item in <em>S<sub>1</sub></em>, if the item is atomic,
obtain the lexical representation of the item by casting it to an
<code>xs:string</code> and copy the string representation to the
new sequence; otherwise, copy the item, which will be a <a title=
"node" href="#dt-node">node</a>, to the new sequence. The new
sequence is <em>S<sub>2</sub></em>.</p>
</li>
<li>
<p>For each subsequence of adjacent strings in
<em>S<sub>2</sub></em>, copy a single string to the new sequence
equal to the values of the strings in the subsequence concatenated
in order, each separated by a single space. Copy all other items to
the new sequence. The new sequence is <em>S<sub>3</sub></em>.</p>
</li>
<li>
<p>For each item in <em>S<sub>3</sub></em>, if the item is a
string, create a text <a title="node" href="#dt-node">node</a> in
the new sequence whose <a title="string value" href=
"#dt-string-value">string value</a> is equal to the string;
otherwise, copy the item to the new sequence. The new sequence is
<em>S<sub>4</sub></em>.</p>
</li>
<li>
<p>For each item in <em>S<sub>4</sub></em>, if the item is a
document <a title="node" href="#dt-node">node</a>, copy its
children to the new sequence; otherwise, copy the item to the new
sequence. The new sequence is <em>S<sub>5</sub></em>.</p>
</li>
<li>
<p>For each subsequence of adjacent text nodes in
<em>S<sub>5</sub></em>, copy a single text node to the new sequence
equal to the values of the text nodes in the subsequence
concatenated in order. Any text nodes with values of zero length
are dropped. Copy all other items to the new sequence. The new
sequence is <em>S<sub>6</sub></em>.</p>
</li>
<li>
<p>It is a <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSENR0001"
title="err:SENR0001">err:SENR0001</a>] if an item in
<em>S<sub>6</sub></em> is an attribute <a title="node" href=
"#dt-node">node</a>, a namespace <a title="node" href=
"#dt-node">node</a> <span>or a <a title="function item" href=
"#dt-function-item">function item</a>.</span> Otherwise, construct
a new sequence, <em>S<sub>7</sub></em>, that consists of a single
document <a title="node" href="#dt-node">node</a> and copy all the
items in the sequence, which are all <a title="node" href=
"#dt-node">nodes</a>, as children of that document <a title="node"
href="#dt-node">node</a>.</p>
</li>
</ol>
<p><em>S<sub>7</sub></em> is the normalized sequence.</p>
<p>The <a title="result tree" href="#result-tree">result tree</a>
rooted at the document <a title="node" href="#dt-node">node</a>
that is created by the final step of this sequence normalization
process is the instance of the data model to which the rules of the
appropriate output method are applied. If the sequence
normalization process results in a <a title="serialization error"
href="#serial-err">serialization error</a>, the <a title=
"serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal the error.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>The sequence normalization process for a sequence
<code>$seq</code> is equivalent to constructing a document
<a title="node" href="#dt-node">node</a> using the XSLT
instruction:</p>
<div class="exampleInner">
<pre>
&lt;xsl:document&gt;
&lt;xsl:copy-of select="$seq" validation="preserve"/&gt;
&lt;/xsl:document&gt;
</pre></div>
<p>or the XQuery expression:</p>
<div class="exampleInner">
<pre>
declare construction preserve;
document {
for $s in $seq return
if ($s instance of document-node())
then $s/child::node()
else $s
}
</pre></div>
<p>This process results in a <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSENR0001"
title="err:SENR0001">err:SENR0001</a>] if sequences contain
parentless attribute and/or namespace <a title="node" href=
"#dt-node">nodes</a>.</p>
</div>
</div>
<div class="div1">
<h2><a name="serparam" id="serparam"></a>3 Serialization
Parameters</h2>
<p>There are a number of parameters that influence how
serialization is performed. <a title="host language" href=
"#host-language">Host languages</a> <strong>MAY</strong> allow
users to specify any or all of these parameters, but they are not
<strong>REQUIRED</strong> to be able to do so. However, the
<a title="host language" href="#host-language">host language</a>
specification <strong>MUST</strong> specify how the value of all
applicable parameters is to be determined.</p>
<p>It is a <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSEPM0016"
title="err:SEPM0016">err:SEPM0016</a>] if a parameter value is
invalid for the given parameter. It is the responsibility of the
<a title="host language" href="#host-language">host language</a> to
specify how invalid values should be handled at the level of that
language.</p>
<p>The following serialization parameters are defined:</p>
<table border="1" summary="Serialization parameters">
<col width="180" span="1" />
<col span="1" />
<thead>
<tr>
<th align="left" colspan="1">Serialization parameter name</th>
<th align="left" colspan="1">Permitted values for parameter</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>byte-order-mark</code></td>
<td>One of the enumerated values <code>yes</code> or
<code>no</code>. This parameter indicates whether the serialized
sequence of octets is to be preceded by a Byte Order Mark. (See
Section 5.1 of <a href="#UNICODE-ENCODING">[Unicode Encoding]</a>.)
The actual octet order used is <a title="implementation-dependent"
href="#impdep">implementation-dependent</a>. If the encoding
defines no Byte Order Mark, or if the Byte Order Mark is prohibited
for the specific Unicode encoding or implementation environment,
then this parameter is ignored.</td>
</tr>
<tr>
<td><code>cdata-section-elements</code></td>
<td>A list of expanded QNames, possibly empty.</td>
</tr>
<tr>
<td><code>doctype-public</code></td>
<td><span>A string of <a href=
"http://www.w3.org/TR/REC-xml/#NT-PubidChar">PubidChar</a><sup><small>XML</small></sup>
characters.</span> <span>This parameter may be absent.</span></td>
</tr>
<tr>
<td><code>doctype-system</code></td>
<td><span>A string of Unicode characters</span> <span>that does not
include both an apostrophe (#x27) and a quotation mark (#x22)
character.</span> <span>This parameter may be absent.</span></td>
</tr>
<tr>
<td><code>encoding</code></td>
<td>A string of Unicode characters in the range #x21 to #x7E (that
is, printable ASCII characters); the value <strong>SHOULD</strong>
be a charset registered with the Internet Assigned Numbers
Authority <a href="#IANA">[IANA]</a>, <a href=
"#RFC2278">[RFC2278]</a> or begin with the characters
<code>x-</code> or <code>X-</code>.</td>
</tr>
<tr>
<td><code>escape-uri-attributes</code></td>
<td>One of the enumerated values <code>yes</code> or
<code>no</code>.</td>
</tr>
<tr>
<td><code>include-content-type</code></td>
<td>One of the enumerated values <code>yes</code> or
<code>no</code>.</td>
</tr>
<tr>
<td><code>indent</code></td>
<td>One of the enumerated values <code>yes</code> or
<code>no</code>.</td>
</tr>
<tr>
<td><code>media-type</code></td>
<td>A string of Unicode characters specifying the media type (MIME
content type) <a href="#RFC2046">[RFC2046]</a>; the charset
parameter of the media type <strong>MUST NOT</strong> be specified
explicitly in the value of the <code>media-type</code> parameter.
If the destination of the serialized output is annotated with a
media type, this parameter <strong>MAY</strong> be used to provide
such an annotation. For example, it <strong>MAY</strong> be used to
set the media type in an HTTP header.</td>
</tr>
<tr>
<td><code>method</code></td>
<td>An expanded QName with a <a title="null namespace URI" href=
"#null-namespace-URI">null namespace URI</a>, and the local part of
the name equal to one of <code>xml</code>, <code>xhtml</code>,
<code>html</code> or <code>text</code>, or having a <a title=
"non-null namespace URI" href="#non-null-namespace-URI">non-null
namespace URI</a>. If the namespace URI is non-null, the parameter
specifies an <a title="implementation-defined" href=
"#impdef">implementation-defined</a> output method.</td>
</tr>
<tr>
<td><code>normalization-form</code></td>
<td>One of the enumerated values <code>NFC</code>,
<code>NFD</code>, <code>NFKC</code>, <code>NFKD</code>,
<code>fully-normalized</code>, <code>none</code> or an <a title=
"implementation-defined" href="#impdef">implementation-defined</a>
value.</td>
</tr>
<tr>
<td><code>omit-xml-declaration</code></td>
<td>One of the enumerated values <code>yes</code> or
<code>no</code>.</td>
</tr>
<tr>
<td><code>standalone</code></td>
<td>One of the enumerated values <code>yes</code>, <code>no</code>
or <code>omit</code>.</td>
</tr>
<tr>
<td><code>suppress-indentation</code></td>
<td><span>A list of expanded QNames, possibly empty.</span></td>
</tr>
<tr>
<td><code>undeclare-prefixes</code></td>
<td>One of the enumerated values <code>yes</code> or
<code>no</code>.</td>
</tr>
<tr>
<td><code>use-character-maps</code></td>
<td>A list of pairs, possibly empty, with each pair consisting of a
single Unicode character and a string of Unicode characters.</td>
</tr>
<tr>
<td><code>version</code></td>
<td>A string of Unicode characters.</td>
</tr>
</tbody>
</table>
<p>The value of the <code>method</code> parameter is an <a title=
"expanded QName" href="#dt-expanded-qname">expanded QName</a>. If
the value has a <a title="null namespace URI" href=
"#null-namespace-URI">null namespace URI</a>, then the local name
identifies a method specified in this document and
<strong>MUST</strong> be one of <code>xml</code>,
<code>html</code>, <code>xhtml</code>, or <code>text</code>; in
this case, the output method specified <strong>MUST</strong> be
used for serializing. If the namespace URI is non-null, then it
identifies an <a title="implementation-defined" href=
"#impdef">implementation-defined</a> output method; the behavior in
this case is not specified by this document.</p>
<p>In those cases where they have no important effect on the
content of the serialized result, details of the output methods
defined by this specification are left unspecified and are regarded
as <a title="implementation-dependent" href=
"#impdep">implementation-dependent</a>. Whether a <a title=
"serializer" href="#serializer">serializer</a> uses apostrophes or
quotation marks to delimit attribute values in the XML output
method is an example of such a detail.</p>
<p>The detailed semantics of each parameter will be described
separately for each output method <span>for which it is
applicable</span>. <span>If the semantics of a parameter are not
described for an output method, then it is not applicable to that
output method.</span></p>
<p>Implementations <strong>MAY</strong> define additional
serialization parameters, and <strong>MAY</strong> allow users to
do so. For this purpose, the name of a serialization parameter is
considered to be a QName; the parameters listed above are QNames in
no namespace, while any additional serialization parameters must
have names that are namespace-qualified. If the serialization
method is one of the four methods <code>xml</code>,
<code>html</code>, <code>xhtml</code>, or <code>text</code>, then
the additional serialization parameters <strong>MAY</strong> affect
the output of the serializer to the extent (but only to the extent)
that this specification leaves the output <a title=
"implementation-defined" href="#impdef">implementation-defined</a>
or <a title="implementation-dependent" href=
"#impdep">implementation-dependent</a>. For example, such
parameters might control whether namespace declarations on an
element are written before or after the attributes of the element,
or they might define the number of space or tab characters to be
inserted when the <code>indent</code> parameter is set to
<code>yes</code>; but they could not instruct the serializer to
suppress the error that occurs when the HTML output method
encounters characters <span>that are not permitted</span> (see
error [<a href="#ERRSERE0014" title=
"err:SERE0014">err:SERE0014</a>]).</p>
<div class="div2">
<h3><a name="serparams-in-xdm-instance" id=
"serparams-in-xdm-instance"></a>3.1 Setting Serialization
Parameters by Means of a Data Model Instance</h3>
<p>A host language <strong>MAY</strong> provide, by reference to
this section, a mechanism by which the settings of serialization
parameters are supplied in the form of an instance of the data
model as specified in <a href="#xpath-datamodel-30">[XQuery and
XPath Data Model (XDM) 3.0]</a>. The instance of the data model
used to determine the settings of serialization parameters
<strong>MUST</strong> be processed as if by the procedure described
below.</p>
<p>With the exception of the <code>use-character-maps</code>
parameter, the setting of each serialization parameter is equal to
the result of evaluating the XQuery expression</p>
<div class="exampleInner">
<pre>
(validate lax { document { . } })
/output:serialization-parameters
/output:*[local-name() eq $param-name]/data(@value)
</pre></div>
<p>with the supplied instance of the data model as the context
item, the <code>param-name</code> variable having as its value a
value of type <code>xs:string</code> equal to the local part of the
name of the particular serialization parameter, and the other
components of the dynamic context and static context as specified
in the subsequent tables. If in any case evaluating this expression
would yield an error, <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSEPM0017"
title="err:SEPM0017">err:SEPM0017</a>] results.</p>
<p>If the result of evaluating this expression for a particular
serialization parameter is the empty sequence:</p>
<ol class="enumar">
<li>
<p>if the parameter is either <code>cdata-section-elements</code>
or <code>supress-indentation</code> and the result of evaluating
the expression</p>
<div class="exampleInner">
<pre>
(validate lax { document { . } })
/output:serialization-parameters
/output:*[local-name() eq $param-name]
</pre></div>
<p>with the same settings of the static context and dynamic context
is not an empty sequence, the setting of the parameter is the empty
list;</p>
</li>
<li>
<p>otherwise, the setting of the parameter is unspecified.</p>
</li>
</ol>
<p>The components of the static context used in evaluating the
XQuery expressions are as defined in the following table.</p>
<table border="1" summary=
"Settings of static context components used in extracting serialization parameter settings from an XDM instance">
<thead>
<tr>
<th colspan="1">Static Context Component</th>
<th colspan="1">Setting</th>
</tr>
</thead>
<tbody>
<tr>
<td>XPath compatibility mode</td>
<td>false</td>
</tr>
<tr>
<td>Statically known namespaces</td>
<td>The pair
(output,http://www.w3.org/2010/xslt-xquery-serialization)</td>
</tr>
<tr>
<td>Default element/type namespace</td>
<td>"none"</td>
</tr>
<tr>
<td>Default function namespace</td>
<td>http://www.w3.org/2005/xpath-functions</td>
</tr>
<tr>
<td>In-scope schema types, In-scope element declarations,
Substitution groups, In-scope attribute declarations</td>
<td>As defined by the schema for serialization parameters (<a href=
"#serparams-schema"><b>B Schema for Serialization
Parameters</b></a>) and any additional implementation-defined
in-scope schema components</td>
</tr>
<tr>
<td>In-scope variables</td>
<td>{param-name}</td>
</tr>
<tr>
<td>Context item static type</td>
<td><code>node()</code></td>
</tr>
<tr>
<td>Function signatures</td>
<td>{<code>fn:data($arg as item()*) as
xs:anyAtomicType*</code>}</td>
</tr>
<tr>
<td>Statically known collations</td>
<td>{ (http://www.w3.org/2005/xpath-functions/collation/codepoint,
The Unicode codepoint collation ) }</td>
</tr>
<tr>
<td>Default collation</td>
<td>The Unicode codepoint collation</td>
</tr>
<tr>
<td>Construction mode</td>
<td>strip</td>
</tr>
<tr>
<td>Ordering mode</td>
<td>ordered</td>
</tr>
<tr>
<td>Default order for empty sequences</td>
<td>least</td>
</tr>
<tr>
<td>Boundary space policy</td>
<td>strip</td>
</tr>
<tr>
<td>Copy-namespaces mode</td>
<td>(preserve,inherit)</td>
</tr>
<tr>
<td>Base URI</td>
<td>Absent</td>
</tr>
<tr>
<td>Statically known documents</td>
<td>None</td>
</tr>
<tr>
<td>Statically known collections</td>
<td>None</td>
</tr>
<tr>
<td>Statically known default collection type</td>
<td><code>node()*</code></td>
</tr>
<tr>
<td>Statically known decimal formats</td>
<td>None</td>
</tr>
</tbody>
</table>
<p>The remaining components of the dynamic context used in
evaluating the XQuery expressions in the preceding table are as
defined in the following table.</p>
<table border="1" summary=
"Settings of dynamic context components used in extracting serialization parameter settings from an XDM instance">
<thead>
<tr>
<th colspan="1">Dynamic Context Component</th>
<th colspan="1">Setting</th>
</tr>
</thead>
<tbody>
<tr>
<td>Context position</td>
<td>1</td>
</tr>
<tr>
<td>Context size</td>
<td>1</td>
</tr>
<tr>
<td>Variable values</td>
<td>The <code>param-name</code> variable has a value of type
<code>xs:string</code> equal the local part of the name of the
serialization parameter under consideration</td>
</tr>
<tr>
<td>Function implementations</td>
<td>The implementation of fn:data</td>
</tr>
<tr>
<td>Current dateTime</td>
<td>Absent</td>
</tr>
<tr>
<td>Implicit timezone</td>
<td>Absent</td>
</tr>
<tr>
<td>Available documents</td>
<td>None</td>
</tr>
<tr>
<td>Available collections</td>
<td>None</td>
</tr>
<tr>
<td>Default collection</td>
<td>None</td>
</tr>
</tbody>
</table>
<p>In the case of the <code>use-character-maps</code> parameter,
the expression</p>
<div class="exampleInner">
<pre>
(validate lax { document { . } })
/output:serialization-parameters/output:use-character-maps
/output:character-map[@character eq $char]/string(@map-string)
</pre></div>
<p>is evaluated for each Unicode character that is permitted in an
XML document. The dynamic context and static context used to
evaluate the expression are as defined above, except that in-scope
variables is the set {<code>char</code>} and the value of the
variable "<code>char</code>" is a value of type
<code>xs:string</code> of length one whose value is the Unicode
character under consideration. If the result of evaluating the
expression is not an empty sequence, the pair consisting of the
Unicode character and the result of evaluating the expression is
part of the list of pairs in the value of the
<code>use-character-maps</code> parameter. It is a <a title=
"serialization error" href="#serial-err">serialization error</a>
[<a href="#ERRSEPM0018" title="err:SEPM0018">err:SEPM0018</a>] if
the result of evaluating this expression for any character is a
sequence of length greater than one.</p>
<p>Using the same settings of the components of the dynamic context
and static context, <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSEPM0019"
title="err:SEPM0019">err:SEPM0019</a>] results if the result of
evaluating the following expression is not true — that is, if the
data model instance specifies more than one setting for any
particular serialization parameter.</p>
<div class="exampleInner">
<pre>
(document { . })/output:serialization-parameters
/(count(distinct-values(*/node-name(.))) eq (count(*)))
</pre></div>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>A serializer or implementation of a host language does not need
to be accompanied by an XQuery processor nor by a general-purpose
schema validator in order to meet the requirements of this section.
It merely needs to be capable of extracting values from an XDM
instance that conforms to the schema for serialization parameters,
while checking that the constraints implied by the schema and
additional constraints implied by the XQuery validate expression or
explicitly stated in this section are satisfied.</p>
</div>
<p>The host language <strong>MAY</strong> provide additional
mechanisms for overriding the values of any serialization
parameters specified through the mechanism defined in this section,
as well as additional mechanisms for specifying the values of any
serialization parameters whose values remain unspecified after
applying the mechanism defined in this section.</p>
<p>If the instance of the data model contains elements or
attributes in the instance of the data model that are in a
namespace other than
<code>http://www.w3.org/2010/xslt-xquery-serialization</code>, the
implementation <strong>MAY</strong> interpret them to specify the
values of <a title="implementation-defined" href=
"#impdef">implementation-defined</a> serialization parameters in an
<a title="implementation-defined" href=
"#impdef">implementation-defined</a> manner.</p>
<div class="exampleOuter">
<p>The following XML document, if converted to a data model
instance and processed using the mechanism described in this
section, would specify the settings of the <code>method</code>,
<code>version</code> and <code>indent</code> serialization
parameters with the values <code>xml</code>, <code>1.0</code> and
<code>yes</code>, respectively.</p>
<div class="exampleInner">
<pre>
&lt;output:serialization-parameters
xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization"&gt;
&lt;output:method value="xml"/&gt;
&lt;output:version value="1.0"/&gt;
&lt;output:indent value="yes"/&gt;
&lt;/output:serialization-parameters&gt;
</pre></div>
<p>The following document would specify the setting of the
<code>cdata-section-elements</code> serialization parameter with
value the pair of expanded QNames
(<code>http://example.org/book/chapter</code>,<code>heading</code>)
and
(<code>http://example.org/book</code>,<code>footnote</code>)</p>
<div class="exampleInner">
<pre>
&lt;output:serialization-parameters
xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization"
xmlns:book="http://example.org/book"
xmlns="http://example.org/book/chapter"&gt;
&lt;output:cdata-section-elements value="heading book:footnote"/&gt;
&lt;/output:serialization-parameters&gt;
</pre></div>
<p>The following document would specify the value of the
<code>method</code> serialization parameter with the value
<code>html</code>.</p>
<p>Notice that in this example, the default namespace declaration
in scope has no effect on the interpretation of the setting of the
<code>method</code> parameter.</p>
<div class="exampleInner">
<pre>
&lt;output:serialization-parameters
xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization"
xmlns="http://example.org/ext"&gt;
&lt;output:method value="html"/&gt;
&lt;/output:serialization-parameters&gt;
</pre></div>
<p>The following document would specify the value of the
<code>method</code> serialization parameter with value equal to the
expanded QName (<code>http://example.org/ext</code>,
<code>jsp</code>), and the <code>use-character-maps</code>
parameter with value equal to the list of pairs, <code>(«, &lt;%),
(», %&gt;)</code></p>
<div class="exampleInner">
<pre>
&lt;output:serialization-parameters
xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization"
xmlns:ext="http://example.org/ext"&gt;
&lt;output:method value="ext:jsp"/&gt;
&lt;output:use-character-maps&gt;
&lt;output:character-map character="&amp;#xAB;" map-string="&amp;lt;%"/&gt;
&lt;output:character-map character="&amp;#xBB;" map-string="%&amp;gt;"/&gt;
&lt;/output:use-character-maps&gt;
&lt;/output:serialization-parameters&gt;
</pre></div>
</div>
</div>
</div>
<div class="div1">
<h2><a name="serphases" id="serphases"></a>4 Phases of
Serialization</h2>
<p>Serialization comprises five phases of processing (preceded
optionally by the sequence normalization process described in
<a href="#serdm"><b>2 Sequence Normalization</b></a>).</p>
<p>For an <a title="implementation-defined" href=
"#impdef">implementation-defined</a> output method, any of these
phases <strong>MAY</strong> be skipped or <strong>MAY</strong> be
performed in a different order than is specified here. For the
output methods defined in this specification, these phases are
carried out sequentially as follows:</p>
<ol class="enumar">
<li>
<p>A <code>meta</code> element is added to the normalized sequence
along with discarding an existing <code>meta</code> element, as
controlled by the <code>include-content-type</code> parameter for
the XHTML and HTML output methods.</p>
</li>
<li>
<p><em>Markup generation</em> produces the character representation
of those parts of the serialized result that describe the structure
of the normalized sequence. In the cases of the XML, HTML and XHTML
output methods, this phase produces the character representations
of the following:</p>
<ul>
<li>
<p>the document type declaration;</p>
</li>
<li>
<p>start tags and end tags (except for attribute values, whose
representation is produced by the character expansion phase);</p>
</li>
<li>
<p>processing instructions; and</p>
</li>
<li>
<p>comments.</p>
</li>
</ul>
<p>In the cases of the XML and XHTML output methods, this phase
also produces the following:</p>
<ul>
<li>
<p>the XML or text declaration; and</p>
</li>
<li>
<p>empty element tags (except for the attribute values);</p>
</li>
</ul>
<p>In the case of the text output method, <span>this phase replaces
the single document node produced by <a title=
"sequence normalization" href="#sequence-normalization">sequence
normalization</a> with a new document node that has exactly one
child, which is a text node. The string value of the new text node
is the string value of the document node that was produced by
sequence normalization.</span></p>
</li>
<li>
<p><em>Character expansion</em> is concerned with the
representation of characters appearing in text and attribute
<a title="node" href="#dt-node">nodes</a> in the normalized
sequence. For each text and attribute <a title="node" href=
"#dt-node">node</a>, the following rules are applied in
sequence.</p>
<ol class="enumla">
<li>
<p>If the node is an attribute that is a <a title=
"URI attribute values" href="#uri-attribute-values">URI attribute
value</a> and the <code>escape-uri-attributes</code> parameter is
set to require escaping of URI attributes, apply <a title=
"URI Escaping" href="#uri-escaping">URI escaping</a> as defined
below, and skip rules b-e. Otherwise, continue with rule b.</p>
<p>[<a name="uri-escaping" id="uri-escaping" title=
"URI Escaping">Definition</a>: <b>URI escaping</b> consists of the
following three steps applied in sequence to the content of
<a title="URI attribute values" href="#uri-attribute-values">URI
attribute values</a>:]</p>
<ol class="enumlr">
<li>
<p>normalize to NFC using the method defined in <a href=
"http://www.w3.org/TR/xpath-functions-30/#func-normalize-unicode">Section
5.4.6 fn:normalize-unicode</a> <sup><small>FO30</small></sup></p>
</li>
<li>
<p>percent-encode any special characters in the URI using the
method defined in <a href=
"http://www.w3.org/TR/xpath-functions-30/#func-escape-html-uri">Section
6.4 fn:escape-html-uri</a> <sup><small>FO30</small></sup></p>
</li>
<li>
<p>escape according to <span>the rules of the XML or HTML output
method, whichever is applicable, any characters that require</span>
escaping, and any characters that cannot be represented in the
selected encoding. For example, replace <code>&lt;</code> with
<code>&amp;lt;</code>. (See also section <a href=
"#HTML_CHARDATA"><b>7.3 Writing Character Data</b></a>)</p>
</li>
</ol>
<p>[<a name="uri-attribute-values" id="uri-attribute-values" title=
"URI attribute values">Definition</a>: The values of attributes
listed in <a href="#list-of-uri-attributes"><b>D List of URI
Attributes</b></a> are <b>URI attribute values</b>. Attributes are
not considered to be URI attributes simply because they are
namespace declaration attributes or have the type annotation
<code>xs:anyURI</code>.]</p>
</li>
<li>
<p>If the node is a text node whose parent element is selected by
the rules of the <code>cdata-section-elements</code> parameter for
the applicable output method, create CDATA sections as described
below, and skip rules c-e. Otherwise, continue with rule c.</p>
<p>Apply the following two processes in sequence to create CDATA
sections</p>
<ol class="enumlr">
<li>
<p><a title="Unicode Normalization" href=
"#unicode-normalization">Unicode Normalization</a> if requested by
the <code>normalization-form</code> parameter.</p>
</li>
<li>
<p>apply changes as detailed in the description of the
<code>cdata-section-elements</code> parameter for the applicable
output method.</p>
</li>
</ol>
</li>
<li>
<p>Apply character mapping as determined by the
<code>use-character-maps</code> parameter for the applicable output
method. For characters that were substituted by this process, skip
rules d and e. For the remaining characters that were not modified
by character mapping, continue with rule d.</p>
</li>
<li>
<p>Apply <a title="Unicode Normalization" href=
"#unicode-normalization">Unicode Normalization</a> if requested by
the <code>normalization-form</code> parameter.</p>
<p>[<a name="unicode-normalization" id="unicode-normalization"
title="Unicode Normalization">Definition</a>: <b>Unicode
Normalization</b> is the process of removing alternate
representations of equivalent sequences from textual data, to
convert the data into a form that can be binary-compared for
equivalence, as specified in <a href=
"#UNICODE-NORMALIZATION-FORM">[UAX #15: Unicode Normalization
Forms]</a>. For specific recommendations for character
normalization on the World Wide Web, see <a href=
"#charmod-norm">[Character Model for the World Wide Web 1.0:
Normalization]</a>.]</p>
<p>The meanings associated with the possible values of the
<code>normalization-form</code> parameter are defined in section
<a href="#XML_NORMALIZATION-FORM"><b>5.1.8 XML Output Method: the
normalization-form Parameter</b></a>.</p>
<p>Continue with step e.</p>
</li>
<li>
<p>Escape according to <span>the rules of the XML or HTML output
method, whichever is applicable,</span> any characters (such as
<code>&lt;</code> and <code>&amp;</code>) where XML or HTML
requires escaping, and any characters that cannot be represented in
the selected encoding. For example, replace <code>&lt;</code> with
<code>&amp;lt;</code>. (See also section <a href=
"#HTML_CHARDATA"><b>7.3 Writing Character Data</b></a>). For
characters such as <code>&gt;</code> where XML defines a built-in
entity but does not require its use in all circumstances, it is
implementation-dependent whether the character is escaped.</p>
</li>
</ol>
</li>
<li>
<p><em>Indentation</em>, as controlled by the <code>indent</code>
parameter <span>and the <code>suppress-indentation</code>
parameter</span>, <strong>MAY</strong> add or remove whitespace
according to the rules defined by the applicable output method.</p>
</li>
<li>
<p><em>Encoding</em>, as controlled by the <code>encoding</code>
parameter, converts the character stream produced by the previous
phases into an octet stream.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Serialization is only defined in terms of encoding the result as
a stream of octets. However, a <a title="serializer" href=
"#serializer">serializer</a> may provide an option that allows the
encoding phase to be skipped, so that the result of serialization
is a stream of Unicode characters. The effect of any such option is
<a title="implementation-defined" href=
"#impdef">implementation-defined</a>, and a <a title="serializer"
href="#serializer">serializer</a> is not required to support such
an option.</p>
</div>
</li>
</ol>
</div>
<div class="div1">
<h2><a name="xml-output" id="xml-output"></a>5 XML Output
Method</h2>
<p>The XML output method serializes the normalized sequence as an
XML entity that <strong>MUST</strong> satisfy the rules for either
a well-formed XML document entity or a well-formed XML external
general parsed entity, or both. A <a title="serialization error"
href="#serial-err">serialization error</a> [<a href="#ERRSERE0003"
title="err:SERE0003">err:SERE0003</a>] results if the <a title=
"serializer" href="#serializer">serializer</a> is unable to satisfy
those rules, except for content modified by the character expansion
phase of serialization, as described in <a href="#serphases"><b>4
Phases of Serialization</b></a>. The effects of the character
expansion phase could result in the serialized output being not
well-formed, but will not result in a <a title=
"serialization error" href="#serial-err">serialization error</a>.
If a <a title="serialization error" href=
"#serial-err">serialization error</a> results, the <a title=
"serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal the error.</p>
<p>If the document <a title="node" href="#dt-node">node</a> of the
normalized sequence has a single element <a title="node" href=
"#dt-node">node</a> child and no text <a title="node" href=
"#dt-node">node</a> children, then the serialized output is a
well-formed XML document entity, and the serialized output
<strong>MUST</strong> conform to the appropriate version of the XML
Namespaces Recommendation <a href="#xml-names">[XML Names]</a> or
<a href="#xml-names11">[XML Names 1.1]</a>. If the normalized
sequence does not take this form, then the serialized output is a
well-formed XML external general parsed entity, which, when
referenced within a trivial XML document wrapper like this:</p>
<div class="exampleInner">
<pre>
&lt;?xml version="<em>version</em>"?&gt;
&lt;!DOCTYPE doc [
&lt;!ENTITY e SYSTEM "<em>entity-URI</em>"&gt;
]&gt;
&lt;doc&gt;&amp;e;&lt;/doc&gt;
</pre></div>
<p>where <code>entity-URI</code> is a URI for the entity, and the
value of the <code>version</code> pseudo-attribute is the value of
the <code>version</code> parameter, produces a document which
<strong>MUST</strong> itself be a well-formed XML document
conforming to the corresponding version of the XML Namespaces
Recommendation <a href="#xml-names">[XML Names]</a> or <a href=
"#xml-names11">[XML Names 1.1]</a>.</p>
<p>[<a name="reconstructed-tree" id="reconstructed-tree" title=
"reconstructed tree">Definition</a>: A <b>reconstructed tree</b>
may be constructed by parsing the XML document and converting it
into an instance of the data model as specified in <a href=
"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.]
The result of serialization <strong>MUST</strong> be such that the
<a title="reconstructed tree" href=
"#reconstructed-tree">reconstructed tree</a> is the same as the
<a title="result tree" href="#result-tree">result tree</a> except
for the following permitted differences:</p>
<ul>
<li>
<p>If the document was produced by adding a document wrapper, as
described above, then it will contain an extra <code>doc</code>
element as the document element.</p>
</li>
<li>
<p>The order of attribute and namespace <a title="node" href=
"#dt-node">nodes</a> in the two trees <strong>MAY</strong> be
different.</p>
</li>
<li>
<p>The following properties of corresponding <a title="node" href=
"#dt-node">nodes</a> in the two trees <strong>MAY</strong> be
different:</p>
<ul>
<li>
<p>the base-uri property of document <a title="node" href=
"#dt-node">nodes</a> and element <a title="node" href=
"#dt-node">nodes</a>;</p>
</li>
<li>
<p>the document-uri and unparsed-entities properties of document
<a title="node" href="#dt-node">nodes</a>;</p>
</li>
<li>
<p>the type-name and typed-value properties of element and
attribute <a title="node" href="#dt-node">nodes</a>;</p>
</li>
<li>
<p>the nilled property of element <a title="node" href=
"#dt-node">nodes</a>;</p>
</li>
<li>
<p>the content property of text <a title="node" href=
"#dt-node">nodes</a>, due to the effect of the <code>indent</code>
and <code>use-character-maps</code> parameters.</p>
</li>
</ul>
</li>
<li>
<p>The <a title="reconstructed tree" href=
"#reconstructed-tree">reconstructed tree</a> <strong>MAY</strong>
contain additional attributes and text <a title="node" href=
"#dt-node">nodes</a> resulting from the expansion of default and
fixed values in its DTD or schema; also, in the presence of a DTD,
non-CDATA attributes may lose whitespace characters as a result of
attribute value normalization.</p>
</li>
<li>
<p>The type annotations of the <a title="node" href=
"#dt-node">nodes</a> in the two trees <strong>MAY</strong> be
different. Type annotations in a <a title="result tree" href=
"#result-tree">result tree</a> are discarded when the tree is
serialized. Any new type annotations obtained by parsing the
document will depend on whether the serialized XML document is
assessed against a schema, and this <strong>MAY</strong> result in
type annotations that are different from those in the original
<a title="result tree" href="#result-tree">result tree</a>.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>In order to influence the type annotations in the instance of
the data model that would result from processing a serialized XML
document, the author of the XSLT stylesheet, XQuery expression or
other process might wish to create the instance of the data model
that is input to the serialization process so that it makes use of
mechanisms provided by <a href="#xmlschema-1">[XML Schema]</a>,
such as <code>xsi:type</code> and <code>xsi:schemaLocation</code>
attributes. The serialization process will not automatically create
such attributes in the serialized document if those attributes were
not part of the <a title="result tree" href="#result-tree">result
tree</a> that is to be serialized.</p>
<p>Similarly, it is possible that an element <a title="node" href=
"#dt-node">node</a> in the instance of the data model that is to be
serialized has the <code>nilled</code> property with the value
<code>true</code>, but no <code>xsi:nil</code> attribute. The
serialization process will not create such an attribute in the
serialized document simply to reflect the value of the property.
The value of the <code>nilled</code> property has no direct effect
on the serialized result.</p>
</div>
</li>
<li>
<p>Additional namespace <a title="node" href="#dt-node">nodes</a>
<strong>MAY</strong> be present in the <a title=
"reconstructed tree" href="#reconstructed-tree">reconstructed
tree</a> if the serialization process did not undeclare one or more
namespaces, as described in <a href="#xml-undeclare-NS"><b>5.1.7
XML Output Method: the undeclare-prefixes Parameter</b></a>, and
the starting instance of the data model contained an element
<a title="node" href="#dt-node">node</a> with a namespace <a title=
"node" href="#dt-node">node</a> that declared some prefix, but a
child element of that <a title="node" href="#dt-node">node</a> did
not have any namespace <a title="node" href="#dt-node">node</a>
that declared the same prefix.</p>
<p>The <a title="result tree" href="#result-tree">result tree</a>
<strong>MAY</strong> contain namespace <a title="node" href=
"#dt-node">nodes</a> that are not present in the <a title=
"reconstructed tree" href="#reconstructed-tree">reconstructed
tree</a>, as the process of creating an instance of the data model
<strong>MAY</strong> ignore namespace declarations in some
circumstances. See <a href=
"http://www.w3.org/TR/xpath-datamodel-30/#const-infoset-element">Section
6.2.3 Construction from an Infoset</a>
<sup><small>DM30</small></sup> and <a href=
"http://www.w3.org/TR/xpath-datamodel-30/#const-psvi-element">Section
6.2.4 Construction from a PSVI</a> <sup><small>DM30</small></sup>
of <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM)
3.0]</a> for additional information.</p>
</li>
<li>
<p>If the <code>indent</code> parameter has the value
<code>yes</code>,</p>
<ul>
<li>
<p>additional text <a title="node" href="#dt-node">nodes</a>
consisting of whitespace characters <strong>MAY</strong> be present
in the <a title="reconstructed tree" href=
"#reconstructed-tree">reconstructed tree</a>; and</p>
</li>
<li>
<p>text <a title="node" href="#dt-node">nodes</a> in the <a title=
"result tree" href="#result-tree">result tree</a> that contained
only whitespace characters <strong>MAY</strong> correspond to text
<a title="node" href="#dt-node">nodes</a> in the <a title=
"reconstructed tree" href="#reconstructed-tree">reconstructed
tree</a> that contain additional whitespace characters that were
not present in the <a title="result tree" href=
"#result-tree">result tree</a></p>
</li>
</ul>
<p>See <a href="#xml-indent"><b>5.1.3 XML Output Method: the indent
and suppress-indentation Parameters</b></a> for more information on
the <code>indent</code> parameter.</p>
</li>
<li>
<p>Additional <a title="node" href="#dt-node">nodes</a>
<strong>MAY</strong> be present in the <a title=
"reconstructed tree" href="#reconstructed-tree">reconstructed
tree</a> due to the effect of character mapping in the character
expansion phase, and the values of attribute <a title="node" href=
"#dt-node">nodes</a> and text <a title="node" href=
"#dt-node">nodes</a> in the <a title="reconstructed tree" href=
"#reconstructed-tree">reconstructed tree</a> <strong>MAY</strong>
be different from those in the <a title="result tree" href=
"#result-tree">result tree</a>, due to the effects of URI
expansion, character mapping and <a title="Unicode Normalization"
href="#unicode-normalization">Unicode Normalization</a> in the
character expansion phase of serialization.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>The <code>use-character-maps</code> parameter can cause
arbitrary characters to be inserted into the serialized XML
document in an unescaped form, including characters that would be
considered to be part of XML markup. Such characters could result
in arbitrary new element <a title="node" href="#dt-node">nodes</a>,
attribute <a title="node" href="#dt-node">nodes</a>, and so on, in
the <a title="reconstructed tree" href=
"#reconstructed-tree">reconstructed tree</a> that results from
processing the serialized XML document.</p>
</div>
</li>
</ul>
<p>A consequence of this rule is that certain characters
<strong>MUST</strong> be output as character references, to ensure
that they survive the round trip through serialization and parsing.
Specifically, CR, NEL and LINE SEPARATOR characters in text
<a title="node" href="#dt-node">nodes</a> <strong>MUST</strong> be
output respectively as "<code>&amp;#xD;</code>",
"<code>&amp;#x85;</code>", and "<code>&amp;#x2028;</code>", or
their equivalents; while CR, NL, TAB, NEL and LINE SEPARATOR
characters in attribute <a title="node" href="#dt-node">nodes</a>
<strong>MUST</strong> be output respectively as
"<code>&amp;#xD;</code>", "<code>&amp;#xA;</code>",
"<code>&amp;#x9;</code>", "<code>&amp;#x85;</code>", and
"<code>&amp;#x2028;</code>", or their equivalents. In addition, the
non-whitespace control characters #x1 through #x1F and #x7F through
#x9F in text <a title="node" href="#dt-node">nodes</a> and
attribute <a title="node" href="#dt-node">nodes</a>
<strong>MUST</strong> be output as character references.</p>
<p>For example, an attribute with the value "x" followed by "y"
separated by a newline will result in the output
<code>"x&amp;#xA;y"</code> (or with any equivalent character
reference). The XML output cannot be "x" followed by a literal
newline followed by a "y" because after parsing, the attribute
value would be <code>"x y"</code> as a consequence of the XML
attribute normalization rules.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>XML 1.0 did not permit an XML processor to normalize NEL or LINE
SEPARATOR characters to a LINE FEED character. However, if a
document entity that specifies version 1.1 invokes an external
general parsed entity with no text declaration or a text
declaration that specifies version 1.0, the external parsed entity
is processed according to the rules of XML 1.1. For this reason,
NEL and LINE SEPARATOR characters in text and attribute <a title=
"node" href="#dt-node">nodes</a> must always be escaped using
character references, regardless of the value of the
<code>version</code> parameter.</p>
<p>XML 1.0 permitted control characters in the range #x7F through
#x9F to appear as literal characters in an XML document, but XML
1.1 requires such characters, other than NEL, to be escaped as
character references. An external general parsed entity with no
text declaration or a text declaration that specifies a version
pseudo-attribute with value <code>1.0</code> that is invoked by an
XML 1.1 document entity must follow the rules of XML 1.1.
Therefore, the non-whitespace control characters in the ranges #x1
through #x1F and #x7F through #x9F must always be escaped,
regardless of the value of the <code>version</code> parameter.</p>
</div>
<p>It is a <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSEPM0004"
title="err:SEPM0004">err:SEPM0004</a>] to specify the
doctype-system parameter, or to specify the standalone parameter
with a value other than <code>omit</code>, if the instance of the
data model contains text <a title="node" href="#dt-node">nodes</a>
or multiple element <a title="node" href="#dt-node">nodes</a> as
children of the root <a title="node" href="#dt-node">node</a>. The
<a title="serializer" href="#serializer">serializer</a>
<strong>MUST</strong> either signal the error, or recover by
ignoring the request to output a document type declaration or
<code>standalone</code> parameter.</p>
<div class="div2">
<h3><a name="XML_PARAMS" id="XML_PARAMS"></a>5.1 The Influence of
Serialization Parameters upon the XML Output Method</h3>
<div class="div3">
<h4><a name="XML_VERSION" id="XML_VERSION"></a>5.1.1 XML Output
Method: the <code>version</code> Parameter</h4>
<p>The <code>version</code> parameter specifies the version of XML
and the version of Namespaces in XML to be used for outputting the
instance of the data model. The version output in the XML
declaration (if an XML declaration is not omitted)
<strong>MUST</strong> correspond to the version of XML that the
<a title="serializer" href="#serializer">serializer</a> used for
outputting the instance of the data model. <span>The value of the
<code>version</code> parameter <strong>MUST</strong> match the
<a href="http://www.w3.org/TR/REC-xml/#NT-VersionNum">VersionNum
VersionNum VersionNum VersionNum</a><sup><small>XML</small></sup>
production of the XML Recommendation <a href="#xml">[XML10]</a> or
<a href="#xml11">[XML11]</a>.</span> A serialization error
[<a href="#ERRSESU0013" title="err:SESU0013">err:SESU0013</a>]
results if the value of the <code>version</code> parameter
specifies a version of XML that is not supported by the <a title=
"serializer" href="#serializer">serializer</a>; the <a title=
"serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal the error.</p>
<p>This document provides the normative definition of serialization
for the XML output method if the <code>version</code> parameter has
either the value <code>1.0</code> or <code>1.1</code>. For any
other value of <code>version</code> parameter, the behavior is
<a title="implementation-defined" href=
"#impdef">implementation-defined</a>. In that case the <a title=
"implementation-defined" href="#impdef">implementation-defined</a>
behavior <strong>MAY</strong> supersede all other requirements of
this recommendation.</p>
<p>If the serialized result would contain an <a href=
"http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName NCName
NCName NCName NCName NCName NCName NCName NCName
NCName</a><sup><small>Names</small></sup> that contains a character
that is not permitted by the version of Namespaces in XML specified
by the <code>version</code> parameter, a <a title=
"serialization error" href="#serial-err">serialization error</a>
[<a href="#ERRSERE0005" title="err:SERE0005">err:SERE0005</a>]
results. The <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST</strong> signal the
error.</p>
<p>If the serialized result would contain a character that is not
permitted by the version of XML specified by the
<code>version</code> parameter, a <a title="serialization error"
href="#serial-err">serialization error</a> [<a href="#ERRSERE0006"
title="err:SERE0006">err:SERE0006</a>] results. The <a title=
"serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal the error.</p>
<div class="exampleOuter">
<p>For example, if the <code>version</code> parameter has the value
<code>1.0</code>, and the instance of the data model contains a
non-whitespace control character in the range #x1 to #x1F, a
<a title="serialization error" href="#serial-err">serialization
error</a> [<a href="#ERRSERE0006" title=
"err:SERE0006">err:SERE0006</a>] results. If the
<code>version</code> parameter has the value <code>1.1</code> and a
comment <a title="node" href="#dt-node">node</a> in the instance of
the data model contains a non-whitespace control character in the
range #x1 to #x1F or a control character other than NEL in the
range #x7F to #x9F, a <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSERE0006"
title="err:SERE0006">err:SERE0006</a>] results.</p>
</div>
</div>
<div class="div3">
<h4><a name="XML_ENCODING" id="XML_ENCODING"></a>5.1.2 XML Output
Method: the <code>encoding</code> Parameter</h4>
<p>The <code>encoding</code> parameter specifies the encoding to be
used for outputting the instance of the data model. <a title=
"serializer" href="#serializer">Serializers</a> are
<strong>REQUIRED</strong> to support values of <code>UTF-8</code>
and <code>UTF-16</code>. A <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSESU0007"
title="err:SESU0007">err:SESU0007</a>] occurs if an output encoding
other than <code>UTF-8</code> or <code>UTF-16</code> is requested
and the <a title="serializer" href="#serializer">serializer</a>
does not support that encoding. The <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST</strong> signal the
error, or recover by using <code>UTF-8</code> or
<code>UTF-16</code> instead. The <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST NOT</strong> use an
encoding whose name does not match the <a href=
"http://www.w3.org/TR/REC-xml/#NT-EncName">EncName EncName EncName
EncName EncName EncName</a><sup><small>XML</small></sup> production
of the XML Recommendation <a href="#xml">[XML10]</a>.</p>
<p>When outputting a newline character in the instance of the data
model, the <a title="serializer" href="#serializer">serializer</a>
is free to represent it using any character sequence that will be
normalized to a newline character by an XML parser, unless a
specific mapping for the newline character is provided in a
character map (see <a href="#character-maps"><b>9 Character
Maps</b></a>).</p>
<p>When outputting any other character that is defined in the
selected encoding, the character <strong>MUST</strong> be output
using the correct representation of that character in the selected
encoding.</p>
<p>It is possible that the instance of the data model will contain
a character that cannot be represented in the encoding that the
<a title="serializer" href="#serializer">serializer</a> is using
for output. In this case, if the character occurs in a context
where XML recognizes character references (that is, in the value of
an attribute <a title="node" href="#dt-node">node</a> or text
<a title="node" href="#dt-node">node</a>), then the character
<strong>MUST</strong> be output as a character reference. A
<a title="serialization error" href="#serial-err">serialization
error</a> [<a href="#ERRSERE0008" title=
"err:SERE0008">err:SERE0008</a>] occurs if such a character appears
in a context where character references are not allowed (for
example, if the character occurs in the name of an element). The
<a title="serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal the error.</p>
<div class="exampleOuter">
<p>For example, if a text <a title="node" href="#dt-node">node</a>
contains the character LATIN SMALL LETTER E WITH ACUTE (#xE9), and
the value of the <code>encoding</code> parameter is
<code>US-ASCII</code>, the character <strong>MUST</strong> be
serialized as a character reference. If a comment <a title="node"
href="#dt-node">node</a> contains the same character, a <a title=
"serialization error" href="#serial-err">serialization error</a>
[<a href="#ERRSERE0008" title="err:SERE0008">err:SERE0008</a>]
results.</p>
</div>
</div>
<div class="div3">
<h4><a name="xml-indent" id="xml-indent"></a>5.1.3 XML Output
Method: the <code>indent</code> <span>and
<code>suppress-indentation</code></span> Parameters</h4>
<p>The <code>indent</code> and <code>suppress-indentation</code>
parameters control whether the serializer <strong>MAY</strong>
adjust the whitespace in the serialized result so that a person
will find it easier to read. If the <code>indent</code> parameter
has the value <code>yes</code>, the serializer <strong>MAY</strong>
output whitespace characters in addition to the whitespace
characters in the instance of the data model. It
<strong>MAY</strong> also elide from the output whitespace
characters that occurred in the instance of the data model or
replace such whitespace characters with other whitespace
characters.</p>
<p>[<a name="content" id="content" title="content">Definition</a>:
The term <b>content</b> has the same meaning as the term <a href=
"http://www.w3.org/TR/REC-xml/#dt-content">Content</a><sup><small>XML</small></sup>
defined in <a href=
"http://www.w3.org/TR/REC-xml/#sec-starttags">Section 3.1
Start-Tags, End-Tags, and Empty-Element
Tags</a><sup><small>XML</small></sup> of <a href=
"#xml">[XML10]</a>.] [<a name="immediate-content" id=
"immediate-content" title="immediate content">Definition</a>: The
<b>immediate content</b> of an element is the part of the <a title=
"content" href="#content">content</a> of the element that is not
also in the <a title="content" href="#content">content</a> of a
child element of that element.]</p>
<p>If the <code>indent</code> parameter has the value
<code>no</code>, the serializer <strong>MUST NOT</strong> output
any additional, elide or replace whitespace characters. If the
<code>indent</code> parameter has the value <code>yes</code>, the
serializer <strong>MUST</strong> use an algorithm for dealing with
whitespace characters that satisfies all of the following
constraints. <span>If more than one constraint applies, the
serializer must apply the most restrictive constraint. That is, if
any applicable constraint indicates that whitespace <strong>MUST
NOT</strong> be added, elided or replaced, that constraint
prevails; if an applicable constraint indicates that whitespace
<strong>SHOULD NOT</strong> be added, elided or replaced, while all
other applicable constraints indicate that whitespace
<strong>MAY</strong> be added, elided or replaced, whitespace
<strong>SHOULD NOT</strong> be added, elided or
replaced.</span></p>
<ul>
<li>
<p>Whitespace characters <span><strong>MAY</strong></span> be added
adjacent to a text <a title="node" href="#dt-node">node</a>
<span>only if the text node contains only whitespace characters.
Whitespace characters in such a text node <strong>MAY</strong> also
be elided or replaced. For example, a tab <strong>MAY</strong> be
inserted as a replacement for existing spaces</span>.</p>
</li>
<li>
<p>Whitespace characters <strong>MAY</strong> be added, elided or
replaced in the <a title="immediate content" href=
"#immediate-content">immediate content</a> of an element whose type
annotation is <code>xs:untyped</code> or <code>xs:anyType</code>
and that has element node children, in the <a title=
"immediate content" href="#immediate-content">immediate content</a>
of an element whose content model is element only, or outside the
<a title="content" href="#content">content</a> of any element.</p>
</li>
<li>
<p>Whitespace characters <strong>MUST NOT</strong> be added,
<span>elided or replaced</span> in the <a title="immediate content"
href="#immediate-content">immediate content</a> of an element whose
content model is <span>known to be simple or empty</span>.</p>
</li>
<li>
<p>Whitespace characters <strong>SHOULD NOT</strong> be added,
<span>elided or replaced</span> in places where the characters
would constitute significant whitespace, for example, in the
<a title="immediate content" href="#immediate-content">immediate
content</a> of an element <span>that is annotated with a type other
than <code>xs:untyped</code> or <code>xs:anyType</code>, and</span>
whose content model is known to be mixed.</p>
</li>
<li>
<p>Whitespace characters <strong>MUST NOT</strong> be added,
<span>elided or replaced</span> in the <span><a title="content"
href="#content">content</a></span> of an element whose expanded
QName is a member of the list of expanded QNames in the value of
the <code>suppress-indentation</code> parameter.</p>
</li>
<li>
<p>Whitespace characters <strong>MUST NOT</strong> be <span>added,
elided or replaced</span> in a part of the result document that is
controlled by an <code>xml:space</code> attribute with value
<code>preserve</code>. (See <a href="#xml">[XML10]</a> for more
information about the <code>xml:space</code> attribute.)</p>
</li>
</ul>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>The effect of these rules is to ensure that whitespace is only
added in places where (a) XSLT's
<code>&lt;xsl:strip-space&gt;</code> declaration could cause it to
be removed, and (b) it does not affect the <a title="string value"
href="#dt-string-value">string value</a> of any element <a title=
"node" href="#dt-node">node</a> with simple content. It is usually
not safe to indent document types that include elements with mixed
content.</p>
</div>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>The whitespace added may possibly be based on whitespace
stripped from either the source document or the stylesheet (in the
case of XSLT), or guided by other means that might depend on the
<a title="host language" href="#host-language">host language</a>,
in the case of an instance of the data model created using some
other process.</p>
</div>
</div>
<div class="div3">
<h4><a name="XML_CDATA-SECTION-ELEMENTS" id=
"XML_CDATA-SECTION-ELEMENTS"></a>5.1.4 XML Output Method: the
<code>cdata-section-elements</code> Parameter</h4>
<p>The <code>cdata-section-elements</code> parameter contains a
list of expanded QNames. If the expanded QName of the parent of a
text <a title="node" href="#dt-node">node</a> is a member of the
list, then the text <a title="node" href="#dt-node">node</a>
<strong>MUST</strong> be output as a CDATA section, except in those
circumstances described below.</p>
<p>If the text <a title="node" href="#dt-node">node</a> contains
the sequence of characters <code>]]&gt;</code>, then the currently
open CDATA section <strong>MUST</strong> be closed following the
<code>]]</code> and a new CDATA section opened before the
<code>&gt;</code>.</p>
<p>If the text <a title="node" href="#dt-node">node</a> contains
characters that are not representable in the character encoding
being used to output the instance of the data model, then the
currently open CDATA section <strong>MUST</strong> be closed before
such characters, the characters <strong>MUST</strong> be output
using character references or entity references, and a new CDATA
section <strong>MUST</strong> be opened for any further characters
in the text <a title="node" href="#dt-node">node</a>.</p>
<p>CDATA sections <strong>MUST NOT</strong> be used except where
they have been explicitly requested by the user, either by using
the <code>cdata-section-elements</code> parameter, or by using some
other <a title="implementation-defined" href=
"#impdef">implementation-defined</a> mechanism.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>This is phrased to permit an implementor to provide an option
that attempts to preserve CDATA sections present in the source
document.</p>
</div>
</div>
<div class="div3">
<h4><a name="XML_OMIT-XML-DECLARATION" id=
"XML_OMIT-XML-DECLARATION"></a>5.1.5 XML Output Method: the
<code>omit-xml-declaration</code> and <code>standalone</code>
Parameters</h4>
<p>The XML output method <strong>MUST</strong> output an XML
declaration if the <code>omit-xml-declaration</code> parameter has
the value <code>no</code>. The XML declaration
<strong>MUST</strong> include both version information and an
encoding declaration. If the <code>standalone</code> parameter has
the value <code>yes</code> or the value <code>no</code>, the XML
declaration <strong>MUST</strong> include a standalone document
declaration with the same value as the value of the
<code>standalone</code> parameter. If the <code>standalone</code>
parameter has the value <code>omit</code>, the XML declaration
<strong>MUST NOT</strong> include a standalone document
declaration; this ensures that it is both an XML declaration
(allowed at the beginning of a document entity) and a text
declaration (allowed at the beginning of an external general parsed
entity).</p>
<p>A <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSEPM0009"
title="err:SEPM0009">err:SEPM0009</a>] results if the
<code>omit-xml-declaration</code> parameter has the value
<code>yes</code>, and</p>
<ul>
<li>
<p>the <code>standalone</code> parameter has a value other than
<code>omit</code>; or</p>
</li>
<li>
<p>the <code>version</code> parameter has a value other than
<code>1.0</code> and the <code>doctype-system</code> parameter is
specified.</p>
</li>
</ul>
<p>The <a title="serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal the error.</p>
<p>Otherwise, if the <code>omit-xml-declaration</code> parameter
has the value <code>yes</code>, the XML output method <strong>MUST
NOT</strong> output an XML declaration.</p>
</div>
<div class="div3">
<h4><a name="XML_DOCTYPE" id="XML_DOCTYPE"></a>5.1.6 XML Output
Method: the <code>doctype-system</code> and
<code>doctype-public</code> Parameters</h4>
<p>If the <code>doctype-system</code> parameter is specified, the
XML output method <strong>MUST</strong> output a document type
declaration immediately before the first element. The name
following <code>&lt;!DOCTYPE</code> <strong>MUST</strong> be the
name of the first element, if any. If the
<code>doctype-public</code> parameter is also specified, then the
XML output method <strong>MUST</strong> output <code>PUBLIC</code>
followed by the public identifier and then the system identifier;
otherwise, it <strong>MUST</strong> output <code>SYSTEM</code>
followed by the system identifier. The internal subset
<strong>MUST</strong> be empty. The <code>doctype-public</code>
parameter <strong>MUST</strong> be ignored unless the
<code>doctype-system</code> parameter is specified.</p>
</div>
<div class="div3">
<h4><a name="xml-undeclare-NS" id="xml-undeclare-NS"></a>5.1.7 XML
Output Method: the <code>undeclare-prefixes</code> Parameter</h4>
<p>The Data Model allows an element <a title="node" href=
"#dt-node">node</a> that binds a non-empty prefix to have a child
element <a title="node" href="#dt-node">node</a> that does not bind
that same prefix. In <em>Namespaces in XML 1.1</em> (<a href=
"#xml-names11">[XML Names 1.1]</a>), this can be represented
accurately by undeclaring prefixes. For the undeclaring prefix of
the child element node, if the <code>undeclare-prefixes</code>
parameter has the value <code>yes</code>, the output method is XML
or XHTML, and the <code>version</code> parameter value is greater
than <code>1.0</code>, the <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST</strong> undeclare its
namespace. If the <code>undeclare-prefixes</code> parameter has the
value <code>no</code> and the output method is XML or XHTML, then
the undeclaration of prefixes <strong>MUST NOT</strong> occur.</p>
<div class="exampleOuter">
<p>Consider an element <code>x:foo</code> with four in-scope
namespaces that associate prefixes with URIs as follows:</p>
<ul>
<li>
<p><code>x</code> is associated with
<code>http://example.org/x</code></p>
</li>
<li>
<p><code>y</code> is associated with
<code>http://example.org/y</code></p>
</li>
<li>
<p><code>z</code> is associated with
<code>http://example.org/z</code></p>
</li>
<li>
<p><code>xml</code> is associated with
<code>http://www.w3.org/XML/1998/namespace</code></p>
</li>
</ul>
<p>Suppose that it has a child element <code>x:bar</code> with
three in-scope namespaces:</p>
<ul>
<li>
<p><code>x</code> is associated with
<code>http://example.org/x</code></p>
</li>
<li>
<p><code>y</code> is associated with
<code>http://example.org/y</code></p>
</li>
<li>
<p><code>xml</code> is associated with
<code>http://www.w3.org/XML/1998/namespace</code></p>
</li>
</ul>
<p>If namespace undeclaration is in effect, it will be serialized
this way:</p>
<div class="exampleInner">
<pre>
&lt;x:foo xmlns:x="http://example.org/x"
xmlns:y="http://example.org/y"
xmlns:z="http://example.org/z"&gt;
&lt;x:bar xmlns:z=""&gt;...&lt;/x:bar&gt;
&lt;/x:foo&gt;
</pre></div>
</div>
<p>In <em>Namespaces in XML</em> 1.0 (<a href="#xml-names">[XML
Names]</a>), prefix undeclaration is not possible. If the output
method is XML or XHTML, the value of the
<code>undeclare-prefixes</code> parameter is <code>yes</code>, and
the value of the <code>version</code> parameter is
<code>1.0</code>, a <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSEPM0010"
title="err:SEPM0010">err:SEPM0010</a>] results; the <a title=
"serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal the error.</p>
</div>
<div class="div3">
<h4><a name="XML_NORMALIZATION-FORM" id=
"XML_NORMALIZATION-FORM"></a>5.1.8 XML Output Method: the
<code>normalization-form</code> Parameter</h4>
<p>The <code>normalization-form</code> parameter is applicable to
the XML output method. The values <code>NFC</code> and
<code>none</code> <strong>MUST</strong> be supported by the
<a title="serializer" href="#serializer">serializer</a>. A
<a title="serialization error" href="#serial-err">serialization
error</a> [<a href="#ERRSESU0011" title=
"err:SESU0011">err:SESU0011</a>] results if the value of the
<code>normalization-form</code> parameter specifies a normalization
form that is not supported by the <a title="serializer" href=
"#serializer">serializer</a>; the <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST</strong> signal the
error.</p>
<p>The meanings associated with the possible values of the
<code>normalization-form</code> parameter are as follows:</p>
<ul>
<li>
<p><code>NFC</code> specifies the serialized result will be in
Normalization Form C, using the rules specified in <a href=
"#charmod-norm">[Character Model for the World Wide Web 1.0:
Normalization]</a>.</p>
</li>
<li>
<p><code>NFD</code> specifies the serialized result will be in
Normalization Form D, as specified in <a href=
"#UNICODE-NORMALIZATION-FORM">[UAX #15: Unicode Normalization
Forms]</a>.</p>
</li>
<li>
<p><code>NFKC</code> specifies the serialized result will be in
Normalization Form KC, as specified in <a href=
"#UNICODE-NORMALIZATION-FORM">[UAX #15: Unicode Normalization
Forms]</a>.</p>
</li>
<li>
<p><code>NFKD</code> specifies the serialized result will be in
Normalization Form KD, as specified in <a href=
"#UNICODE-NORMALIZATION-FORM">[UAX #15: Unicode Normalization
Forms]</a>.</p>
</li>
<li>
<p><code>fully-normalized</code> specifies the serialized result
will be in fully normalized text, as specified in <a href=
"#charmod-norm">[Character Model for the World Wide Web 1.0:
Normalization]</a>.</p>
</li>
<li>
<p><code>none</code> specifies that no <a title=
"Unicode Normalization" href="#unicode-normalization">Unicode
Normalization</a> will be applied.</p>
</li>
<li>
<p>An <a title="implementation-defined" href=
"#impdef">implementation-defined</a> value has an <a title=
"implementation-defined" href="#impdef">implementation-defined</a>
effect.</p>
</li>
</ul>
<p>If the value of the parameter is <code>fully-normalized</code>,
then no <em>relevant construct</em> of the parsed entity created by
the <a title="serializer" href="#serializer">serializer</a> may
start with a composing character. The term <em>relevant
construct</em> has the meaning defined in section 2.13 of <a href=
"#xml11">[XML11]</a>. If this condition is not satisfied, a
<a title="serialization error" href="#serial-err">serialization
error</a> [<a href="#ERRSERE0012" title=
"err:SERE0012">err:SERE0012</a>] <strong>MUST</strong> be
signaled.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Specifying <code>fully-normalized</code> as the value of this
parameter does not guarantee that the XML document output by the
<a title="serializer" href="#serializer">serializer</a> will in
fact be fully normalized as defined in <a href=
"#xml11">[XML11]</a>. This is because the <a title="serializer"
href="#serializer">serializer</a> does not check that the text is
<code>include normalized</code>, which would involve checking all
external entities that it refers to (such as an external DTD).
Furthermore, the <a title="serializer" href=
"#serializer">serializer</a> does not check whether any character
escape generated using character maps represents a composing
character.</p>
</div>
</div>
<div class="div3">
<h4><a name="XML_MEDIA-TYPE" id="XML_MEDIA-TYPE"></a>5.1.9 XML
Output Method: the <code>media-type</code> Parameter</h4>
<p>The <code>media-type</code> parameter is applicable to the XML
output method. See <a href="#serparam"><b>3 Serialization
Parameters</b></a> for more information.</p>
</div>
<div class="div3">
<h4><a name="XML_USE-CHARACTER-MAPS" id=
"XML_USE-CHARACTER-MAPS"></a>5.1.10 XML Output Method: the
<code>use-character-maps</code> Parameter</h4>
<p>The <code>use-character-maps</code> parameter is applicable to
the XML output method. The result of serialization using the XML
output method is not guaranteed to be well-formed XML if character
maps have been specified. See <a href="#character-maps"><b>9
Character Maps</b></a> for more information.</p>
</div>
<div class="div3">
<h4><a name="XML_BYTE-ORDER-MARK" id=
"XML_BYTE-ORDER-MARK"></a>5.1.11 XML Output Method: the
<code>byte-order-mark</code> Parameter</h4>
<p>The <code>byte-order-mark</code> parameter is applicable to the
XML output method. See <a href="#serparam"><b>3 Serialization
Parameters</b></a> for more information.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>The byte order mark may be undesirable under certain
circumstances; for example, to concatenate resulting XML fragments
without additional processing to remove the byte order mark.
Therefore this specification does not mandate the
<code>byte-order-mark</code> parameter to have the value
<code>yes</code> when the encoding is UTF-16, even though the XML
1.0 and XML 1.1 specifications state that entities encoded in
UTF-16 must begin with a byte order mark. Consequently, this
specification does not guarantee that the resulting XML fragment,
without a byte order mark, will not cause an error when processed
by a conforming XML processor.</p>
</div>
</div>
<div class="div3">
<h4><a name="XML_ESCAPE-URI-ATTRIBUTES" id=
"XML_ESCAPE-URI-ATTRIBUTES"></a>5.1.12 XML Output Method: the
<code>escape-uri-attributes</code> Parameter</h4>
<p>The <code>escape-uri-attributes</code> parameter is not
applicable to the XML output method. It is the responsibility of
the <a title="host language" href="#host-language">host
language</a> to specify whether an error occurs if this parameter
is specified in combination with the XML output method, or if the
parameter is simply dropped.</p>
</div>
<div class="div3">
<h4><a name="XML_INCLUDE-CONTENT-TYPE" id=
"XML_INCLUDE-CONTENT-TYPE"></a>5.1.13 XML Output Method: the
<code>include-content-type</code> Parameter</h4>
<p>The <code>include-content-type</code> parameter is not
applicable to the XML output method. It is the responsibility of
the <a title="host language" href="#host-language">host
language</a> to specify whether an error occurs if this parameter
is specified in combination with the XML output method, or if the
parameter is simply dropped.</p>
</div>
</div>
</div>
<div class="div1">
<h2><a name="xhtml-output" id="xhtml-output"></a>6 XHTML Output
Method</h2>
<p>The XHTML output method serializes the instance of the data
model as XML, using the HTML compatibility guidelines defined in
the XHTML specification.</p>
<p>It is entirely the responsibility of the person or process that
creates the instance of the data model to ensure that the instance
of the data model conforms to the <a href="#xhtml1">[XHTML 1.0]</a>
or <a href="#xhtml11">[XHTML 1.1]</a> specification. It is not an
error if the instance of the data model is invalid XHTML. Equally,
it is entirely under the control of the person or process that
creates the instance of the data model whether the output conforms
to XHTML 1.0 Strict, XHTML 1.0 Transitional, or any other specific
definition of XHTML.</p>
<p>The serialization of the instance of the data model follows the
same rules as for the XML output method, with the general
exceptions noted below and parameter-specific exceptions in
<a href="#XHTML_PARAMS"><b>6.1 The Influence of Serialization
Parameters upon the XHTML Output Method</b></a>. These differences
are based on the HTML compatibility guidelines published in
Appendix C of <a href="#xhtml1">[XHTML 1.0]</a>, which are designed
to ensure that as far as possible, XHTML is rendered correctly on
user agents designed originally to handle HTML.</p>
<ul>
<li>
<p>[<a name="XHTMLEMPTY" id="XHTMLEMPTY" title=
"EMPTY">Definition</a>: The following XHTML elements have an
<b>EMPTY</b> content model: <code>area</code>, <code>base</code>,
<code>br</code>, <code>col</code>, <code>hr</code>,
<code>img</code>, <code>input</code>, <code>link</code>,
<code>meta</code>, <code>basefont</code>, <code>frame</code>,
<code>isindex</code>, and <code>param</code>.] Given an empty
instance of an XHTML element whose content model is not <a title=
"EMPTY" href="#XHTMLEMPTY">EMPTY</a> (for example, an empty title
or paragraph) the <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST NOT</strong> use the
minimized form. That is, it <strong>MUST</strong> output
<code>&lt;p&gt;&lt;/p&gt;</code> and not
<code>&lt;p&#160;/&gt;</code>.</p>
</li>
<li>
<p><span>If an element that has no children is an XHTML element
with an <a title="EMPTY" href="#XHTMLEMPTY">EMPTY</a> content
model,</span> the <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST</strong> use the
minimized tag syntax, for example <code>&lt;br&#160;/&gt;</code>,
as the alternative syntax <code>&lt;br&gt;&lt;/br&gt;</code>
allowed by XML gives uncertain results in many existing user
agents. The <a title="serializer" href="#serializer">serializer</a>
<strong>MUST</strong> include a space before the trailing
<code>/&gt;</code>, e.g. <code>&lt;br&#160;/&gt;</code>,
<code>&lt;hr&#160;/&gt;</code> and
<code>&lt;img&#160;src="karen.jpg"&#160;alt="Karen"&#160;/&gt;</code>.</p>
</li>
<li>
<p>The <a title="serializer" href="#serializer">serializer</a>
<strong>MUST NOT</strong> use the entity reference
<code>&amp;apos;</code> which, although <span>defined</span> in XML
and therefore in XHTML, is not defined in HTML and is not
recognized by all HTML user agents.</p>
</li>
<li>
<p>The <a title="serializer" href="#serializer">serializer</a>
<strong>SHOULD</strong> output namespace declarations in a way that
is consistent with the requirements of the XHTML DTD if this is
possible. The XHTML 1.0 DTDs require the declaration
<code>xmlns="http://www.w3.org/1999/xhtml"</code> to appear on the
<code>html</code> element, and only on the <code>html</code>
element. The <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST</strong> output namespace
declarations that are consistent with the namespace <a title="node"
href="#dt-node">nodes</a> present in the <a title="result tree"
href="#result-tree">result tree</a>, but it <strong>MUST</strong>
avoid outputting redundant namespace declarations on elements where
the DTD would make them invalid.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>If the <code>html</code> element is generated by an XSLT literal
result element of the form <code>&lt;html
xmlns="http://www.w3.org/1999/xhtml"&gt; ... &lt;/html&gt;</code>,
or by an XQuery direct element constructor of the same form, then
the <code>html</code> element in the result document will have a
<a title="node" href="#dt-node">node</a> name whose prefix is "",
which will satisfy the requirements of the DTD. In other cases the
prefix assigned to the element is implementation-dependent.</p>
</div>
</li>
</ul>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Appendix C of <a href="#xhtml1">[XHTML 1.0]</a> describes a
number of compatibility guidelines for users of XHTML who wish to
render their XHTML documents with HTML user agents. In some cases,
such as the guideline on the form empty elements should take, only
the serialization process itself has the ability to follow the
guideline. In such cases, those guidelines are reflected in the
requirements on the <a title="serializer" href=
"#serializer">serializer</a> described above.</p>
<p>In all other cases, the guidelines can be adhered to by the
instance of the data model that is input to the serialization
process. The guideline on the use of whitespace characters in
attribute values is one such example. Another example is that
<code>xml:lang="..."</code> does not serialize to both
<code>xml:lang="..."</code> and <code>lang="..."</code> as required
by some legacy user agents. It is the responsibility of the person
or process that creates the instance of the data model that is
input to the serialization process to ensure it is created in a way
that is consistent with the guidelines. No <a title=
"serialization error" href="#serial-err">serialization error</a>
results if the input instance of the data model does not adhere to
the guidelines.</p>
</div>
<div class="div2">
<h3><a name="XHTML_PARAMS" id="XHTML_PARAMS"></a>6.1 The Influence
of Serialization Parameters upon the XHTML Output Method</h3>
<div class="div3">
<h4><a name="XHTML_VERSION" id="XHTML_VERSION"></a>6.1.1 XHTML
Output Method: the <code>version</code> Parameter</h4>
<p>The behavior for <code>version</code> parameter for the XHTML
output method is described in <a href="#XML_VERSION"><b>5.1.1 XML
Output Method: the version Parameter</b></a>.</p>
</div>
<div class="div3">
<h4><a name="XHTML_ENCODING" id="XHTML_ENCODING"></a>6.1.2 XHTML
Output Method: the <code>encoding</code> Parameter</h4>
<p>The behavior for <code>encoding</code> parameter for the XHTML
output method is described in <a href="#XML_ENCODING"><b>5.1.2 XML
Output Method: the encoding Parameter</b></a>.</p>
</div>
<div class="div3">
<h4><a name="XHTML_INDENT" id="XHTML_INDENT"></a>6.1.3 XHTML Output
Method: the <code>indent</code> <span>and
<code>suppress-indentation</code></span> Parameters</h4>
<p>If the <code>indent</code> parameter has the value
<code>yes</code>, the serializer <strong>MAY</strong> add or remove
whitespace as it serializes the <a title="result tree" href=
"#result-tree">result tree</a>, <span>if it observes the following
constraints.</span></p>
<ul>
<li>
<p><span>Whitespace <strong>MUST NOT</strong> be added other than
before or after an element, or adjacent to an existing whitespace
character.</span></p>
</li>
<li>
<p><span>Whitespace <strong>MUST NOT</strong> be added or removed
adjacent to an inline element. The inline elements are those
elements in the XHTML namespace in the %inline category of any of
the XHTML 1.0 DTD's, in the %inline.class category of the XHTML 1.1
DTD, and elements in the XHTML namespace with local names
<code>ins</code> and <code>del</code> if they are used as inline
elements (i.e., if they do not contain element
children).</span></p>
</li>
<li>
<p><span>Whitespace <strong>MUST NOT</strong> be added or removed
inside a formatted element, the formatted elements being those in
the XHTML namespace with local names <code>pre</code>,
<code>script</code>, <code>style</code>, and
<code>textarea</code>.</span></p>
</li>
<li>
<p>Whitespace characters <strong>MUST NOT</strong> be added in the
content of an element whose expanded QName is a member of the list
of expanded QNames in the value of the
<code>suppress-indentation</code> parameter.</p>
</li>
</ul>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p><span>The effect of the above constraints is to ensure any
insertion or deletion of whitespace would not affect how a
conforming HTML user agent would render the output, assuming the
serialized document does not refer to any HTML style
sheets.</span></p>
<p>The HTML definition of whitespace is different from the XML
definition: see section 9.1 of <a href="#html401">[HTML]</a> 4.01
specification.</p>
</div>
</div>
<div class="div3">
<h4><a name="XHTML_CDATA-SECTION-ELEMENTS" id=
"XHTML_CDATA-SECTION-ELEMENTS"></a>6.1.4 XHTML Output Method: the
<code>cdata-section-elements</code> Parameter</h4>
<p>The behavior for <code>cdata-section-elements</code> parameter
for the XHTML output method is described in <a href=
"#XML_CDATA-SECTION-ELEMENTS"><b>5.1.4 XML Output Method: the
cdata-section-elements Parameter</b></a>.</p>
</div>
<div class="div3">
<h4><a name="XHTML_OMIT-XML-DECLARATION" id=
"XHTML_OMIT-XML-DECLARATION"></a>6.1.5 XHTML Output Method: the
<code>omit-xml-declaration</code> and <code>standalone</code>
Parameters</h4>
<p>The behavior for <code>omit-xml-declaration</code> and
<code>standalone</code> parameters for the XHTML output method is
described in <a href="#XML_OMIT-XML-DECLARATION"><b>5.1.5 XML
Output Method: the omit-xml-declaration and standalone
Parameters</b></a>.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>As with the XML output method, the XHTML output method specifies
that an XML declaration will be output unless it is suppressed
using the <code>omit-xml-declaration</code> parameter. Appendix C.1
of <a href="#xhtml1">[XHTML 1.0]</a> provides advice on the
consequences of including, or omitting, the XML declaration.</p>
</div>
</div>
<div class="div3">
<h4><a name="XHTML_DOCTYPE" id="XHTML_DOCTYPE"></a>6.1.6 XHTML
Output Method: the <code>doctype-system</code> and
<code>doctype-public</code> Parameters</h4>
<p>The behavior for <code>doctype-system</code> and
<code>doctype-public</code> parameters for the XHTML output method
is described in <a href="#XML_DOCTYPE"><b>5.1.6 XML Output Method:
the doctype-system and doctype-public Parameters</b></a>.</p>
</div>
<div class="div3">
<h4><a name="XHTML_UNDECLARE-PREFIXES" id=
"XHTML_UNDECLARE-PREFIXES"></a>6.1.7 XHTML Output Method: the
<code>undeclare-prefixes</code> Parameter</h4>
<p>The behavior for <code>undeclare-prefixes</code> parameter for
the XHTML output method is described in <a href=
"#xml-undeclare-NS"><b>5.1.7 XML Output Method: the
undeclare-prefixes Parameter</b></a>.</p>
</div>
<div class="div3">
<h4><a name="XHTML_NORMALIZATION-FORM" id=
"XHTML_NORMALIZATION-FORM"></a>6.1.8 XHTML Output Method: the
<code>normalization-form</code> Parameter</h4>
<p>The behavior for <code>normalization-form</code> parameter for
the XHTML output method is described in <a href=
"#XML_NORMALIZATION-FORM"><b>5.1.8 XML Output Method: the
normalization-form Parameter</b></a>.</p>
</div>
<div class="div3">
<h4><a name="XHTML_MEDIA-TYPE" id="XHTML_MEDIA-TYPE"></a>6.1.9
XHTML Output Method: the <code>media-type</code> Parameter</h4>
<p>The behavior for <code>media-type</code> parameter for the XHTML
output method is described in <a href="#XML_MEDIA-TYPE"><b>5.1.9
XML Output Method: the media-type Parameter</b></a>.</p>
</div>
<div class="div3">
<h4><a name="XHTML_USE-CHARACTER-MAPS" id=
"XHTML_USE-CHARACTER-MAPS"></a>6.1.10 XHTML Output Method: the
<code>use-character-maps</code> Parameter</h4>
<p>The behavior for <code>use-character-maps</code> parameter for
the XHTML output method is described in <a href=
"#XML_USE-CHARACTER-MAPS"><b>5.1.10 XML Output Method: the
use-character-maps Parameter</b></a>.</p>
</div>
<div class="div3">
<h4><a name="XHTML_BYTE-ORDER-MARK" id=
"XHTML_BYTE-ORDER-MARK"></a>6.1.11 XHTML Output Method: the
<code>byte-order-mark</code> Parameter</h4>
<p>The behavior for <code>byte-order-mark</code> parameter for the
XHTML output method is described in <a href=
"#XML_BYTE-ORDER-MARK"><b>5.1.11 XML Output Method: the
byte-order-mark Parameter</b></a>.</p>
</div>
<div class="div3">
<h4><a name="XHTML_ESCAPE-URI-ATTRIBUTES" id=
"XHTML_ESCAPE-URI-ATTRIBUTES"></a>6.1.12 XHTML Output Method: the
<code>escape-uri-attributes</code> Parameter</h4>
<p>If the <code>escape-uri-attributes</code> parameter has the
value <code>yes</code>, the XHTML output method
<strong>MUST</strong> apply <a title="URI Escaping" href=
"#uri-escaping">URI escaping</a> to <a title="URI attribute values"
href="#uri-attribute-values">URI attribute values</a>, except that
relative URIs <strong>MUST NOT</strong> be absolutized.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>This escaping is deliberately confined to non-ASCII characters,
because escaping of ASCII characters is not always appropriate, for
example when URIs or URI fragments are interpreted locally by the
HTML user agent. Even in the case of non-ASCII characters, escaping
can sometimes cause problems. More precise control of <a title=
"URI Escaping" href="#uri-escaping">URI escaping</a> is therefore
available by setting <code>escape-uri-attributes</code> to
<code>no</code>, and controlling the escaping of URIs by using
methods defined in <a href=
"http://www.w3.org/TR/xpath-functions-30/#func-encode-for-uri">Section
6.2 fn:encode-for-uri</a> <sup><small>FO30</small></sup> and
<a href=
"http://www.w3.org/TR/xpath-functions-30/#func-iri-to-uri">Section
6.3 fn:iri-to-uri</a> <sup><small>FO30</small></sup>.</p>
</div>
</div>
<div class="div3">
<h4><a name="XHTML_INCLUDE-CONTENT-TYPE" id=
"XHTML_INCLUDE-CONTENT-TYPE"></a>6.1.13 XHTML Output Method: the
<code>include-content-type</code> Parameter</h4>
<p>If the instance of the data model includes a <code>head</code>
element in the XHTML namespace, and the
<code>include-content-type</code> parameter has the value
<code>yes</code>, the XHTML output method <strong>MUST</strong> add
a <code>meta</code> element as the first child element of the
<code>head</code> element, specifying the character encoding
actually used.</p>
<div class="exampleOuter">
<p>For example,</p>
<div class="exampleInner">
<pre>
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" /&gt;
...
</pre></div>
</div>
<p>The content type <strong>SHOULD</strong> be set to the value
given for the <code>media-type</code> parameter.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>It is recommended that the <a title="host language" href=
"#host-language">host language</a> use as default value for this
parameter one of the MIME types (<a href="#RFC2046">[RFC2046]</a>)
registered for XHTML. Currently, these are <code>text/html</code>
(registered by <a href="#RFC2854">[RFC2854]</a>) and
<code>application/xhtml+xml</code> (registered by <a href=
"#RFC3236">[RFC3236]</a>). Note that some user agents fail to
recognize the charset parameter if the content type is not
<code>text/html</code>.</p>
</div>
<p>If a <code>meta</code> element has been added to the
<code>head</code> element as described above, then any existing
<code>meta</code> element child of the <code>head</code> element
having an <code>http-equiv</code> attribute with the value
"Content-Type", making the comparison <span><a title=
"without regard to case" href="#caseless-compare">without regard to
case</a> after first stripping leading and trailing spaces from the
value of the attribute solely for the purposes of
comparison,</span> <strong>MUST</strong> be discarded.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>This process removes possible parameters in the attribute value.
For example,</p>
<div class="exampleInner">
<pre>
&lt;meta http-equiv="Content-Type" content="text/html;version='3.0'" /&gt;
</pre></div>
<p>in the data model instance would be replaced by,</p>
<div class="exampleInner">
<pre>
&lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;
</pre></div>
</div>
</div>
</div>
</div>
<div class="div1">
<h2><a name="html-output" id="html-output"></a>7 HTML Output
Method</h2>
<p>The HTML output method serializes the instance of the data model
as HTML.</p>
<div class="exampleOuter">
<p>For example, the following XSL stylesheet generates html
output,</p>
<div class="exampleInner">
<pre>
&lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
&lt;xsl:output method="html" version="4.0"/&gt;
&lt;xsl:template match="/"&gt;
&lt;html&gt;
&lt;xsl:apply-templates/&gt;
&lt;/html&gt;
&lt;/xsl:template&gt;
...
&lt;/xsl:stylesheet&gt;
</pre></div>
</div>
<p>In the example, the <code>version</code> attribute of the
<code>xsl:output</code> element indicates the version of the HTML
Recommendation <a href="#html401">[HTML]</a> to which the
serialized result is to conform.</p>
<p>It is entirely the responsibility of the person or process that
creates the instance of the data model to ensure that the instance
of the data model conforms to the HTML Recommendation <a href=
"#html401">[HTML]</a>. It is not an error if the instance of the
data model is invalid HTML. Equally, it is entirely under the
control of the person or process that creates the instance of the
data model whether the output conforms to HTML. <span>If the result
tree is valid HTML, the serializer <strong>MUST</strong> serialize
the result in a way that conforms with the version of HTML
specified by the <code>version</code> serialization
parameter.</span></p>
<table border="1" summary="Editorial note">
<tr>
<td align="left" valign="top" width="50%"><b>Editorial
note</b></td>
<td align="right" valign="top" width="50%">&#160;</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">Need to take into account
HTML 5.0, per request made in <a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=6129">Bugzilla bug
6129</a>.</td>
</tr>
</table>
<div class="div2">
<h3><a name="HTML_MARKUP" id="HTML_MARKUP"></a>7.1 Markup for
Elements</h3>
<p><span>As is described in detail below, the</span> HTML output
method <span>will not</span> output an element differently from the
XML output method unless the expanded QName of the element has a
<a title="null namespace URI" href="#null-namespace-URI">null
namespace URI</a>. [<a name="XML-ISLAND" id="XML-ISLAND" title=
"XML Island">Definition</a>: The portion of the serialized document
representing the result of serializing an element whose expanded
QName does not have a <a title="null namespace URI" href=
"#null-namespace-URI">null namespace URI</a>, is known as an <b>XML
Island.</b>] If the expanded QName of the element has a <a title=
"null namespace URI" href="#null-namespace-URI">null namespace
URI</a>, but the local part of the expanded QName is not recognized
as the name of an HTML element, the element <strong>MUST</strong>
be output in the same way as a non-empty, inline element such as
<code>span</code>. In particular:</p>
<ol class="enumar">
<li>
<p>If the <a title="result tree" href="#result-tree">result
tree</a> contains namespace <a title="node" href=
"#dt-node">nodes</a> for namespaces other than the XML namespace,
the HTML output method <strong>MUST</strong> represent these
namespaces using attributes named <code>xmlns</code> or
<code>xmlns:</code><em>prefix</em> in the same way as the XML
output method would represent them when the <code>version</code>
parameter is set to <code>1.0</code>.</p>
</li>
<li>
<p>If the <a title="result tree" href="#result-tree">result
tree</a> contains elements or attributes whose names have a
<a title="non-null namespace URI" href=
"#non-null-namespace-URI">non-null namespace URI</a>, the HTML
output method <strong>MUST</strong> generate namespace-prefixed
QNames for these <a title="node" href="#dt-node">nodes</a> in the
same way as the XML output method would do when the
<code>version</code> parameter is set to <code>1.0</code>.</p>
</li>
<li>
<p>Where special rules are defined later in this section for
serializing specific HTML elements and attributes, these rules
<strong>MUST NOT</strong> be applied to an element or attribute
whose name has a <a title="non-null namespace URI" href=
"#non-null-namespace-URI">non-null namespace URI</a>. However, the
generic rules for the HTML output method that apply to all elements
and attributes, for example the rules for escaping special
characters in the text and the rules for indentation,
<strong>MUST</strong> be used also for namespaced elements and
attributes.</p>
</li>
<li>
<p>When serializing an element whose name is not defined in the
HTML specification, but that is in the null namespace, the HTML
output method <strong>MUST</strong> apply the same rules (for
example, indentation rules) as when serializing a <code>span</code>
element. The descendants of such an element <strong>MUST</strong>
be serialized as if they were descendants of a <code>span</code>
element.</p>
</li>
<li>
<p>When serializing an element whose name is in a non-null
namespace, the HTML output method <strong>MUST</strong> apply the
same rules (for example, indentation rules) as when serializing a
<code>div</code> element. The descendants of such an element
<strong>MUST</strong> be serialized as if they were descendants of
a <code>div</code> element. <span>, except for the influence of the
<code>cdata-section-elements</code> serialization parameter on any
text node children of the element.</span></p>
</li>
</ol>
<p>The HTML output method <strong>MUST NOT</strong> output an
end-tag for an <span>empty element if the element type has an empty
content model.</span> For HTML 4.0, the <span>element types that
have an empty content model are</span> <code>area</code>,
<code>base</code>, <code>basefont</code>, <code>br</code>,
<code>col</code>, <code>frame</code>, <code>hr</code>,
<code>img</code>, <code>input</code>, <code>isindex</code>,
<code>link</code>, <code>meta</code> and <code>param</code>. For
example, an element written as <code>&lt;br/&gt;</code> or
<code>&lt;br&gt;&lt;/br&gt;</code> in an XSLT stylesheet
<strong>MUST</strong> be output as <code>&lt;br&gt;</code>.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>The markup generation step of the <a title="" href=
"#serphases">phases of serialization</a> only creates start tags
and end tags for the HTML output method, never XML-style empty
element tags. As such, a serializer MUST serialize an HTML element
that has no children, but whose content model is not empty, using a
pair of adjacent start and end element tags, or as a solitary start
tag if the permitted by the context.</p>
</div>
<p>The HTML output method <strong>MUST</strong> recognize the names
of HTML elements <span>making the comparison <a title=
"without regard to case" href="#caseless-compare">without regard to
case</a>.</span> For example, elements named <code>br</code>,
<code>BR</code> or <code>Br</code> <strong>MUST</strong> all be
recognized as the HTML <code>br</code> element and output without
an end-tag.</p>
<p>The HTML output method <strong>MUST NOT</strong> perform
escaping for <span>any text node descendant, nor for any attribute
of an element node descendant,</span> of <span>a</span>
<code>script</code> <span>or</span> <code>style</code>
<span>element</span>.</p>
<div class="exampleOuter">
<p>For example, a <code>script</code> element created by an XQuery
direct element constructor or an XSLT literal result element, such
as:</p>
<div class="exampleInner">
<pre>
&lt;script&gt;if (a &amp;lt; b) foo()&lt;/script&gt;
</pre></div>
<p>or</p>
<div class="exampleInner">
<pre>
&lt;script&gt;&lt;![CDATA[if (a &lt; b) foo()]]&gt;&lt;/script&gt;
</pre></div>
<p><strong>MUST</strong> be output as</p>
<div class="exampleInner">
<pre>
&lt;script&gt;if (a &lt; b) foo()&lt;/script&gt;
</pre></div>
</div>
<div class="exampleOuter">
<p>A common requirement is to output a <code>script</code> element
as shown in the example below:</p>
<div class="exampleInner">
<pre>
&lt;script type="application/ecmascript"&gt;
document.write ("&lt;em&gt;This won't work&lt;/em&gt;")
&lt;/script&gt;
</pre></div>
<p>This is <span>invalid</span> HTML, for the reasons explained in
section B.3.2 of the <a href="#html401">[HTML]</a> 4.01
specification. Nevertheless, it is possible to output this
fragment, using either of the following constructs:</p>
<p>Firstly, by use of a <code>script</code> element created by an
XQuery direct element constructor or an XSLT literal result
element:</p>
<div class="exampleInner">
<pre>
&lt;script type="application/ecmascript"&gt;
document.write ("&lt;em&gt;This won't work&lt;/em&gt;")
&lt;/script&gt;
</pre></div>
<p>Secondly, by constructing the markup from ordinary text
characters:</p>
<div class="exampleInner">
<pre>
&lt;script type="application/ecmascript"&gt;
document.write ("&amp;lt;em&amp;gt;This won't work&amp;lt;/em&amp;gt;")
&lt;/script&gt;
</pre></div>
<p>As the <a href="#html401">[HTML]</a> specification points out,
the correct way to write this is to use the escape conventions for
the specific scripting language. For JavaScript, it can be written
as:</p>
<div class="exampleInner">
<pre>
&lt;script type="application/ecmascript"&gt;
document.write ("&amp;lt;em&amp;gt;This will work&amp;lt;\/em&amp;gt;")
&lt;/script&gt;
</pre></div>
<p>The <a href="#html401">[HTML]</a> 4.01 specification also shows
examples of how to write this in various other scripting languages.
The escaping <strong>MUST</strong> be done manually; it will not be
done by the <a title="serializer" href=
"#serializer">serializer</a>.</p>
</div>
</div>
<div class="div2">
<h3><a name="HTML_ATTRIBS" id="HTML_ATTRIBS"></a>7.2 Writing
Attributes</h3>
<p>The HTML output method <strong>MUST NOT</strong> escape
"<code>&lt;</code>" characters occurring in attribute values.</p>
<p>A boolean attribute is an attribute with only a single allowed
value in any of the HTML DTDs, where the allowed value is equal
without regard to case to the name of the attribute. The HTML
output method MUST output any boolean attribute in minimized form
if and only if the value of the attribute node actually is equal to
the name of the attribute <span>making the comparison <a title=
"without regard to case" href="#caseless-compare">without regard to
case</a></span>.</p>
<div class="exampleOuter">
<p>For example, a start-tag created using the following XQuery
direct element constructor or XSLT literal result element</p>
<div class="exampleInner">
<pre>
&lt;OPTION selected="selected"&gt;
</pre></div>
<p><strong>MUST</strong> be output as</p>
<div class="exampleInner">
<pre>
&lt;OPTION selected&gt;
</pre></div>
</div>
<p>The HTML output method <strong>MUST NOT</strong> escape a
<code>&amp;</code> character occurring in an attribute value
immediately followed by a <code>{</code> character (see <a href=
"http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.7.1.1">Section
B.7.1</a> of the HTML Recommendation <a href=
"#html401">[HTML]</a>).</p>
<div class="exampleOuter">
<p>For example, a start-tag created using the following XQuery
direct element constructor or XSLT literal result element</p>
<div class="exampleInner">
<pre>
&lt;BODY bgcolor='&amp;amp;{{randomrbg}};'&gt;
</pre></div>
<p><strong>MUST</strong> be output as</p>
<div class="exampleInner">
<pre>
&lt;BODY bgcolor='&amp;{randomrbg};'&gt;
</pre></div>
</div>
<p>See <a href="#HTML_PARAMS"><b>7.4 The Influence of Serialization
Parameters upon the HTML Output Method</b></a> for additional
directives on how attributes may be written.</p>
</div>
<div class="div2">
<h3><a name="HTML_CHARDATA" id="HTML_CHARDATA"></a>7.3 Writing
Character Data</h3>
<p>The HTML output method <strong>MAY</strong> output a character
using a character entity reference in preference to using a numeric
character reference, if an entity is defined for the character in
the version of HTML that the output method is using. Entity
references and character references <strong>SHOULD</strong> be used
only where the character is not present in the selected encoding,
or where the visual representation of the character is unclear (as
with <code>&amp;nbsp;</code>, for example).</p>
<p>When outputting a sequence of whitespace characters in the
instance of the data model, within an element where whitespace is
treated normally (but not in elements such as <code>pre</code> and
<code>textarea</code>), the HTML output method <strong>MAY</strong>
represent it using any sequence of whitespace that will be treated
in the same way by an HTML user agent. See section 3.5 of <a href=
"#xhtml-modularization">[XHTML Modularization]</a> for some
additional information on handling of whitespace by an HTML user
agent.</p>
<p>Certain characters are <span>permitted</span> in XML, but not in
HTML <span>— for example, the control characters #x7F-#x9F, are
<span>permitted</span> in both XML 1.0 and XML 1.1, and the control
characters #x1-#x8, #xB, #xC and #xE-#x1F are
<span>permitted</span> in XML 1.1, but none of these is permitted
in HTML</span>. It is a <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSERE0014"
title="err:SERE0014">err:SERE0014</a>] to use the HTML output
method when such characters appear in the instance of the data
model. The <a title="serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal the error.</p>
<p>The HTML output method <strong>MUST</strong> terminate
processing instructions with <code>&gt;</code> rather than
<code>?&gt;</code>. It is a <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSERE0015"
title="err:SERE0015">err:SERE0015</a>] to use the HTML output
method when <code>&gt;</code> appears within a processing
instruction in the data model instance being serialized.</p>
</div>
<div class="div2">
<h3><a name="HTML_PARAMS" id="HTML_PARAMS"></a>7.4 The Influence of
Serialization Parameters upon the HTML Output Method</h3>
<div class="div3">
<h4><a name="HTML_VERSION" id="HTML_VERSION"></a>7.4.1 HTML Output
Method: the <code>version</code> Parameter</h4>
<p>The <code>version</code> attribute indicates the version of the
HTML Recommendation <a href="#html401">[HTML]</a> to which the
serialized result is to conform. If the <a title="serializer" href=
"#serializer">serializer</a> does not support the version of HTML
specified by this parameter, it <strong>MUST</strong> signal a
<a title="serialization error" href="#serial-err">serialization
error</a> [<a href="#ERRSESU0013" title=
"err:SESU0013">err:SESU0013</a>].</p>
<p>This document provides the normative definition of serialization
for the HTML output method if the version parameter has the lexical
form of a value of type decimal whose value is 1.0 or greater, but
no greater than 4.01. For any other value of version parameter, the
behavior is <a title="implementation-defined" href=
"#impdef">implementation-defined</a>. In that case the <a title=
"implementation-defined" href="#impdef">implementation-defined</a>
behavior <strong>MAY</strong> supersede all other requirements of
this recommendation.</p>
</div>
<div class="div3">
<h4><a name="HTML_ENCODING" id="HTML_ENCODING"></a>7.4.2 HTML
Output Method: the <code>encoding</code> Parameter</h4>
<p>The <code>encoding</code> parameter specifies the encoding to be
used. <a title="serializer" href="#serializer">Serializers</a> are
<strong>REQUIRED</strong> to support values of <code>UTF-8</code>
and <code>UTF-16</code>. A <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSESU0007"
title="err:SESU0007">err:SESU0007</a>] occurs if an output encoding
other than <code>UTF-8</code> or <code>UTF-16</code> is requested
and the <a title="serializer" href="#serializer">serializer</a>
does not support that encoding. The <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST</strong> signal the
error.</p>
<p>It is possible that the instance of the data model will contain
a character that cannot be represented in the encoding that the
<a title="serializer" href="#serializer">serializer</a> is using
for output. In this case, if the character occurs in a context
where HTML recognizes character references, then the character
<strong>MUST</strong> be output as a character entity reference or
decimal numeric character reference; otherwise (for example, in a
<code>script</code> or <code>style</code> element or in a comment),
the <a title="serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal a <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSERE0008"
title="err:SERE0008">err:SERE0008</a>].</p>
<p>See <a href="#HTML_INCLUDE-CONTENT-TYPE"><b>7.4.13 HTML Output
Method: the include-content-type Parameter</b></a> regarding how
this parameter is used with the <code>include-content-type</code>
parameter.</p>
</div>
<div class="div3">
<h4><a name="HTML_INDENT" id="HTML_INDENT"></a>7.4.3 HTML Output
Method: the <code>indent</code> <span>and
<code>suppress-indentation</code></span> Parameters</h4>
<p>If the <code>indent</code> parameter has the value
<code>yes</code>, then the HTML output method <strong>MAY</strong>
add or remove whitespace as it serializes the <a title=
"result tree" href="#result-tree">result tree</a>, <span>if it
observes the following constraints.</span></p>
<ul>
<li>
<p><span>Whitespace <strong>MUST NOT</strong> be added other than
before or after an element, or adjacent to an existing whitespace
character.</span></p>
</li>
<li>
<p><span>Whitespace <strong>MUST NOT</strong> be added or removed
adjacent to an inline element. The inline elements are those
included in the <code>%inline</code> category of any of the HTML
4.01 DTD's, as well as the <code>ins</code> and <code>del</code>
elements if they are used as inline elements (i.e., if they do not
contain element children).</span></p>
</li>
<li>
<p><span>Whitespace <strong>MUST NOT</strong> be added or removed
inside a formatted element, the formatted elements being
<code>pre</code>, <code>script</code>, <code>style</code>, and
<code>textarea</code>.</span></p>
</li>
<li>
<p>Whitespace characters <strong>MUST NOT</strong> be added in the
content of an element whose expanded QName is a member of the list
of expanded QNames in the value of the
<code>suppress-indentation</code> parameter.</p>
</li>
</ul>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p><span>The effect of the above constraints is to ensure any
insertion or deletion of whitespace would not affect how a
conforming HTML user agent would render the output, assuming the
serialized document does not refer to any HTML style
sheets.</span></p>
<p>Note that the HTML definition of whitespace is different from
the XML definition (see section 9.1 of the <a href=
"#html401">[HTML]</a> specification).</p>
</div>
</div>
<div class="div3">
<h4><a name="HTML_CDATA-SECTION-ELEMENTS" id=
"HTML_CDATA-SECTION-ELEMENTS"></a>7.4.4 HTML Output Method: the
<code>cdata-section-elements</code> Parameter</h4>
<p>The <code>cdata-section-elements</code> parameter is not
applicable to the HTML output method, except in the case of
<a title="XML Island" href="#XML-ISLAND">XML Islands</a>.</p>
</div>
<div class="div3">
<h4><a name="HTML_OMIT-XML-DECLARATION" id=
"HTML_OMIT-XML-DECLARATION"></a>7.4.5 HTML Output Method: the
<code>omit-xml-declaration</code> and <code>standalone</code>
Parameters</h4>
<p>The <code>omit-xml-declaration</code> and
<code>standalone</code> parameters are not applicable to the HTML
output method.</p>
</div>
<div class="div3">
<h4><a name="HTML_DOCTYPE" id="HTML_DOCTYPE"></a>7.4.6 HTML Output
Method: the <code>doctype-system</code> and
<code>doctype-public</code> Parameters</h4>
<p>If the <code>doctype-public</code> or
<code>doctype-system</code> parameters are specified, then the HTML
output method <strong>MUST</strong> output a document type
declaration immediately before the first element. The name
following <code>&lt;!DOCTYPE</code> <strong>MUST</strong> be
<code>HTML</code> or <code>html</code>. If the
<code>doctype-public</code> parameter is specified, then the output
method <strong>MUST</strong> output <code>PUBLIC</code> followed by
the specified public identifier; if the <code>doctype-system</code>
parameter is also specified, it <strong>MUST</strong> also output
the specified system identifier following the public identifier. If
the <code>doctype-system</code> parameter is specified but the
<code>doctype-public</code> parameter is not specified, then the
output method <strong>MUST</strong> output <code>SYSTEM</code>
followed by the specified system identifier.</p>
</div>
<div class="div3">
<h4><a name="HTML_UNDECLARE-PREFIXES" id=
"HTML_UNDECLARE-PREFIXES"></a>7.4.7 HTML Output Method: the
<code>undeclare-prefixes</code> Parameter</h4>
<p>The <code>undeclare-prefixes</code> parameter is not applicable
to the HTML output method.</p>
</div>
<div class="div3">
<h4><a name="HTML_NORMALIZATION-FORM" id=
"HTML_NORMALIZATION-FORM"></a>7.4.8 HTML Output Method: the
<code>normalization-form</code> Parameter</h4>
<p>The <code>normalization-form</code> parameter is applicable to
the HTML output method. The values <code>NFC</code> and
<code>none</code> <strong>MUST</strong> be supported by the
<a title="serializer" href="#serializer">serializer</a>. A
<a title="serialization error" href="#serial-err">serialization
error</a> [<a href="#ERRSESU0011" title=
"err:SESU0011">err:SESU0011</a>] results if the value of the
<code>normalization-form</code> parameter specifies a normalization
form that is not supported by the <a title="serializer" href=
"#serializer">serializer</a>; the <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST</strong> signal the
error.</p>
</div>
<div class="div3">
<h4><a name="HTML_MEDIA-TYPE" id="HTML_MEDIA-TYPE"></a>7.4.9 HTML
Output Method: the <code>media-type</code> Parameter</h4>
<p>The <code>media-type</code> parameter is applicable to the HTML
output method. See <a href="#serparam"><b>3 Serialization
Parameters</b></a> for more information. See <a href=
"#HTML_INCLUDE-CONTENT-TYPE"><b>7.4.13 HTML Output Method: the
include-content-type Parameter</b></a> regarding how this parameter
is used with the <code>include-content-type</code> parameter.</p>
</div>
<div class="div3">
<h4><a name="HTML_USE-CHARACTER-MAPS" id=
"HTML_USE-CHARACTER-MAPS"></a>7.4.10 HTML Output Method: the
<code>use-character-maps</code> Parameter</h4>
<p>The <code>use-character-maps</code> parameter is applicable to
the HTML output method. See <a href="#character-maps"><b>9
Character Maps</b></a> for more information.</p>
</div>
<div class="div3">
<h4><a name="HTML_BYTE-ORDER-MARK" id=
"HTML_BYTE-ORDER-MARK"></a>7.4.11 HTML Output Method: the
<code>byte-order-mark</code> Parameter</h4>
<p>The <code>byte-order-mark</code> parameter is applicable to the
HTML output method. See <a href="#serparam"><b>3 Serialization
Parameters</b></a> for more information.</p>
</div>
<div class="div3">
<h4><a name="HTML_ESCAPE-URI-ATTRIBUTES" id=
"HTML_ESCAPE-URI-ATTRIBUTES"></a>7.4.12 HTML Output Method: the
<code>escape-uri-attributes</code> Parameter</h4>
<p>If the <code>escape-uri-attributes</code> parameter has the
value <code>yes</code>, the HTML output method
<strong>MUST</strong> apply <a title="URI Escaping" href=
"#uri-escaping">URI escaping</a> to <a title="URI attribute values"
href="#uri-attribute-values">URI attribute values</a>, except that
relative URIs <strong>MUST NOT</strong> be absolutized.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>This escaping is deliberately confined to non-ASCII characters,
because escaping of ASCII characters is not always appropriate, for
example when URIs or URI fragments are interpreted locally by the
HTML user agent. Even in the case of non-ASCII characters, escaping
can sometimes cause problems. More precise control of <a title=
"URI Escaping" href="#uri-escaping">URI escaping</a> is therefore
available by setting <code>escape-uri-attributes</code> to
<code>no</code>, and controlling the escaping of URIs by using
methods defined in <a href=
"http://www.w3.org/TR/xpath-functions-30/#func-encode-for-uri">Section
6.2 fn:encode-for-uri</a> <sup><small>FO30</small></sup> and
<a href=
"http://www.w3.org/TR/xpath-functions-30/#func-iri-to-uri">Section
6.3 fn:iri-to-uri</a> <sup><small>FO30</small></sup>.</p>
</div>
</div>
<div class="div3">
<h4><a name="HTML_INCLUDE-CONTENT-TYPE" id=
"HTML_INCLUDE-CONTENT-TYPE"></a>7.4.13 HTML Output Method: the
<code>include-content-type</code> Parameter</h4>
<p>If there is a <code>head</code> element, and the
<code>include-content-type</code> parameter has the value
<code>yes</code>, the HTML output method <strong>MUST</strong> add
a <code>meta</code> element as the first child element of the
<code>head</code> element specifying the character encoding
actually used.</p>
<div class="exampleOuter">
<p>For example,</p>
<div class="exampleInner">
<pre>
&lt;HEAD&gt;
&lt;META http-equiv="Content-Type" content="text/html; charset=EUC-JP"&gt;
...
</pre></div>
</div>
<p>The content type <strong>MUST</strong> be set to the value given
for the <code>media-type</code> parameter.</p>
<p>If a <code>meta</code> element has been added to the
<code>head</code> element as described above, then any existing
<code>meta</code> element child of the <code>head</code> element
having an <code>http-equiv</code> attribute with the value
"Content-Type"<span>, making the comparison <span><a title=
"without regard to case" href="#caseless-compare">without regard to
case</a> after first stripping leading and trailing spaces from the
value of the attribute solely for the purposes of
comparison,</span></span> <strong>MUST</strong> be discarded.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>This process removes possible parameters in the attribute value.
For example,</p>
<div class="exampleInner">
<pre>
&lt;meta http-equiv="Content-Type" content="text/html;version='3.0'"/&gt;
</pre></div>
<p>in the data model instance would be replaced by,</p>
<div class="exampleInner">
<pre>
&lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8"/&gt;
</pre></div>
</div>
</div>
</div>
</div>
<div class="div1">
<h2><a name="text-output" id="text-output"></a>8 Text Output
Method</h2>
<p>The Text output method serializes the instance of the data model
by outputting the <a title="string value" href=
"#dt-string-value">string value</a> of the document <a title="node"
href="#dt-node">node</a> created by <span>the markup generation
step of the <a title="" href="#serphases">phases of
serialization</a></span> without any escaping.</p>
<p>A newline character in the instance of the data model
<strong>MAY</strong> be output using any character sequence that is
conventionally used to represent a line ending in the chosen system
environment.</p>
<div class="div2">
<h3><a name="TEXT_PARAMS" id="TEXT_PARAMS"></a>8.1 The Influence of
Serialization Parameters upon the Text Output Method</h3>
<div class="div3">
<h4><a name="TEXT_VERSION" id="TEXT_VERSION"></a>8.1.1 Text Output
Method: the <code>version</code> Parameter</h4>
<p>The <code>version</code> parameter is not applicable to the Text
output method.</p>
</div>
<div class="div3">
<h4><a name="TEXT_ENCODING" id="TEXT_ENCODING"></a>8.1.2 Text
Output Method: the <code>encoding</code> Parameter</h4>
<p>The <code>encoding</code> parameter identifies the encoding that
the Text output method <strong>MUST</strong> use to convert
sequences of characters to sequences of bytes. <a title=
"serializer" href="#serializer">Serializers</a> are
<strong>REQUIRED</strong> to support values of <code>UTF-8</code>
and <code>UTF-16</code>. A <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSESU0007"
title="err:SESU0007">err:SESU0007</a>] occurs if the <a title=
"serializer" href="#serializer">serializer</a> does not support the
encoding specified by the <code>encoding</code> parameter. The
<a title="serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal the error. If the instance of the data
model contains a character that cannot be represented in the
encoding that the <a title="serializer" href=
"#serializer">serializer</a> is using for output, the <a title=
"serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal a <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSERE0008"
title="err:SERE0008">err:SERE0008</a>].</p>
</div>
<div class="div3">
<h4><a name="TEXT_INDENT" id="TEXT_INDENT"></a>8.1.3 Text Output
Method: the <code>indent</code> <span>and
<code>suppress-indentation</code></span> Parameters</h4>
<p>The <code>indent</code> <span>and
<code>suppress-indentation</code> parameters are</span> not
applicable to the Text output method.</p>
</div>
<div class="div3">
<h4><a name="TEXT_CDATA-SECTION-ELEMENTS" id=
"TEXT_CDATA-SECTION-ELEMENTS"></a>8.1.4 Text Output Method: the
<code>cdata-section-elements</code> Parameter</h4>
<p>The <code>cdata-section-elements</code> parameter is not
applicable to the Text output method.</p>
</div>
<div class="div3">
<h4><a name="TEXT_OMIT-XML-DECLARATION" id=
"TEXT_OMIT-XML-DECLARATION"></a>8.1.5 Text Output Method: the
<code>omit-xml-declaration</code> and <code>standalone</code>
Parameters</h4>
<p>The <code>omit-xml-declaration</code> and
<code>standalone</code> parameters are not applicable to the Text
output method.</p>
</div>
<div class="div3">
<h4><a name="TEXT_DOCTYPE" id="TEXT_DOCTYPE"></a>8.1.6 Text Output
Method: the <code>doctype-system</code> and
<code>doctype-public</code> Parameters</h4>
<p>The <code>doctype-system</code> and <code>doctype-public</code>
parameters are not applicable to the Text output method.</p>
</div>
<div class="div3">
<h4><a name="TEXT_UNDECLARE-PREFIXES" id=
"TEXT_UNDECLARE-PREFIXES"></a>8.1.7 Text Output Method: the
<code>undeclare-prefixes</code> Parameter</h4>
<p>The <code>undeclare-prefixes</code> parameter is not applicable
to the Text output method.</p>
</div>
<div class="div3">
<h4><a name="TEXT_NORMALIZATION-FORM" id=
"TEXT_NORMALIZATION-FORM"></a>8.1.8 Text Output Method: the
<code>normalization-form</code> Parameter</h4>
<p>The <code>normalization-form</code> parameter is applicable to
the Text output method. The values <code>NFC</code> and
<code>none</code> <strong>MUST</strong> be supported by the
<a title="serializer" href="#serializer">serializer</a>. A
<a title="serialization error" href="#serial-err">serialization
error</a> [<a href="#ERRSESU0011" title=
"err:SESU0011">err:SESU0011</a>] results if the value of the
<code>normalization-form</code> parameter specifies a normalization
form that is not supported by the <a title="serializer" href=
"#serializer">serializer</a>; the <a title="serializer" href=
"#serializer">serializer</a> <strong>MUST</strong> signal the
error.</p>
</div>
<div class="div3">
<h4><a name="TEXT_MEDIA-TYPE" id="TEXT_MEDIA-TYPE"></a>8.1.9 Text
Output Method: the <code>media-type</code> Parameter</h4>
<p>The <code>media-type</code> parameter is applicable to the Text
output method. See <a href="#serparam"><b>3 Serialization
Parameters</b></a> for more information.</p>
</div>
<div class="div3">
<h4><a name="TEXT_USE-CHARACTER-MAPS" id=
"TEXT_USE-CHARACTER-MAPS"></a>8.1.10 Text Output Method: the
<code>use-character-maps</code> Parameter</h4>
<p>The <code>use-character-maps</code> parameter is applicable to
the Text output method. See <a href="#character-maps"><b>9
Character Maps</b></a> for more information.</p>
</div>
<div class="div3">
<h4><a name="TEXT_BYTE-ORDER-MARK" id=
"TEXT_BYTE-ORDER-MARK"></a>8.1.11 Text Output Method: the
<code>byte-order-mark</code> Parameter</h4>
<p>The <code>byte-order-mark</code> parameter is applicable to the
Text output method. See <a href="#serparam"><b>3 Serialization
Parameters</b></a> for more information.</p>
</div>
<div class="div3">
<h4><a name="TEXT_ESCAPE-URI-ATTRIBUTES" id=
"TEXT_ESCAPE-URI-ATTRIBUTES"></a>8.1.12 Text Output Method: the
<code>escape-uri-attributes</code> Parameter</h4>
<p>The <code>escape-uri-attributes</code> parameter is not
applicable to the Text output method.</p>
</div>
<div class="div3">
<h4><a name="TEXT_INCLUDE-CONTENT-TYPE" id=
"TEXT_INCLUDE-CONTENT-TYPE"></a>8.1.13 Text Output Method: the
<code>include-content-type</code> Parameter</h4>
<p>The <code>include-content-type</code> parameter is not
applicable to the Text output method.</p>
</div>
</div>
</div>
<div class="div1">
<h2><a name="character-maps" id="character-maps"></a>9 Character
Maps</h2>
<p>The <code>use-character-maps</code> parameter is a list of
characters and corresponding string substitutions.</p>
<p>Character maps allow a specific character appearing in a text or
attribute <a title="node" href="#dt-node">node</a> in the instance
of the data model to be replaced with a specified string of
characters during serialization. The string that is substituted is
output "as is," and the <a title="serializer" href=
"#serializer">serializer</a> performs no checks that the resulting
document is well-formed. This mechanism can therefore be used to
introduce arbitrary markup in the serialized output. See <a href=
"http://www.w3.org/TR/xslt-30/#character-maps">Section 23.1
Character Maps</a><sup><small>XT30</small></sup> of <a href=
"#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a> for
examples of using character mapping in XSLT.</p>
<p>Character mapping is applied to the characters that actually
appear in a text or attribute <a title="node" href=
"#dt-node">node</a> in the instance of the data model, before any
other serialization operations such as escaping or <a title=
"Unicode Normalization" href="#unicode-normalization">Unicode
Normalization</a> are applied. If a character is mapped, then it is
not subjected to XML or HTML escaping, nor to Unicode
Normalization. The string that is substituted for a character is
not validated or processed in any way by the <a title="serializer"
href="#serializer">serializer</a>, except for translation into the
target encoding. In particular, it is not subjected to XML or HTML
escaping, it is not subjected to Unicode Normalization, and it is
not subjected to further character mapping.</p>
<p>Character mapping is not applied to characters in text <a title=
"node" href="#dt-node">nodes</a> whose parent elements are listed
in the <code>cdata-section-elements</code> parameter, nor to
characters for which output escaping has been disabled (disabling
output escaping is an <a href="#xslt-30">[XSL Transformations
(XSLT) Version 3.0]</a> feature), nor to characters in attribute
values that are subject to <a title="URI Escaping" href=
"#uri-escaping">URI escaping</a> defined for the HTML and XHTML
output methods, unless <a title="URI Escaping" href=
"#uri-escaping">URI escaping</a> has been disabled using the
<code>escape-uri-attributes</code> parameter in the output
definition.</p>
<p>On serialization, occurrences of a character specified in the
<code>use-character-maps</code> in text <a title="node" href=
"#dt-node">nodes</a> and attribute values are replaced by the
corresponding string from the <code>use-character-maps</code>
parameter.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Using a character map can result in non-well-formed documents if
the string contains XML-significant characters. For example, it is
possible to create documents containing unmatched start and end
tags, references to entities that are not declared, or attributes
that contain tags or unescaped quotation marks.</p>
</div>
<p>If a character is mapped, then it is not subjected to XML or
HTML escaping.</p>
<p>A <a title="serialization error" href=
"#serial-err">serialization error</a> [<a href="#ERRSERE0008"
title="err:SERE0008">err:SERE0008</a>] occurs if character mapping
causes the output of a string containing a character that cannot be
represented in the encoding that the <a title="serializer" href=
"#serializer">serializer</a> is using for output. The <a title=
"serializer" href="#serializer">serializer</a>
<strong>MUST</strong> signal the error.</p>
</div>
<div class="div1">
<h2><a name="conformance" id="conformance"></a>10 Conformance</h2>
<p>[<a name="host-language" id="host-language" title=
"host language">Definition</a>: Serialization is intended primarily
as a component of a <b>host language</b> such as <a href=
"#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a> or <a href=
"#xquery-30">[XQuery 3.0: An XML Query Language]</a>.] Therefore,
this document relies on specifications that use it to specify
conformance criteria for Serialization in their respective
environments. Specifications that set conformance criteria for
their use of Serialization <strong>MUST NOT</strong> change the
semantic definitions of Serialization as given in this
specification, except by subsetting and/or compatible extensions.
It is the responsibility of the <a title="host language" href=
"#host-language">host language</a> to specify how <a title=
"serialization error" href="#serial-err">serialization errors</a>
should be handled.</p>
<p>Certain facilities in this specification are described as
producing <a title="implementation-defined" href=
"#impdef">implementation-defined</a> results. A claim that asserts
conformance with this specification <strong>MUST</strong> be
accompanied by documentation stating the effect of each
implementation-defined feature. For convenience, a non-normative
checklist of implementation-defined features is provided at
<a href="#implementation-defined-features"><b>E Checklist of
Implementation-Defined Features</b></a>.</p>
</div>
</div>
<div class="back">
<div class="div1">
<h2><a name="references" id="references"></a>A References</h2>
<div class="div2">
<h3><a name="normative-references" id=
"normative-references"></a>A.1 Normative References</h3>
<dl>
<dt class="label"><span><a name="charmod-norm" id=
"charmod-norm"></a>Character Model for the World Wide Web 1.0:
Normalization</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/charmod-norm/"><cite>Character
Model for the World Wide Web 1.0: Normalization</cite></a>, Richard
Ishida, François Yergeau, Addison Phillips, <em>et. al.</em>,
Editors. World Wide Web Consortium, 27&#160;Oct&#160;2005. This
version is http://www.w3.org/TR/2005/WD-charmod-norm-20051027/. The
<a href="http://www.w3.org/TR/charmod-norm/">latest version</a> is
available at http://www.w3.org/TR/charmod-norm/.</div>
</dd>
<dt class="label"><span><a name="xpath-datamodel-30" id=
"xpath-datamodel-30"></a>XQuery and XPath Data Model (XDM)
3.0</span></dt>
<dd>
<div><a href=
"http://www.w3.org/TR/xpath-datamodel-30/"><cite>XQuery and XPath
Data Model (XDM) 3.0</cite></a>, Norman Walsh, John Snelson,
Editors. World Wide Web Consortium, 13 December 2011. This version
is http://www.w3.org/TR/2011/WD-xpath-datamodel-30-20111213/. The
<a href="http://www.w3.org/TR/xpath-datamodel-30/">latest
version</a> is available at
http://www.w3.org/TR/xpath-datamodel-30/.</div>
</dd>
<dt class="label"><span><a name="xpath-functions-30" id=
"xpath-functions-30"></a>XQuery and XPath Functions and Operators
3.0</span></dt>
<dd>
<div><a href=
"http://www.w3.org/TR/xpath-functions-30/"><cite>XQuery and XPath
Functions and Operators 3.0</cite></a>, Michael Kay, Editor. World
Wide Web Consortium, 13 December 2011. This version is
http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/. The
<a href="http://www.w3.org/TR/xpath-functions-30/">latest
version</a> is available at
http://www.w3.org/TR/xpath-functions-30/.</div>
</dd>
<dt class="label"><span><a name="html401" id=
"html401"></a>HTML</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/html401/"><cite>HTML 4.01
Specification</cite></a>, Arnaud Le Hors, David Raggett, and Ian
Jacobs, Editors. World Wide Web Consortium, 24&#160;Dec&#160;1999.
This version is http://www.w3.org/TR/1999/REC-html401-19991224/.
The <a href="http://www.w3.org/TR/html401/">latest version</a> is
available at http://www.w3.org/TR/html401/.</div>
</dd>
<dt class="label"><span><a name="IANA" id=
"IANA"></a>IANA</span></dt>
<dd>
<div><a href=
"http://www.iana.org/assignments/character-sets"><cite>Character
Sets</cite></a>. Internet Assigned Numbers Authority. Jan
2005.</div>
</dd>
<dt class="label"><span><a name="RFC2046" id=
"RFC2046"></a>RFC2046</span></dt>
<dd>
<div><a href=
"http://www.ietf.org/rfc/rfc2046.txt"><cite>Multipurpose Internet
Mail Extensions (MIME) Part Two: Media Types</cite></a>, N. Freed,
N. Borenstein. Network Working Group, IETF, Nov 1996.</div>
</dd>
<dt class="label"><span><a name="RFC2119" id=
"RFC2119"></a>RFC2119</span></dt>
<dd>
<div><a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words
for use in RFCs to Indicate Requirement Levels</cite></a>, S.
Bradner. Network Working Group, IETF, Mar 1997.</div>
</dd>
<dt class="label"><span><a name="RFC2278" id=
"RFC2278"></a>RFC2278</span></dt>
<dd>
<div><a href="http://www.ietf.org/rfc/rfc2278.txt"><cite>IANA
Charset Registration Procedures</cite></a>, N. Freed and J. Postel
Network Working Group, IETF, Jan 1998.</div>
</dd>
<dt class="label"><span><a name="RFC2854" id=
"RFC2854"></a>RFC2854</span></dt>
<dd>
<div><a href="http://www.ietf.org/rfc/rfc2854.txt"><cite>The
'text/html' Media Type</cite></a>, D. Connolly, L. Masinter.
Network Working Group, IETF, Jun 2000.</div>
</dd>
<dt class="label"><span><a name="RFC3236" id=
"RFC3236"></a>RFC3236</span></dt>
<dd>
<div><a href="http://www.ietf.org/rfc/rfc3236.txt"><cite>The
'application/xhtml+xml' Media Type</cite></a>, M. Baker and P.
Stark. Network Working Group, IETF, Jan 2002.</div>
</dd>
<dt class="label"><span><a name="UNICODE-ENCODING" id=
"UNICODE-ENCODING"></a>Unicode Encoding</span></dt>
<dd>
<div><a href="http://www.unicode.org/reports/tr17/"><cite>Unicode
Character Encoding Model</cite></a>, Unicode Consortium. Unicode
Standard Annex #17.</div>
</dd>
<dt class="label"><span><a name="UNICODE-NORMALIZATION-FORM" id=
"UNICODE-NORMALIZATION-FORM"></a>UAX #15: Unicode Normalization
Forms</span></dt>
<dd>
<div><a href="http://www.unicode.org/reports/tr15/"><cite>Unicode
Normalization Forms</cite></a>, Unicode Consortium. Unicode
Standard Annex #15.</div>
</dd>
<dt class="label"><span><a name="xhtml1" id="xhtml1"></a>XHTML
1.0</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xhtml1/"><cite>XHTML™ 1.0 The
Extensible HyperText Markup Language (Second Edition)</cite></a>,
Steven Pemberton, Editor. World Wide Web Consortium,
01&#160;Aug&#160;2002. This version is
http://www.w3.org/TR/2002/REC-xhtml1-20020801/. The <a href=
"http://www.w3.org/TR/xhtml1/">latest version</a> is available at
http://www.w3.org/TR/xhtml1/.</div>
</dd>
<dt class="label"><span><a name="xhtml11" id="xhtml11"></a>XHTML
1.1</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xhtml11/"><cite>XHTML™ 1.1 -
Module-based XHTML</cite></a>, Shane McCarron and Murray Altheim,
Editors. World Wide Web Consortium, 31&#160;May&#160;2001. This
version is http://www.w3.org/TR/2001/REC-xhtml11-20010531. The
<a href="http://www.w3.org/TR/xhtml11/">latest version</a> is
available at http://www.w3.org/TR/xhtml11/. <a href=
"http://www.w3.org/TR/xhtml11/"><cite>XHTML™ 1.1 - Module-based
XHTML - Second Edition</cite></a>, Shane McCarron and Masayasu
Ishikawa, Editors. World Wide Web Consortium,
16&#160;Feb&#160;2007. This version is
http://www.w3.org/TR/2007/WD-xhtml11-20070216. The <a href=
"http://www.w3.org/TR/xhtml11/">latest version</a> is available at
http://www.w3.org/TR/xhtml11/.</div>
</dd>
<dt class="label"><span><a name="xml" id=
"xml"></a>XML10</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xml/"><cite>Extensible Markup
Language (XML) 1.0 (Fifth Edition)</cite></a>, Tim Bray, François
Yergeau, Jean Paoli, <em>et. al.</em>, Editors. World Wide Web
Consortium, 26&#160;Nov&#160;2008. This version is
http://www.w3.org/TR/2008/REC-xml-20081126/. The <a href=
"http://www.w3.org/TR/xml/">latest version</a> is available at
http://www.w3.org/TR/xml/.</div>
</dd>
<dt class="label"><span><a name="xml11" id=
"xml11"></a>XML11</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xml11/"><cite>Extensible Markup
Language (XML) 1.1 (Second Edition)</cite></a>, Eve Maler, Jean
Paoli, John Cowan, <em>et. al.</em>, Editors. World Wide Web
Consortium, 16&#160;Aug&#160;2006. This version is
http://www.w3.org/TR/2006/REC-xml11-20060816. The <a href=
"http://www.w3.org/TR/xml11/">latest version</a> is available at
http://www.w3.org/TR/xml11/.</div>
</dd>
<dt class="label"><span><a name="xml-names" id="xml-names"></a>XML
Names</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xml-names/"><cite>Namespaces in
XML 1.0 (Third Edition)</cite></a>, Dave Hollander, Richard Tobin,
Tim Bray, <em>et. al.</em>, Editors. World Wide Web Consortium,
08&#160;Dec&#160;2009. This version is
http://www.w3.org/TR/2009/REC-xml-names-20091208/. The <a href=
"http://www.w3.org/TR/xml-names/">latest version</a> is available
at http://www.w3.org/TR/xml-names/.</div>
</dd>
<dt class="label"><span><a name="xml-names11" id=
"xml-names11"></a>XML Names 1.1</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xml-names11/"><cite>Namespaces
in XML 1.1 (Second Edition)</cite></a>, Dave Hollander, Tim Bray,
Andrew Layman, and Richard Tobin, Editors. World Wide Web
Consortium, 16&#160;Aug&#160;2006. This version is
http://www.w3.org/TR/2006/REC-xml-names11-20060816. The <a href=
"http://www.w3.org/TR/xml-names11/">latest version</a> is available
at http://www.w3.org/TR/xml-names11/.</div>
</dd>
<dt class="label"><span><a name="xmlschema-1" id=
"xmlschema-1"></a>XML Schema</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xmlschema-1/"><cite>XML Schema
Part 1: Structures Second Edition</cite></a>, David Beech, Henry S.
Thompson, Murray Maloney, and Noah Mendelsohn, Editors. World Wide
Web Consortium, 28&#160;Oct&#160;2004. This version is
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/. The <a href=
"http://www.w3.org/TR/xmlschema-1/">latest version</a> is available
at http://www.w3.org/TR/xmlschema-1/.</div>
</dd>
<dt class="label"><span><a name="xpath-30" id="xpath-30"></a>XML
Path Language (XPath) 3.0</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xpath-30/"><cite>XML Path
Language (XPath) 3.0</cite></a>, Jonathan Robie, Don Chamberlin,
Michael Dyck, John Snelson, Editors. World Wide Web Consortium, 13
December 2011. This version is
http://www.w3.org/TR/2011/WD-xpath-30-20111213/. The <a href=
"http://www.w3.org/TR/xpath-30/">latest version</a> is available at
http://www.w3.org/TR/xpath-30/.</div>
</dd>
<dt class="label"><span><a name="xquery-30" id=
"xquery-30"></a>XQuery 3.0: An XML Query Language</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xquery-30/"><cite>XQuery 3.0: An
XML Query Language</cite></a>, Jonathan Robie, Don Chamberlin,
Michael Dyck, John Snelson, Editors. World Wide Web Consortium, 13
December 2011. This version is
http://www.w3.org/TR/2011/WD-xquery-30-20111213/. The <a href=
"http://www.w3.org/TR/xquery-30/">latest version</a> is available
at http://www.w3.org/TR/xquery-30/.</div>
</dd>
<dt class="label"><span><a name="xslt-30" id="xslt-30"></a>XSL
Transformations (XSLT) Version 3.0</span></dt>
<dd>
<div><cite>XSL Transformations (XSLT) Version 3.0</cite>
(expected), Michael Kay, Editor. World Wide Web Consortium, (not
yet published but anticipated in 2012; see the <a href=
"http://www.w3.org/TR/#tr_XSLT">list of XSLT
specifications</a>)</div>
</dd>
</dl>
</div>
<div class="div2">
<h3><a name="informative-references" id=
"informative-references"></a>A.2 Informative References</h3>
<dl>
<dt class="label"><span><a name="xhtml-modularization" id=
"xhtml-modularization"></a>XHTML Modularization</span></dt>
<dd>
<div><a href=
"http://www.w3.org/TR/xhtml-modularization/"><cite>XHTML™
Modularization 1.1</cite></a>, Shane McCarron, Subramanian
Peruvemba, Mark Birbeck, <em>et. al.</em>, Editors. World Wide Web
Consortium, 08&#160;Oct&#160;2008. This version is
http://www.w3.org/TR/2008/REC-xhtml-modularization-20081008. The
<a href="http://www.w3.org/TR/xhtml-modularization/">latest
version</a> is available at
http://www.w3.org/TR/xhtml-modularization/. <a href=
"http://www.w3.org/TR/xhtml-modularization/"><cite>Modularization
of XHTML™ 1.0 - Second Edition</cite></a>, , , , <em>et. al.</em>,
Editors. World Wide Web Consortium, 18&#160;Feb&#160;2004. This
version is
http://www.w3.org/TR/2004/WD-xhtml-modularization-20040218. The
<a href="http://www.w3.org/TR/xhtml-modularization/">latest
version</a> is available at
http://www.w3.org/TR/xhtml-modularization/.</div>
</dd>
<dt class="label"><span><a name="xpath-datamodel" id=
"xpath-datamodel"></a>XQuery 1.0 and XPath 2.0 Data
Model</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xpath-datamodel/"><cite>XQuery
1.0 and XPath 2.0 Data Model (XDM) (Second Edition)</cite></a>,
Norman Walsh, Mary Fernández, Ashok Malhotra, <em>et. al.</em>,
Editors. World Wide Web Consortium, 14 December 2010. This version
is http://www.w3.org/TR/2010/REC-xpath-datamodel-20101214/. The
<a href="http://www.w3.org/TR/xpath-datamodel/">latest version</a>
is available at http://www.w3.org/TR/xpath-datamodel/.</div>
</dd>
<dt class="label"><span><a name="serialization-10-2ed" id=
"serialization-10-2ed"></a>XSLT 2.0 and XQuery 1.0 Serialization
(Second Edition)</span></dt>
<dd>
<div><a href=
"http://www.w3.org/TR/2010/REC-xslt-xquery-serialization-20101214/">
<cite>XSLT 2.0 and XQuery 1.0 Serialization (Second Edition), W3C
Recommendation</cite></a>, Henry Zongaro, Norman Walsh, Joanne
Tong, <em>et. al.</em>, Editors. World Wide Web Consortium,
14&#160; December&#160; 2010. This version is
http://www.w3.org/TR/2010/REC-xslt-xquery-serialization-20101214/</div>
</dd>
</dl>
</div>
</div>
<div class="div1">
<h2><a name="serparams-schema" id="serparams-schema"></a>B Schema
for Serialization Parameters</h2>
<p>The following schema describes the structure of a Data Model
instance that can be used to specify the settings of serialization
parameters using the mechanism described in <a href=
"#serparams-in-xdm-instance"><b>3.1 Setting Serialization
Parameters by Means of a Data Model Instance</b></a>.</p>
<p>A copy of this schema is available at <a href=
"http://www.w3.org/2010/xslt-xquery-serialization/schema-for-parameters-for-xslt-xquery-serialization.xsd">
http://www.w3.org/2010/xslt-xquery-serialization/schema-for-parameters-for-xslt-xquery-serialization.xsd</a>.</p>
<pre>
&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/2010/xslt-xquery-serialization"
xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization"
elementFormDefault="qualified"&gt;
&lt;xs:annotation&gt;
&lt;xs:documentation&gt;
This is a schema for serialization parameters for
XSLT and XQuery Serialization 3.0.
This schema is available for use under the conditions of the
W3C Software License published at
http://www.w3.org/Consortium/Legal/copyright-software-19980720
It defines a schema for XML Infoset instances with which a user of
a host language MAY specify serialization parameters for use in
serializing an instance of the XQuery and XPath Data Model. It
also provides hooks that allow the inclusion of implementation-
defined serialization parameters and implementation-defined
modifiers to serialization parameters.
&lt;/xs:documentation&gt;
&lt;/xs:annotation&gt;
&lt;xs:simpleType name="QNames-type"&gt;
&lt;xs:list itemType="xs:QName"/&gt;
&lt;/xs:simpleType&gt;
&lt;xs:simpleType name="yes-no-type"&gt;
&lt;xs:restriction base="xs:token"&gt;
&lt;xs:enumeration value="no"/&gt;
&lt;xs:enumeration value="yes"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;xs:simpleType name="yes-no-omit-type"&gt;
&lt;xs:restriction base="xs:token"&gt;
&lt;xs:enumeration value="no"/&gt;
&lt;xs:enumeration value="omit"/&gt;
&lt;xs:enumeration value="yes"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;xs:simpleType name="char-type"&gt;
&lt;xs:restriction base="xs:string"&gt;
&lt;xs:maxLength value="1"/&gt;
&lt;xs:minLength value="1"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;xs:simpleType name="encoding-string-type"&gt;
&lt;xs:restriction base="xs:string"&gt;
&lt;xs:pattern value="[A-Za-z][A-Za-z0-9._\-]*"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;xs:simpleType name="method-type"&gt;
&lt;xs:union&gt;
&lt;xs:simpleType&gt;
&lt;xs:restriction base="xs:string"&gt;
&lt;xs:enumeration value="html"/&gt;
&lt;xs:enumeration value="text"/&gt;
&lt;xs:enumeration value="xml"/&gt;
&lt;xs:enumeration value="xhtml"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;xs:simpleType&gt;
&lt;xs:restriction base="xs:QName"&gt;
&lt;xs:pattern value=".*:.*"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;/xs:union&gt;
&lt;/xs:simpleType&gt;
&lt;xs:simpleType name="pubid-char-string-type"&gt;
&lt;xs:restriction base="xs:string"&gt;
&lt;xs:pattern value="([- \r\n\ta-zA-Z0-9'()+,./:=?;!*#@$_%])*"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;xs:simpleType name="system-id-string-type"&gt;
&lt;xs:restriction base="xs:string"&gt;
&lt;xs:pattern value="[^']*|[^&amp;quot;]*"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;
&lt;!--
- Base type of all serialization parameter types
--&gt;
&lt;xs:complexType name="base-param-type"&gt;
&lt;xs:complexContent&gt;
&lt;xs:restriction base="xs:anyType"&gt;
&lt;xs:anyAttribute namespace="##other" processContents="lax"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:complexContent&gt;
&lt;/xs:complexType&gt;
&lt;!--
- Generic string serialization parameters
--&gt;
&lt;xs:complexType name="string-param-type"&gt;
&lt;xs:complexContent&gt;
&lt;xs:extension base="output:base-param-type"&gt;
&lt;xs:attribute name="value" type="xs:string" use="required"/&gt;
&lt;/xs:extension&gt;
&lt;/xs:complexContent&gt;
&lt;/xs:complexType&gt;
&lt;!--
- Serialization parameter type for "yes" or "no"
- serialization parameters
--&gt;
&lt;xs:complexType name="yes-no-param-type"&gt;
&lt;xs:complexContent&gt;
&lt;xs:extension base="output:base-param-type"&gt;
&lt;xs:attribute name="value" type="output:yes-no-type" use="required"/&gt;
&lt;/xs:extension&gt;
&lt;/xs:complexContent&gt;
&lt;/xs:complexType&gt;
&lt;!--
- Serialization parameter type for list of xs:QName
- serialization parameters
--&gt;
&lt;xs:complexType name="QNames-param-type"&gt;
&lt;xs:complexContent&gt;
&lt;xs:extension base="output:base-param-type"&gt;
&lt;xs:attribute name="value" type="output:QNames-type" use="required"/&gt;
&lt;/xs:extension&gt;
&lt;/xs:complexContent&gt;
&lt;/xs:complexType&gt;
&lt;!--
- Serialization parameter type for "yes", "no" or "omit"
- serialization parameters
--&gt;
&lt;xs:complexType name="yes-no-omit-param-type"&gt;
&lt;xs:complexContent&gt;
&lt;xs:extension base="output:base-param-type"&gt;
&lt;xs:attribute name="value" type="output:yes-no-omit-type"
use="required"/&gt;
&lt;/xs:extension&gt;
&lt;/xs:complexContent&gt;
&lt;/xs:complexType&gt;
&lt;!--
- Serialization parameter element for byte-order-mark parameter
--&gt;
&lt;xs:element name="serialization-parameter-element"
abstract="true"
type="output:base-param-type"/&gt;
&lt;!--
- Serialization parameter element for byte-order-mark parameter
--&gt;
&lt;xs:element id="byte-order-mark" name="byte-order-mark" type="output:yes-no-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for cdata-section-elements parameter
--&gt;
&lt;xs:element id="cdata-section-elements" name="cdata-section-elements" type="output:QNames-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter type for doctype-public parameter
--&gt;
&lt;xs:complexType name="doctype-public-param-type"&gt;
&lt;xs:complexContent&gt;
&lt;xs:extension base="output:base-param-type"&gt;
&lt;xs:attribute name="value" type="output:pubid-char-string-type"
use="required"/&gt;
&lt;/xs:extension&gt;
&lt;/xs:complexContent&gt;
&lt;/xs:complexType&gt;
&lt;!--
- Serialization parameter element for doctype-public parameter
--&gt;
&lt;xs:element id="doctype-public" name="doctype-public" type="output:doctype-public-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter type for doctype-system parameter
--&gt;
&lt;xs:complexType name="doctype-system-param-type"&gt;
&lt;xs:complexContent&gt;
&lt;xs:extension base="output:base-param-type"&gt;
&lt;xs:attribute name="value" type="output:system-id-string-type"
use="required"/&gt;
&lt;/xs:extension&gt;
&lt;/xs:complexContent&gt;
&lt;/xs:complexType&gt;
&lt;!--
- Serialization parameter element for doctype-system parameter
--&gt;
&lt;xs:element id="doctype-system" name="doctype-system" type="output:doctype-system-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter type for encoding parameter
--&gt;
&lt;xs:complexType name="encoding-param-type"&gt;
&lt;xs:complexContent&gt;
&lt;xs:extension base="output:base-param-type"&gt;
&lt;xs:attribute name="value" type="output:encoding-string-type"
use="required"/&gt;
&lt;/xs:extension&gt;
&lt;/xs:complexContent&gt;
&lt;/xs:complexType&gt;
&lt;!--
- Serialization parameter element for encoding parameter
--&gt;
&lt;xs:element id="encoding" name="encoding" type="output:encoding-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for escape-uri-attributes parameter
--&gt;
&lt;xs:element id="escape-uri-attributes" name="escape-uri-attributes" type="output:yes-no-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for include-content-type parameter
--&gt;
&lt;xs:element id="include-content-type" name="include-content-type" type="output:yes-no-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for indent parameter
--&gt;
&lt;xs:element id="indent" name="indent" type="output:yes-no-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for media-type parameter
--&gt;
&lt;xs:element id="media-type" name="media-type" type="output:string-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter type for method parameter
--&gt;
&lt;xs:complexType name="method-param-type"&gt;
&lt;xs:complexContent&gt;
&lt;xs:extension base="output:base-param-type"&gt;
&lt;xs:attribute name="value" type="output:method-type"
use="required"/&gt;
&lt;/xs:extension&gt;
&lt;/xs:complexContent&gt;
&lt;/xs:complexType&gt;
&lt;!--
- Serialization parameter element for method parameter
--&gt;
&lt;xs:element id="method" name="method" type="output:method-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for normalization-form parameter
--&gt;
&lt;xs:element id="normalization-form" name="normalization-form" type="output:string-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for omit-xml-declaration parameter
--&gt;
&lt;xs:element id="omit-xml-declaration" name="omit-xml-declaration" type="output:yes-no-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for standalone parameter
--&gt;
&lt;xs:element id="standalone" name="standalone" type="output:yes-no-omit-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for suppress-indentation parameter
--&gt;
&lt;xs:element id="suppress-indentation" name="suppress-indentation" type="output:QNames-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for undeclare-prefixes parameter
--&gt;
&lt;xs:element id="undeclare-prefixes" name="undeclare-prefixes" type="output:yes-no-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter type for use-character-maps
- parameter
--&gt;
&lt;xs:complexType name="use-character-maps-param-type"&gt;
&lt;xs:complexContent&gt;
&lt;xs:extension base="output:base-param-type"&gt;
&lt;xs:sequence&gt;
&lt;xs:element name="character-map" minOccurs="0"
maxOccurs="unbounded"&gt;
&lt;xs:complexType&gt;
&lt;xs:attribute name="character" type="output:char-type"/&gt;
&lt;xs:attribute name="map-string" type="xs:string"/&gt;
&lt;xs:anyAttribute namespace="##other"
processContents="lax"/&gt;
&lt;/xs:complexType&gt;
&lt;/xs:element&gt;
&lt;xs:any minOccurs="0" namespace="##other"
processContents="lax"/&gt;
&lt;/xs:sequence&gt;
&lt;/xs:extension&gt;
&lt;/xs:complexContent&gt;
&lt;/xs:complexType&gt;
&lt;!--
- Serialization parameter element for use-character-maps parameter
--&gt;
&lt;xs:element id="use-character-maps" name="use-character-maps"
type="output:use-character-maps-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;!--
- Serialization parameter element for version parameter
--&gt;
&lt;xs:element id="version" name="version"
type="output:string-param-type"
substitutionGroup="output:serialization-parameter-element"/&gt;
&lt;xs:element name="serialization-parameters"&gt;
&lt;xs:complexType&gt;
&lt;xs:sequence&gt;
&lt;xs:element ref="output:serialization-parameter-element"
minOccurs="0" maxOccurs="unbounded"/&gt;
&lt;/xs:sequence&gt;
&lt;/xs:complexType&gt;
&lt;/xs:element&gt;
&lt;/xs:schema&gt;
</pre></div>
<div class="div1">
<h2><a name="id-errors" id="id-errors"></a>C Summary of Error
Conditions</h2>
<p>This document uses the <code>err</code> prefix which represents
the same namespace URI (http://www.w3.org/2005/xqt-errors) as
defined in <a href="#xpath-30">[XML Path Language (XPath) 3.0]</a>.
Use of this namespace prefix binding in this document is not
normative.</p>
<dl>
<dt><a name="ERRSENR0001" id="ERRSENR0001"></a>err:SENR0001</dt>
<dd>
<p>It is an error if an item in <em>S<sub>6</sub></em> in <a title=
"sequence normalization" href="#sequence-normalization">sequence
normalization</a> is an attribute node or a namespace node.</p>
</dd>
<dt><a name="ERRSERE0003" id="ERRSERE0003"></a>err:SERE0003</dt>
<dd>
<p>It is an error if the <a title="serializer" href=
"#serializer">serializer</a> is unable to satisfy the rules for
either a well-formed XML document entity or a well-formed XML
external general parsed entity, or both, except for content
modified by the character expansion phase of serialization.</p>
</dd>
<dt><a name="ERRSEPM0004" id="ERRSEPM0004"></a>err:SEPM0004</dt>
<dd>
<p>It is an error to specify the doctype-system parameter, or to
specify the standalone parameter with a value other than
<code>omit</code>, if the instance of the data model contains text
nodes or multiple element nodes as children of the root node.</p>
</dd>
<dt><a name="ERRSERE0005" id="ERRSERE0005"></a>err:SERE0005</dt>
<dd>
<p>It is an error if the serialized result would contain an
<a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName
NCName NCName NCName NCName NCName NCName NCName NCName
NCName</a><sup><small>Names</small></sup> that contains a character
that is not permitted by the version of Namespaces in XML specified
by the <code>version</code> parameter.</p>
</dd>
<dt><a name="ERRSERE0006" id="ERRSERE0006"></a>err:SERE0006</dt>
<dd>
<p>It is an error if the serialized result would contain a
character that is not permitted by the version of XML specified by
the <code>version</code> parameter.</p>
</dd>
<dt><a name="ERRSESU0007" id="ERRSESU0007"></a>err:SESU0007</dt>
<dd>
<p>It is an error if an output encoding other than
<code>UTF-8</code> or <code>UTF-16</code> is requested and the
<a title="serializer" href="#serializer">serializer</a> does not
support that encoding.</p>
</dd>
<dt><a name="ERRSERE0008" id="ERRSERE0008"></a>err:SERE0008</dt>
<dd>
<p>It is an error if a character that cannot be represented in the
encoding that the <a title="serializer" href=
"#serializer">serializer</a> is using for output appears in a
context where character references are not allowed (for example if
the character occurs in the name of an element).</p>
</dd>
<dt><a name="ERRSEPM0009" id="ERRSEPM0009"></a>err:SEPM0009</dt>
<dd>
<p>It is an error if the <code>omit-xml-declaration</code>
parameter has the value <code>yes</code>, and the
<code>standalone</code> attribute has a value other than
<code>omit</code>; or the <code>version</code> parameter has a
value other than <code>1.0</code> and the
<code>doctype-system</code> parameter is specified.</p>
</dd>
<dt><a name="ERRSEPM0010" id="ERRSEPM0010"></a>err:SEPM0010</dt>
<dd>
<p>It is an error if the output method is <code>xml</code> <span>or
<code>xhtml</code></span>, the value of the
<code>undeclare-prefixes</code> parameter is <code>yes</code>, and
the value of the <code>version</code> parameter is 1.0.</p>
</dd>
<dt><a name="ERRSESU0011" id="ERRSESU0011"></a>err:SESU0011</dt>
<dd>
<p>It is an error if the value of the
<code>normalization-form</code> parameter specifies a normalization
form that is not supported by the <a title="serializer" href=
"#serializer">serializer</a>.</p>
</dd>
<dt><a name="ERRSERE0012" id="ERRSERE0012"></a>err:SERE0012</dt>
<dd>
<p>It is an error if the value of the
<code>normalization-form</code> parameter is
<code>fully-normalized</code> and any relevant construct of the
result begins with a combining character.</p>
</dd>
<dt><a name="ERRSESU0013" id="ERRSESU0013"></a>err:SESU0013</dt>
<dd>
<p>It is an error if the <a title="serializer" href=
"#serializer">serializer</a> does not support the version of XML or
HTML specified by the <code>version</code> parameter.</p>
</dd>
<dt><a name="ERRSERE0014" id="ERRSERE0014"></a>err:SERE0014</dt>
<dd>
<p>It is an error to use the HTML output method if characters which
are <span>permitted</span> in XML but not in HTML appear in the
instance of the data model.</p>
</dd>
<dt><a name="ERRSERE0015" id="ERRSERE0015"></a>err:SERE0015</dt>
<dd>
<p>It is an error to use the HTML output method when
<code>&gt;</code> appears within a processing instruction in the
data model instance being serialized.</p>
</dd>
<dt><a name="ERRSEPM0016" id="ERRSEPM0016"></a>err:SEPM0016</dt>
<dd>
<p>It is an error if a parameter value is invalid for the defined
domain.</p>
</dd>
<dt><a name="ERRSEPM0017" id="ERRSEPM0017"></a>err:SEPM0017</dt>
<dd>
<p>It is an error if evaluating an expression in order to extract
the setting of a serialization parameter from a data model instance
would yield an error.</p>
</dd>
<dt><a name="ERRSEPM0018" id="ERRSEPM0018"></a>err:SEPM0018</dt>
<dd>
<p>It is an error if evaluating an expression in order to extract
the setting of the <code>use-character-maps</code> serialization
parameter from a data model instance would yield a sequence of
length greater than one.</p>
</dd>
<dt><a name="ERRSEPM0019" id="ERRSEPM0019"></a>err:SEPM0019</dt>
<dd>
<p>It is an error if an instance of the data model used to specify
the settings of serialization parameters specifies the value of the
same parameter more than once.</p>
</dd>
</dl>
</div>
<div class="div1">
<h2><a name="list-of-uri-attributes" id=
"list-of-uri-attributes"></a>D List of URI Attributes</h2>
<p>The following list of attributes are declared as type
<code>%URI</code> or <code>%UriList</code> for a given HTML or
XHTML element, with the exception of the <code>name</code>
attribute for element <code>A</code> which is not a URI type. The
<code>name</code> attribute for element <code>A</code> should be
escaped as is recommended by the HTML Recommendation <a href=
"#html401">[HTML]</a> in Appendix B.2.1.</p>
<table width="500" border="1" summary="Attributes of type URI">
<col width="200" span="1" />
<col width="300" span="1" />
<thead>
<tr>
<th align="left" colspan="1">Attributes</th>
<th align="left" colspan="1">Elements</th>
</tr>
</thead>
<tbody>
<tr>
<td>action</td>
<td>FORM</td>
</tr>
<tr>
<td>archive</td>
<td>OBJECT</td>
</tr>
<tr>
<td>background</td>
<td>BODY</td>
</tr>
<tr>
<td>cite</td>
<td>BLOCKQUOTE, DEL, INS, Q</td>
</tr>
<tr>
<td>classid</td>
<td>OBJECT</td>
</tr>
<tr>
<td>codebase</td>
<td>APPLET, OBJECT</td>
</tr>
<tr>
<td>data</td>
<td>OBJECT</td>
</tr>
<tr>
<td>datasrc</td>
<td>BUTTON, DIV, INPUT, OBJECT, SELECT, SPAN, TABLE, TEXTAREA</td>
</tr>
<tr>
<td>for</td>
<td>SCRIPT</td>
</tr>
<tr>
<td>href</td>
<td>A, AREA, BASE, LINK</td>
</tr>
<tr>
<td>longdesc</td>
<td>FRAME, IFRAME, IMG</td>
</tr>
<tr>
<td>name</td>
<td>A</td>
</tr>
<tr>
<td>profile</td>
<td>HEAD</td>
</tr>
<tr>
<td>src</td>
<td>FRAME, IFRAME, IMG, INPUT, SCRIPT</td>
</tr>
<tr>
<td>usemap</td>
<td>IMG, INPUT, OBJECT</td>
</tr>
</tbody>
</table>
</div>
<div class="div1">
<h2><a name="implementation-defined-features" id=
"implementation-defined-features"></a>E Checklist of
Implementation-Defined Features (Non-Normative)</h2>
<p>This appendix provides a summary of Serialization features whose
effect is explicitly <a title="implementation-defined" href=
"#impdef">implementation-defined</a>. The conformance rules (see
<a href="#conformance"><b>10 Conformance</b></a>) require vendors
to provide documentation that explains how these choices have been
exercised.</p>
<ol>
<li>For any <a title="implementation-defined" href=
"#impdef">implementation-defined</a> output method, it is <a title=
"implementation-defined" href="#impdef">implementation-defined</a>
whether <a title="sequence normalization" href=
"#sequence-normalization">sequence normalization</a> process takes
place. (See <a href="#serdm"><b>2 Sequence
Normalization</b></a>)</li>
<li>If the namespace URI is non-null for the <code>method</code>
serialization parameter, then the parameter specifies an <a title=
"implementation-defined" href="#impdef">implementation-defined</a>
output method. (See <a href="#serparam"><b>3 Serialization
Parameters</b></a>)</li>
<li>The effect of additional serialization parameters on the output
of the serializer, where the name of such a parameter must be
namespace-qualified, is <a title="implementation-defined" href=
"#impdef">implementation-defined</a> or <a title=
"implementation-dependent" href=
"#impdep">implementation-dependent</a>. The extent of this effect
on the output must not override the provisions of this
specification. (See <a href="#serparam"><b>3 Serialization
Parameters</b></a>)</li>
<li>The effect of providing an option that allows the encoding
phase to be skipped, so that the result of serialization is a
stream of Unicode characters, is <a title="implementation-defined"
href="#impdef">implementation-defined</a>. The <a title=
"serializer" href="#serializer">serializer</a> is not required to
support such an option. (See <a href="#serphases"><b>4 Phases of
Serialization</b></a>)</li>
<li><span>If an implementation supports a value of the
<code>version</code> parameter for the XML or XHTML output method
for which this document does not provide a normative definition,
the behavior is <a title="implementation-defined" href=
"#impdef">implementation-defined</a>.</span> (See <a href=
"#XML_VERSION"><b>5.1.1 XML Output Method: the version
Parameter</b></a>)</li>
<li>An <a title="serializer" href="#serializer">serializer</a> may
provide an <a title="implementation-defined" href=
"#impdef">implementation-defined</a> mechanism to place CDATA
sections in the <a title="result tree" href="#result-tree">result
tree</a>. (See <a href="#XML_CDATA-SECTION-ELEMENTS"><b>5.1.4 XML
Output Method: the cdata-section-elements Parameter</b></a>)</li>
<li>If the value of the <code>normalization-form</code> form
parameter is not <code>NFC</code>, <code>NFD</code>,
<code>NFKC</code>, <code>NFKD</code>,
<code>fully-normalized</code>, or <code>none</code> then the
meaning of the value and its effect is <a title=
"implementation-defined" href="#impdef">implementation-defined</a>.
(See <a href="#XML_NORMALIZATION-FORM"><b>5.1.8 XML Output Method:
the normalization-form Parameter</b></a>)</li>
<li><span>If an implementation supports a value of the
<code>version</code> parameter for the HTML output method for which
this document does not provide a normative definition, the behavior
is <a title="implementation-defined" href=
"#impdef">implementation-defined</a>.</span> (See <a href=
"#HTML_VERSION"><b>7.4.1 HTML Output Method: the version
Parameter</b></a>)</li>
</ol>
</div>
<div class="div1">
<h2><a name="revision-log" id="revision-log"></a>F Change Log
(Non-Normative)</h2>
<p>This appendix details the changes that have been made since the
publication of the <a href="#serialization-10-2ed">[XSLT 2.0 and
XQuery 1.0 Serialization (Second Edition)]</a>.</p>
<div class="div2">
<h3><a name="changes-for-this-WD" id="changes-for-this-WD"></a>F.1
Changes applied for the current Public Working Draft</h3>
<p>The following changes have been applied since the publication of
the third Public Working Draft to produce the current Public
Working Draft. None of these changes introduces an incompatibility
with <a href="#serialization-10-2ed">[XSLT 2.0 and XQuery 1.0
Serialization (Second Edition)]</a>.</p>
<table border="1" cellpadding="5" width="100%" summary=
"Changes for first public working draft">
<thead>
<tr>
<td>Bugzilla bug (if applicable)</td>
<td>Erratum (if applicable)</td>
<td>Category</td>
<td>Description of change</td>
<td>Affected sections</td>
</tr>
</thead>
<tbody>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=12852">Bugzilla bug
12852</a></td>
<td>None</td>
<td>Substantive</td>
<td>Corrected the type of the <code>media-type</code> serialization
parameter in the Schema for Serialization Parameters.</td>
<td>
<ul>
<li>
<p><a href="#serparams-schema"><b>B Schema for Serialization
Parameters</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=13688">Bugzilla bug
13688</a></td>
<td>None</td>
<td>Substantive</td>
<td>Corrected the regular expression associated with the
<code>encoding-string-type</code> type in the Schema for
Serialization Parameters, so that hyphens are permitted to appear
in the <code>encoding</code> serialization parameter.</td>
<td>
<ul>
<li>
<p><a href="#serparams-schema"><b>B Schema for Serialization
Parameters</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=10176">Bugzilla bug
10176</a></td>
<td>SE.E20</td>
<td>Substantive</td>
<td>Clarified what it means for the html output method to output an
XML island as XML.</td>
<td>
<ul>
<li>
<p><a href="#HTML_MARKUP"><b>7.1 Markup for Elements</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=14751">Bugzilla bug
14751</a></td>
<td>None</td>
<td>Editorial</td>
<td>Corrected typographical errors in the comments associated with
the <code>yes-no-param-type</code> and
<code>encoding-param-type</code> types in the Schema for
Serialization Parameters.</td>
<td>
<ul>
<li>
<p><a href="#serparams-schema"><b>B Schema for Serialization
Parameters</b></a></p>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div class="div2">
<h3><a name="changes-for-3rd-WD" id="changes-for-3rd-WD"></a>F.2
Changes applied for the third Public Working Draft</h3>
<p>The following changes were applied after the publication of the
second Public Working Draft to produce the third Public Working
Draft. None of these changes introduces an incompatibility with
<a href="#serialization-10-2ed">[XSLT 2.0 and XQuery 1.0
Serialization (Second Edition)]</a>, except as noted below.</p>
<table border="1" cellpadding="5" width="100%" summary=
"Changes for first public working draft">
<thead>
<tr>
<td>Bugzilla bug (if applicable)</td>
<td>Erratum (if applicable)</td>
<td>Category</td>
<td>Description of change</td>
<td>Affected sections</td>
</tr>
</thead>
<tbody>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=11635">Bugzilla bug
11635</a></td>
<td>SE.E19</td>
<td>Substantive</td>
<td>Clarified that serialization error SEPM0010 applies to the
xhtml output method as well as the xml output method.</td>
<td>
<ul>
<li>
<p><a href="#id-errors"><b>C Summary of Error
Conditions</b></a></p>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div class="div2">
<h3><a name="changes-for-2nd-WD" id="changes-for-2nd-WD"></a>F.3
Changes applied for the second Public Working Draft</h3>
<p>The following changes were applied after the publication of the
first Public Working Draft to produce the second Public Working
Draft. None of these changes introduces an incompatibility with
<a href="#serialization-10-2ed">[XSLT 2.0 and XQuery 1.0
Serialization (Second Edition)]</a>, except as noted below.</p>
<table border="1" cellpadding="5" width="100%" summary=
"Changes for first public working draft">
<thead>
<tr>
<td>Bugzilla bug (if applicable)</td>
<td>Erratum (if applicable)</td>
<td>Category</td>
<td>Description of change</td>
<td>Affected sections</td>
</tr>
</thead>
<tbody>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=6535">Bugzilla bug
6535</a></td>
<td>None</td>
<td>Substantive</td>
<td>Added definition of the <code>suppress-indentation</code>
serialization parameter.</td>
<td>
<ul>
<li>
<p><a href="#serparam"><b>3 Serialization Parameters</b></a></p>
</li>
<li>
<p><a href="#serphases"><b>4 Phases of Serialization</b></a></p>
</li>
<li>
<p><a href="#xml-indent"><b>5.1.3 XML Output Method: the indent and
suppress-indentation Parameters</b></a></p>
</li>
<li>
<p><a href="#XHTML_INDENT"><b>6.1.3 XHTML Output Method: the indent
and suppress-indentation Parameters</b></a></p>
</li>
<li>
<p><a href="#HTML_INDENT"><b>7.4.3 HTML Output Method: the indent
and suppress-indentation Parameters</b></a></p>
</li>
<li>
<p><a href="#TEXT_INDENT"><b>8.1.3 Text Output Method: the indent
and suppress-indentation Parameters</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=7829">Bugzilla bug
7829</a></td>
<td>SE.E14</td>
<td>Substantive</td>
<td>Clarified how minimized attributes are handled under the rules
of the HTML output method.</td>
<td>
<ul>
<li>
<p><a href="#HTML_ATTRIBS"><b>7.2 Writing Attributes</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=8245">Bugzilla bug
8245</a></td>
<td>SE.E15</td>
<td>Editorial</td>
<td>Corrected description of a serialization error that mentions
which control characters are not permitted under the rules of the
HTML output method</td>
<td>
<ul>
<li>
<p><a href="#HTML_CHARDATA"><b>7.3 Writing Character
Data</b></a></p>
</li>
<li>
<p><a href="#id-errors"><b>C Summary of Error
Conditions</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=7823">Bugzilla bug
7823</a></td>
<td>SE.E16</td>
<td>Substantive</td>
<td>Clarified how the <code>script</code> and <code>style</code>
elements are handled for the HTML output method.</td>
<td>
<ul>
<li>
<p><a href="#HTML_MARKUP"><b>7.1 Markup for Elements</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=8651">Bugzilla bug
8651</a></td>
<td>SE.E17</td>
<td>Substantive</td>
<td>Clarified what it means to compare without regard to case.</td>
<td>
<ul>
<li>
<p><a href="#terminology"><b>1.1 Terminology</b></a></p>
</li>
<li>
<p><a href="#XHTML_INCLUDE-CONTENT-TYPE"><b>6.1.13 XHTML Output
Method: the include-content-type Parameter</b></a></p>
</li>
<li>
<p><a href="#HTML_MARKUP"><b>7.1 Markup for Elements</b></a></p>
</li>
<li>
<p><a href="#HTML_ATTRIBS"><b>7.2 Writing Attributes</b></a></p>
</li>
<li>
<p><a href="#HTML_INCLUDE-CONTENT-TYPE"><b>7.4.13 HTML Output
Method: the include-content-type Parameter</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=8206">Bugzilla bug
8206</a></td>
<td>SE.E18</td>
<td>Editorial</td>
<td>Clarified what it means to escape according to HTML or XML
rules.</td>
<td>
<ul>
<li>
<p><a href="#serphases"><b>4 Phases of Serialization</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=6808">Bugzilla bug
6808</a></td>
<td>None</td>
<td>Substantive</td>
<td>Relaxed rules for the XML output method that specify where a
serializer is permitted to add whitespace. This introduces an
incompatibility only inasmuch as the serialized results produced by
a serializer conforming to this specification could differ from the
results a serializer that adheres to <a href=
"#serialization-10-2ed">[XSLT 2.0 and XQuery 1.0 Serialization
(Second Edition)]</a> would be permitted to produce.</td>
<td>
<ul>
<li>
<p><a href="#xml-indent"><b>5.1.3 XML Output Method: the indent and
suppress-indentation Parameters</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=9302">Bugzilla bug
9302</a></td>
<td>None</td>
<td>Substantive</td>
<td>Defined a mechanism for specifying serialization parameter
settings in the form of a data model instance.</td>
<td>
<ul>
<li>
<p><a href="#serparams-in-xdm-instance"><b>3.1 Setting
Serialization Parameters by Means of a Data Model
Instance</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td>None</td>
<td>None</td>
<td>Editorial</td>
<td>Replaced all uses of the words <em>legal</em> and
<em>illegal</em> with more appropriate terms.</td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div class="div2">
<h3><a name="changes-for-1st-WD" id="changes-for-1st-WD"></a>F.4
Changes applied for the first Public Working Draft</h3>
<p>The following changes were applied after the publication of
<a href="#serialization-10-2ed">[XSLT 2.0 and XQuery 1.0
Serialization (Second Edition)]</a> to produce the first Public
Working Draft. None of these changes introduces an incompatibility
with <a href="#serialization-10-2ed">[XSLT 2.0 and XQuery 1.0
Serialization (Second Edition)]</a>.</p>
<table border="1" cellpadding="5" width="100%" summary=
"Changes for first public working draft">
<thead>
<tr>
<td>Bugzilla bug (if applicable)</td>
<td>Erratum (if applicable)</td>
<td>Category</td>
<td>Description of change</td>
<td>Affected sections</td>
</tr>
</thead>
<tbody>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=6723">Bugzilla bug
6723</a></td>
<td>SE.E13</td>
<td>Substantive</td>
<td>Clarified how HTML elements that have no children but whose
content model is not empty are serialized.</td>
<td>
<ul>
<li>
<p><a href="#html-output"><b>7 HTML Output Method</b></a></p>
</li>
<li>
<p><a href="#HTML_MARKUP"><b>7.1 Markup for Elements</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=6732">Bugzilla bug
6732</a></td>
<td>SE.E12</td>
<td>Substantive</td>
<td>Clarified for which versions of XML and HTML this document
makes normative statements.</td>
<td>
<ul>
<li>
<p><a href="#XML_VERSION"><b>5.1.1 XML Output Method: the version
Parameter</b></a></p>
</li>
<li>
<p><a href="#HTML_VERSION"><b>7.4.1 HTML Output Method: the version
Parameter</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td>None</td>
<td>None</td>
<td>Substantive</td>
<td>Take into account presence of function items in a sequence that
is to be serialized.</td>
<td>
<ul>
<li>
<p><a href="#serdm"><b>2 Sequence Normalization</b></a></p>
</li>
</ul>
</td>
</tr>
<tr>
<td>None</td>
<td>None</td>
<td>Editorial</td>
<td>Miscellaneous minor editorial corrections and
improvements.</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>