summaryrefslogtreecommitdiffstats
path: root/libxslt/tests/xmlspec
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2016-11-17 21:21:33 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2016-11-17 21:21:33 (GMT)
commit8705a471f0cb989dca5bed1ac1aa9c982146ceb0 (patch)
treec76eb1b28847599af70596ce7adbfd62ca4985f5 /libxslt/tests/xmlspec
parent8d530e150d787e9a74e27592d4e67a496cd922da (diff)
parent93eaa8f0a22ef3712b9a4bafdc50ba9a7d80ae8f (diff)
downloadblt-8705a471f0cb989dca5bed1ac1aa9c982146ceb0.zip
blt-8705a471f0cb989dca5bed1ac1aa9c982146ceb0.tar.gz
blt-8705a471f0cb989dca5bed1ac1aa9c982146ceb0.tar.bz2
Merge commit '93eaa8f0a22ef3712b9a4bafdc50ba9a7d80ae8f' as 'libxslt'
Diffstat (limited to 'libxslt/tests/xmlspec')
-rw-r--r--libxslt/tests/xmlspec/Makefile.am46
-rw-r--r--libxslt/tests/xmlspec/REC-xml-20001006-review.html2585
-rw-r--r--libxslt/tests/xmlspec/REC-xml-20001006.html2495
-rw-r--r--libxslt/tests/xmlspec/REC-xml-20001006.xml3277
-rw-r--r--libxslt/tests/xmlspec/REC-xml-2e.xsl31
-rw-r--r--libxslt/tests/xmlspec/W3C-REC.css94
-rw-r--r--libxslt/tests/xmlspec/diffspec.xsl329
-rw-r--r--libxslt/tests/xmlspec/logo-RECbin0 -> 778 bytes
-rw-r--r--libxslt/tests/xmlspec/xmlspec-v21.dtd1734
-rw-r--r--libxslt/tests/xmlspec/xmlspec.xsl2092
10 files changed, 12683 insertions, 0 deletions
diff --git a/libxslt/tests/xmlspec/Makefile.am b/libxslt/tests/xmlspec/Makefile.am
new file mode 100644
index 0000000..9770058
--- /dev/null
+++ b/libxslt/tests/xmlspec/Makefile.am
@@ -0,0 +1,46 @@
+## Process this file with automake to produce Makefile.in
+
+$(top_builddir)/xsltproc/xsltproc:
+ @(cd ../../xsltproc ; $(MAKE) xsltproc)
+
+EXTRA_DIST = REC-xml-20001006.xml xmlspec-v21.dtd W3C-REC.css \
+ logo-REC xmlspec.xsl REC-xml-2e.xsl diffspec.xsl \
+ REC-xml-20001006.html REC-xml-20001006-review.html
+
+CLEANFILES = .memdump debug
+
+valgrind:
+ @echo '## Running the regression tests under Valgrind'
+ $(MAKE) CHECKER='libtool --mode=execute valgrind -q --leak-check=full' tests
+
+test tests: $(top_builddir)/xsltproc/xsltproc
+ @echo '## Running xmlspec tests'
+ @(echo > .memdump)
+ @log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc -timing \
+ $(srcdir)/REC-xml-2e.xsl $(srcdir)/REC-xml-20001006.xml \
+ > REC-xml-20001006.out 2> debug ; \
+ diff $(srcdir)/REC-xml-20001006.html REC-xml-20001006.out | \
+ grep -v 'id[0-9]' | grep -v -- '---' | grep -v 100 | grep -v 3866 ; \
+ grep implemented debug | sort | uniq -c || true; \
+ grep " ms$$" debug || true; \
+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true`
+ @if [ -n "$$log" ] ; then \
+ echo REC-xml-20001006 result ; \
+ echo "$$log" ; \
+ fi
+ @rm -f REC-xml-20001006.out
+ @log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+ -timing --param show.diff.markup 1 \
+ $(srcdir)/REC-xml-2e.xsl $(srcdir)/REC-xml-20001006.xml \
+ > REC-xml-20001006-review.out 2> debug ; \
+ diff $(srcdir)/REC-xml-20001006-review.html REC-xml-20001006-review.out | \
+ grep -v 'id[0-9]' | grep -v -- '---' | grep -v 117 | grep -v 4066 ; \
+ grep implemented debug | sort | uniq -c || true; \
+ grep " ms$$" debug || true; \
+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true`
+ @if [ -n "$$log" ] ; then \
+ echo "REC-xml-20001006 (show.diff.markup) result" ; \
+ echo "$$log" ; \
+ fi
+ @rm -f REC-xml-20001006-review.out
+
diff --git a/libxslt/tests/xmlspec/REC-xml-20001006-review.html b/libxslt/tests/xmlspec/REC-xml-20001006-review.html
new file mode 100644
index 0000000..f9e82be
--- /dev/null
+++ b/libxslt/tests/xmlspec/REC-xml-20001006-review.html
@@ -0,0 +1,2585 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="EN"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Extensible Markup Language (XML) 1.0 (Second Edition) -- Review Version</title><style type="text/css">
+code { font-family: monospace; }
+
+div.constraint,
+div.issue,
+div.note,
+div.notice { margin-left: 2em; }
+
+dt.label { display: run-in; }
+
+li p { margin-top: 0.3em;
+ margin-bottom: 0.3em; }
+
+div.diff-add { background-color: yellow }
+div.diff-del { text-decoration: line-through }
+div.diff-chg { background-color: lime }
+div.diff-off { }
+
+span.diff-add { background-color: yellow }
+span.diff-del { text-decoration: line-through }
+span.diff-chg { background-color: lime }
+span.diff-off { }
+
+td.diff-add { background-color: yellow }
+td.diff-del { text-decoration: line-through }
+td.diff-chg { background-color: lime }
+td.diff-off { }
+</style><link rel="stylesheet" type="text/css" href="W3C-REC.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>Extensible Markup Language (XML) 1.0 (Second Edition)</h1>
+<h2>W3C Recommendation 6 October 2000</h2><dl><dt>This version:</dt><dd><a href="http://www.w3.org/TR/2000/REC-xml-20001006">http://www.w3.org/TR/2000/REC-xml-20001006</a>
+(<a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XHTML</a>, <a href="http://www.w3.org/TR/2000/REC-xml-20001006.xml">XML</a>, <a href="http://www.w3.org/TR/2000/REC-xml-20001006.pdf">PDF</a>, <a href="http://www.w3.org/TR/2000/REC-xml-20001006-review.html">XHTML
+review version</a> with color-coded revision indicators)</dd><dt>Latest version:</dt><dd><a href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</a></dd><dt>Previous versions:</dt><dd><a href="http://www.w3.org/TR/2000/WD-xml-2e-20000814"> http://www.w3.org/TR/2000/WD-xml-2e-20000814</a>
+<a href="http://www.w3.org/TR/1998/REC-xml-19980210"> http://www.w3.org/TR/1998/REC-xml-19980210</a> </dd><dt>Editors:</dt>
+<dd>Tim Bray, Textuality and Netscape <a href="mailto:tbray@textuality.com">&lt;tbray@textuality.com&gt;</a></dd>
+<dd>Jean Paoli, Microsoft <a href="mailto:jeanpa@microsoft.com">&lt;jeanpa@microsoft.com&gt;</a></dd>
+<dd><span class="diff-chg">C. M. Sperberg-McQueen, University
+of Illinois at Chicago and Text Encoding Initiative <a href="mailto:cmsmcq@uic.edu">&lt;cmsmcq@uic.edu&gt;</a></span></dd>
+<dd><span class="diff-add">Eve Maler, Sun Microsystems,
+Inc. <a href="mailto:elm@east.sun.com">&lt;eve.maler@east.sun.com&gt;</a> - Second Edition</span></dd>
+</dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2000 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.lcs.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.inria.fr/"><abbr lang="fr" title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr></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>, <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</a>, and <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</a> rules apply.</p></div><hr><div id="abstract">
+<h2><a name="abstract">Abstract</a></h2>
+<p>The Extensible Markup Language (XML) is a subset of SGML that is completely
+described in this document. Its goal is to enable generic SGML to be served,
+received, and processed on the Web in the way that is now possible with HTML.
+XML has been designed for ease of implementation and for interoperability
+with both SGML and HTML.</p>
+</div><div id="status">
+<h2><a name="status">Status of this Document</a></h2>
+<p>This document has been reviewed by W3C Members and other interested parties
+and has been endorsed by the Director as a W3C Recommendation. It is a stable
+document and may be used as reference material or cited as a normative reference
+from another document. W3C's role in making the Recommendation is to draw
+attention to the specification and to promote its widespread deployment. This
+enhances the functionality and interoperability of the Web.</p>
+<p>This document specifies a syntax created by subsetting an existing, widely
+used international text processing standard (Standard Generalized Markup Language,
+ISO 8879:1986(E) as amended and corrected) for use on the World Wide Web.
+It is a product of the W3C XML Activity, details of which can be found at <a href="http://www.w3.org/XML/">http://www.w3.org/XML</a>. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E100">[E100]</a>
+The English version of this specification is the only normative version. However,
+for translations of this document, see <a href="http://www.w3.org/XML/#trans">http://www.w3.org/XML/#trans</a>. </span>A
+list of current W3C Recommendations and other technical documents can be found
+at <a href="http://www.w3.org/TR/">http://www.w3.org/TR</a>.</p>
+<div class="diff-del"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E66">[E66]</a>This
+specification uses the term URI, which is defined by <a href="#Berners-Lee">[Berners-Lee et al.]</a>,
+a work in progress expected to update <a href="#RFC1738">[IETF RFC1738]</a> and <a href="#RFC1808">[IETF RFC1808]</a>.</p></div>
+<div class="diff-add"><p>This second edition is <em>not</em> a new version of XML (first published 10 February 1998);
+it merely incorporates the changes dictated by the first-edition errata (available
+at <a href="http://www.w3.org/XML/xml-19980210-errata">http://www.w3.org/XML/xml-19980210-errata</a>)
+as a convenience to readers. The errata list for this second edition is available
+at <a href="http://www.w3.org/XML/xml-V10-2e-errata">http://www.w3.org/XML/xml-V10-2e-errata</a>.</p></div>
+<p>Please report errors in this document to <a href="mailto:xml-editor@w3.org">xml-editor@w3.org</a><span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E101">[E101]</a>; <a href="http://lists.w3.org/Archives/Public/xml-editor">archives</a> are available</span>.</p>
+<div class="diff-add"><div class="note"><p class="prefix"><b>Note:</b></p>
+<p>C. M. Sperberg-McQueen's affiliation has changed since the publication
+of the first edition. He is now at the World Wide Web Consortium, and can
+be contacted at <a href="mailto:cmsmcq@w3.org">cmsmcq@w3.org</a>.</p>
+</div></div>
+</div>
+<div class="toc">
+<h2><a name="contents">Table of Contents</a></h2><p class="toc">1 <a href="#sec-intro">Introduction</a><br>    1.1 <a href="#sec-origin-goals">Origin and Goals</a><br>    1.2 <a href="#sec-terminology">Terminology</a><br>2 <a href="#sec-documents">Documents</a><br>    2.1 <a href="#sec-well-formed">Well-Formed XML Documents</a><br>    2.2 <a href="#charsets">Characters</a><br>    2.3 <a href="#sec-common-syn">Common Syntactic Constructs</a><br>    2.4 <a href="#syntax">Character Data and Markup</a><br>    2.5 <a href="#sec-comments">Comments</a><br>    2.6 <a href="#sec-pi">Processing Instructions</a><br>    2.7 <a href="#sec-cdata-sect">CDATA Sections</a><br>    2.8 <a href="#sec-prolog-dtd">Prolog and Document Type Declaration</a><br>    2.9 <a href="#sec-rmd">Standalone Document Declaration</a><br>    2.10 <a href="#sec-white-space">White Space Handling</a><br>    2.11 <a href="#sec-line-ends">End-of-Line Handling</a><br>    2.12 <a href="#sec-lang-tag">Language Identification</a><br>3 <a href="#sec-logical-struct">Logical Structures</a><br>    3.1 <a href="#sec-starttags">Start-Tags, End-Tags, and Empty-Element Tags</a><br>    3.2 <a href="#elemdecls">Element Type Declarations</a><br>        3.2.1 <a href="#sec-element-content">Element Content</a><br>        3.2.2 <a href="#sec-mixed-content">Mixed Content</a><br>    3.3 <a href="#attdecls">Attribute-List Declarations</a><br>        3.3.1 <a href="#sec-attribute-types">Attribute Types</a><br>        3.3.2 <a href="#sec-attr-defaults">Attribute Defaults</a><br>        3.3.3 <a href="#AVNormalize">Attribute-Value
+Normalization</a><br>    3.4 <a href="#sec-condition-sect">Conditional Sections</a><br>4 <a href="#sec-physical-struct">Physical Structures</a><br>    4.1 <a href="#sec-references">Character and Entity References</a><br>    4.2 <a href="#sec-entity-decl">Entity Declarations</a><br>        4.2.1 <a href="#sec-internal-ent">Internal Entities</a><br>        4.2.2 <a href="#sec-external-ent">External Entities</a><br>    4.3 <a href="#TextEntities">Parsed Entities</a><br>        4.3.1 <a href="#sec-TextDecl">The Text Declaration</a><br>        4.3.2 <a href="#wf-entities">Well-Formed Parsed Entities</a><br>        4.3.3 <a href="#charencoding">Character Encoding in Entities</a><br>    4.4 <a href="#entproc">XML Processor Treatment of Entities and References</a><br>        4.4.1 <a href="#not-recognized">Not Recognized</a><br>        4.4.2 <a href="#included">Included</a><br>        4.4.3 <a href="#include-if-valid">Included If Validating</a><br>        4.4.4 <a href="#forbidden">Forbidden</a><br>        4.4.5 <a href="#inliteral">Included in Literal</a><br>        4.4.6 <a href="#notify">Notify</a><br>        4.4.7 <a href="#bypass">Bypassed</a><br>        4.4.8 <a href="#as-PE">Included as PE</a><br>    4.5 <a href="#intern-replacement">Construction of Internal Entity Replacement Text</a><br>    4.6 <a href="#sec-predefined-ent">Predefined Entities</a><br>    4.7 <a href="#Notations">Notation Declarations</a><br>    4.8 <a href="#sec-doc-entity">Document Entity</a><br>5 <a href="#sec-conformance">Conformance</a><br>    5.1 <a href="#proc-types">Validating and Non-Validating Processors</a><br>    5.2 <a href="#safe-behavior">Using XML Processors</a><br>6 <a href="#sec-notation">Notation</a><br></p>
+<h3>Appendices</h3><p class="toc">A <a href="#sec-bibliography">References</a><br>    A.1 <a href="#sec-existing-stds">Normative References</a><br>    A.2 <a href="#null">Other References</a><br>B <a href="#CharClasses">Character Classes</a><br>C <a href="#sec-xml-and-sgml">XML and SGML</a> (Non-Normative)<br>D <a href="#sec-entexpand">Expansion of Entity and Character References</a> (Non-Normative)<br>E <a href="#determinism">Deterministic Content Models</a> (Non-Normative)<br>F <a href="#sec-guessing">Autodetection
+of Character Encodings</a> (Non-Normative)<br>    F.1 <a href="#sec-guessing-no-ext-info">Detection Without External Encoding Information</a><br>    F.2 <a href="#sec-guessing-with-ext-info">Priorities in the Presence of External Encoding Information</a><br>G <a href="#sec-xml-wg">W3C XML Working Group</a> (Non-Normative)<br>H <a href="#sec-core-wg">W3C XML Core Group</a> (Non-Normative)<br>I <a href="#id2683713">Production Notes</a> (Non-Normative)<br></p></div><hr><div class="body">
+<div class="div1">
+
+<h2><a name="sec-intro"></a>1 Introduction</h2>
+<p>Extensible Markup Language, abbreviated XML, describes a class of data
+objects called <a title="XML Document" href="#dt-xml-doc">XML documents</a> and partially
+describes the behavior of computer programs which process them. XML is an
+application profile or restricted form of SGML, the Standard Generalized Markup
+Language <a href="#ISO8879">[ISO 8879]</a>. By construction, XML documents are conforming
+SGML documents.</p>
+<p>XML documents are made up of storage units called <a title="Entity" href="#dt-entity">entities</a>,
+which contain either parsed or unparsed data. Parsed data is made up of <a title="Character" href="#dt-character">characters</a>, some of which form <a title="Character Data" href="#dt-chardata">character
+data</a>, and some of which form <a title="Markup" href="#dt-markup">markup</a>.
+Markup encodes a description of the document's storage layout and logical
+structure. XML provides a mechanism to impose constraints on the storage layout
+and logical structure.</p>
+<p>[<a name="dt-xml-proc" title="XML Processor">Definition</a>: A software module called
+an <b>XML processor</b> is used to read XML documents and provide access
+to their content and structure.] [<a name="dt-app" title="Application">Definition</a>: It
+is assumed that an XML processor is doing its work on behalf of another module,
+called the <b>application</b>.] This specification describes
+the required behavior of an XML processor in terms of how it must read XML
+data and the information it must provide to the application.</p>
+<div class="div2">
+
+<h3><a name="sec-origin-goals"></a>1.1 Origin and Goals</h3>
+<p>XML was developed by an XML Working Group (originally known as the SGML
+Editorial Review Board) formed under the auspices of the World Wide Web Consortium
+(W3C) in 1996. It was chaired by Jon Bosak of Sun Microsystems with the active
+participation of an XML Special Interest Group (previously known as the SGML
+Working Group) also organized by the W3C. The membership of the XML Working
+Group is given in an appendix. Dan Connolly served as the WG's contact with
+the W3C.</p>
+<p>The design goals for XML are:</p>
+<ol>
+<li><p>XML shall be straightforwardly usable over the Internet.</p></li>
+<li><p>XML shall support a wide variety of applications.</p></li>
+<li><p>XML shall be compatible with SGML.</p></li>
+<li><p>It shall be easy to write programs which process XML documents.</p>
+</li>
+<li><p>The number of optional features in XML is to be kept to the absolute
+minimum, ideally zero.</p></li>
+<li><p>XML documents should be human-legible and reasonably clear.</p></li>
+<li><p>The XML design should be prepared quickly.</p></li>
+<li><p>The design of XML shall be formal and concise.</p></li>
+<li><p>XML documents shall be easy to create.</p></li>
+<li><p>Terseness in XML markup is of minimal importance.</p></li>
+</ol>
+<p>This specification, together with associated standards (Unicode and ISO/IEC
+10646 for characters, Internet RFC 1766 for language identification tags,
+ISO 639 for language name codes, and ISO 3166 for country name codes), provides
+all the information necessary to understand XML Version 1.0 and
+construct computer programs to process it.</p>
+<p>This version of the XML specification may be distributed freely, as long as
+all text and legal notices remain intact.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-terminology"></a>1.2 Terminology</h3>
+<p>The terminology used to describe XML documents is defined in the body of
+this specification. The terms defined in the following list are used in building
+those definitions and in describing the actions of an XML processor: </p><dl>
+<dt class="label">may</dt>
+<dd>
+<p>[<a name="dt-may" title="May">Definition</a>: Conforming documents and XML processors
+are permitted to but need not behave as described.]</p>
+</dd>
+<dt class="label">must</dt>
+<dd>
+<p>[<a name="dt-must" title="Must">Definition</a>: Conforming documents and XML processors
+are required to behave as described; otherwise they are in error. ]</p>
+</dd>
+<dt class="label">error</dt>
+<dd>
+<p>[<a name="dt-error" title="Error">Definition</a>: A violation of the rules of this specification;
+results are undefined. Conforming software may detect and report an error
+and may recover from it.]</p>
+</dd>
+<dt class="label">fatal error</dt>
+<dd>
+<p>[<a name="dt-fatal" title="Fatal Error">Definition</a>: An error which a conforming <a title="XML Processor" href="#dt-xml-proc">XML processor</a> must detect and report to the application.
+After encountering a fatal error, the processor may continue processing the
+data to search for further errors and may report such errors to the application.
+In order to support correction of errors, the processor may make unprocessed
+data from the document (with intermingled character data and markup) available
+to the application. Once a fatal error is detected, however, the processor
+must not continue normal processing (i.e., it must not continue to pass character
+data and information about the document's logical structure to the application
+in the normal way).]</p>
+</dd>
+<dt class="label">at user option</dt>
+<dd>
+<p>[<a name="dt-atuseroption" title="At user option">Definition</a>: Conforming software
+may or must (depending on the modal verb in the sentence) behave as described;
+if it does, it must provide users a means to enable or disable the behavior
+described.]</p>
+</dd>
+<dt class="label">validity constraint</dt>
+<dd>
+<p>[<a name="dt-vc" title="Validity constraint">Definition</a>: A rule which applies to
+all <a title="Validity" href="#dt-valid">valid</a> XML documents. Violations of validity
+constraints are errors; they must, at user option, be reported by <a title="Validating Processor" href="#dt-validating">validating XML processors</a>.]</p>
+</dd>
+<dt class="label">well-formedness constraint</dt>
+<dd>
+<p>[<a name="dt-wfc" title="Well-formedness constraint">Definition</a>: A rule which applies
+to all <a title="Well-Formed" href="#dt-wellformed">well-formed</a> XML documents. Violations
+of well-formedness constraints are <a title="Fatal Error" href="#dt-fatal">fatal errors</a>.]</p>
+</dd>
+<dt class="label">match</dt>
+<dd>
+<p>[<a name="dt-match" title="match">Definition</a>: (Of strings or names:) Two strings
+or names being compared must be identical. Characters with multiple possible
+representations in ISO/IEC 10646 (e.g. characters with both precomposed and
+base+diacritic forms) match only if they have the same representation in both
+strings. <span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E85">[E85]</a>At
+user option, processors may normalize such characters to some canonical form. </span>No
+case folding is performed. (Of strings and rules in the grammar:) A string
+matches a grammatical production if it belongs to the language generated by
+that production. (Of content and content models:) An element matches its declaration
+when it conforms in the fashion described in the constraint <a href="#elementvalid"><b>[VC: Element Valid]</b></a>.]</p>
+</dd>
+<dt class="label">for compatibility</dt>
+<dd>
+<p>[<a name="dt-compat" title="For Compatibility">Definition</a>: <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E87">[E87]</a>Marks
+a sentence describing</span> a feature of XML included solely to ensure
+that XML remains compatible with SGML.]</p>
+</dd>
+<dt class="label">for interoperability</dt>
+<dd>
+<p>[<a name="dt-interop" title="For interoperability">Definition</a>: <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E87">[E87]</a>Marks
+a sentence describing</span> a non-binding recommendation included to increase
+the chances that XML documents can be processed by the existing installed
+base of SGML processors which predate the WebSGML Adaptations Annex to ISO 8879.]</p>
+</dd>
+</dl><p></p>
+</div>
+</div>
+
+<div class="div1">
+
+<h2><a name="sec-documents"></a>2 Documents</h2>
+<p>[<a name="dt-xml-doc" title="XML Document">Definition</a>: A data object is an <b>XML
+document</b> if it is <a title="Well-Formed" href="#dt-wellformed">well-formed</a>,
+as defined in this specification. A well-formed XML document may in addition
+be <a title="Validity" href="#dt-valid">valid</a> if it meets certain further constraints.]</p>
+<p>Each XML document has both a logical and a physical structure. Physically,
+the document is composed of units called <a title="Entity" href="#dt-entity">entities</a>.
+An entity may <a title="Entity Reference" href="#dt-entref">refer</a> to other entities to
+cause their inclusion in the document. A document begins in a "root"
+or <a title="Document Entity" href="#dt-docent">document entity</a>. Logically, the document
+is composed of declarations, elements, comments, character references, and
+processing instructions, all of which are indicated in the document by explicit
+markup. The logical and physical structures must nest properly, as described
+in <a href="#wf-entities"><b>4.3.2 Well-Formed Parsed Entities</b></a>.</p>
+<div class="div2">
+
+<h3><a name="sec-well-formed"></a>2.1 Well-Formed XML Documents</h3>
+<p>[<a name="dt-wellformed" title="Well-Formed">Definition</a>: A textual object is a <b>well-formed</b>
+XML document if:]</p>
+<ol>
+<li><p>Taken as a whole, it matches the production labeled <a href="#NT-document">document</a>.</p>
+</li>
+<li><p>It meets all the well-formedness constraints given in this specification.</p>
+</li>
+<li><p>Each of the <a title="Text Entity" href="#dt-parsedent">parsed entities</a>
+which is referenced directly or indirectly within the document is <a title="Well-Formed" href="#dt-wellformed">well-formed</a>.</p></li>
+</ol>
+
+<h5>Document</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-document"></a>[1]   </td><td><code>document</code></td><td>   ::=   </td><td><code><a href="#NT-prolog">prolog</a> <a href="#NT-element">element</a> <a href="#NT-Misc">Misc</a>*</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>Matching the <a href="#NT-document">document</a> production implies that:</p>
+<ol>
+<li><p>It contains one or more <a title="Element" href="#dt-element">elements</a>.</p>
+</li>
+
+<li><p>[<a name="dt-root" title="Root Element">Definition</a>: There is exactly one element,
+called the <b>root</b>, or document element, no part of which appears
+in the <a title="Content" href="#dt-content">content</a> of any other element.] <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E17">[E17]</a>For
+all other elements, if the <a title="Start-Tag" href="#dt-stag">start-tag</a> is in
+the content of another element, the <a title="End Tag" href="#dt-etag">end-tag</a>
+is in the content of the same element.</span> More simply stated, the elements,
+delimited by start- and end-tags, nest properly within each other.</p></li>
+</ol>
+<p>[<a name="dt-parentchild" title="Parent/Child">Definition</a>: As a consequence of this,
+for each non-root element <code>C</code> in the document, there is one other element <code>P</code>
+in the document such that <code>C</code> is in the content of <code>P</code>, but
+is not in the content of any other element that is in the content of <code>P</code>. <code>P</code>
+is referred to as the <b>parent</b> of <code>C</code>, and <code>C</code> as
+a <b>child</b> of <code>P</code>.]</p>
+</div>
+<div class="div2">
+
+<h3><a name="charsets"></a>2.2 Characters</h3>
+<p>[<a name="dt-text" title="Text">Definition</a>: A parsed entity contains <b>text</b>,
+a sequence of <a title="Character" href="#dt-character">characters</a>, which may
+represent markup or character data.] [<a name="dt-character" title="Character">Definition</a>: A <b>character</b>
+is an atomic unit of text as specified by ISO/IEC 10646 <a href="#ISO10646">[ISO/IEC 10646]</a> <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</a>(see
+also <a href="#ISO10646-2000">[ISO/IEC 10646-2000]</a>)</span>. Legal characters are tab, carriage
+return, line feed, and the legal <span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E35">[E35]</a>graphic </span>characters
+of Unicode and ISO/IEC 10646. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E69">[E69]</a>The
+versions of these standards cited in <a href="#sec-existing-stds"><b>A.1 Normative References</b></a> were
+current at the time this document was prepared. New characters may be added
+to these standards by amendments or new editions. Consequently, XML processors
+must accept any character in the range specified for <a href="#NT-Char">Char</a>.</span>
+The use of "compatibility characters", as defined in section
+6.8 of <a href="#Unicode">[Unicode]</a> <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</a>(see
+also D21 in section 3.6 of <a href="#Unicode3">[Unicode3]</a>)</span>, is discouraged.]</p>
+
+<h5>Character Range</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-Char"></a>[2]   </td><td><code>Char</code></td><td>   ::=   </td><td><code>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]</code></td><xsltdebug></xsltdebug><td><i>/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */</i></td></tr>
+</tbody></table>
+<p>The mechanism for encoding character code points into bit patterns may
+vary from entity to entity. All XML processors must accept the UTF-8 and UTF-16
+encodings of 10646; the mechanisms for signaling which of the two is in use,
+or for bringing other encodings into play, are discussed later, in <a href="#charencoding"><b>4.3.3 Character Encoding in Entities</b></a>.</p>
+
+</div>
+<div class="div2">
+
+<h3><a name="sec-common-syn"></a>2.3 Common Syntactic Constructs</h3>
+<p>This section defines some symbols used widely in the grammar.</p>
+<p><a href="#NT-S">S</a> (white space) consists of one or more space (#x20)
+characters, carriage returns, line feeds, or tabs.</p>
+
+<h5>White Space</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-S"></a>[3]   </td><td><code>S</code></td><td>   ::=   </td><td><code>(#x20 | #x9 | #xD | #xA)+</code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>Characters are classified for convenience as letters, digits, or other
+characters. <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E30">[E30]</a>A
+letter consists of an alphabetic or syllabic base character or an ideographic
+character.</span> Full definitions of the specific characters in each class
+are given in <a href="#CharClasses"><b>B Character Classes</b></a>.</p>
+<p>[<a name="dt-name" title="Name">Definition</a>: A <b>Name</b> is a token beginning
+with a letter or one of a few punctuation characters, and continuing with
+letters, digits, hyphens, underscores, colons, or full stops, together known
+as name characters.] Names beginning with the string "<code>xml</code>",
+or any string which would match <code>(('X'|'x') ('M'|'m') ('L'|'l'))</code>,
+are reserved for standardization in this or future versions of this specification.</p>
+<div class="note"><p class="prefix"><b>Note:</b></p>
+<div class="diff-chg"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E98">[E98]</a>The
+Namespaces in XML Recommendation <a href="#xml-names">[XML Names]</a> assigns a meaning
+to names containing colon characters. Therefore, authors should not use the
+colon in XML names except for namespace purposes, but XML processors must
+accept the colon as a name character.</p></div>
+</div>
+<p>An <a href="#NT-Nmtoken">Nmtoken</a> (name token) is any mixture of name
+characters.</p>
+
+<h5>Names and Tokens</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-NameChar"></a>[4]   </td><td><code>NameChar</code></td><td>   ::=   </td><td><code><a href="#NT-Letter">Letter</a> | <a href="#NT-Digit">Digit</a>
+| '.' | '-' | '_' | ':' | <a href="#NT-CombiningChar">CombiningChar</a> | <a href="#NT-Extender">Extender</a></code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Name"></a>[5]   </td><td><code>Name</code></td><td>   ::=   </td><td><code>(<a href="#NT-Letter">Letter</a> | '_' | ':') (<a href="#NT-NameChar">NameChar</a>)*</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Names"></a>[6]   </td><td><code>Names</code></td><td>   ::=   </td><td><code><a href="#NT-Name">Name</a> (<a href="#NT-S">S</a> <a href="#NT-Name">Name</a>)*</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Nmtoken"></a>[7]   </td><td><code>Nmtoken</code></td><td>   ::=   </td><td><code>(<a href="#NT-NameChar">NameChar</a>)+</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Nmtokens"></a>[8]   </td><td><code>Nmtokens</code></td><td>   ::=   </td><td><code><a href="#NT-Nmtoken">Nmtoken</a> (<a href="#NT-S">S</a> <a href="#NT-Nmtoken">Nmtoken</a>)*</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>Literal data is any quoted string not containing the quotation mark used
+as a delimiter for that string. Literals are used for specifying the content
+of internal entities (<a href="#NT-EntityValue">EntityValue</a>), the values
+of attributes (<a href="#NT-AttValue">AttValue</a>), and external identifiers
+(<a href="#NT-SystemLiteral">SystemLiteral</a>). Note that a <a href="#NT-SystemLiteral">SystemLiteral</a>
+can be parsed without scanning for markup.</p>
+
+<h5>Literals</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-EntityValue"></a>[9]   </td><td><code>EntityValue</code></td><td>   ::=   </td><td><code>'"' ([^%&amp;"] | <a href="#NT-PEReference">PEReference</a>
+| <a href="#NT-Reference">Reference</a>)* '"' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>|  "'" ([^%&amp;'] | <a href="#NT-PEReference">PEReference</a> | <a href="#NT-Reference">Reference</a>)* "'"</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-AttValue"></a>[10]   </td><td><code>AttValue</code></td><td>   ::=   </td><td><code>'"' ([^&lt;&amp;"] | <a href="#NT-Reference">Reference</a>)*
+'"' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>|  "'" ([^&lt;&amp;'] | <a href="#NT-Reference">Reference</a>)*
+"'"</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-SystemLiteral"></a>[11]   </td><td><code>SystemLiteral</code></td><td>   ::=   </td><td><code>('"' [^"]* '"') | ("'" [^']* "'") </code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PubidLiteral"></a>[12]   </td><td><code>PubidLiteral</code></td><td>   ::=   </td><td><code>'"' <a href="#NT-PubidChar">PubidChar</a>* '"'
+| "'" (<a href="#NT-PubidChar">PubidChar</a> - "'")* "'"</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PubidChar"></a>[13]   </td><td><code>PubidChar</code></td><td>   ::=   </td><td><code>#x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<div class="diff-add"><div class="note"><p class="prefix"><b>Note:</b></p>
+<p><a href="http://www.w3.org/XML/xml-19980210-errata#E72">[E72]</a>Although
+the <a href="#NT-EntityValue">EntityValue</a> production allows the definition
+of an entity consisting of a single explicit <code>&lt;</code> in the literal
+(e.g., <code>&lt;!ENTITY mylt "&lt;"&gt;</code>), it is strongly advised to avoid
+this practice since any reference to that entity will cause a well-formedness
+error.</p>
+</div></div>
+</div>
+<div class="div2">
+
+<h3><a name="syntax"></a>2.4 Character Data and Markup</h3>
+<p><a title="Text" href="#dt-text">Text</a> consists of intermingled <a title="Character Data" href="#dt-chardata">character data</a> and markup. [<a name="dt-markup" title="Markup">Definition</a>: <b>Markup</b> takes the form of <a title="Start-Tag" href="#dt-stag">start-tags</a>, <a title="End Tag" href="#dt-etag">end-tags</a>, <a title="Empty" href="#dt-empty">empty-element tags</a>, <a title="Entity Reference" href="#dt-entref">entity references</a>, <a title="Character Reference" href="#dt-charref">character
+references</a>, <a title="Comment" href="#dt-comment">comments</a>, <a title="CDATA Section" href="#dt-cdsection">CDATA section</a> delimiters, <a title="Document Type Declaration" href="#dt-doctype">document
+type declarations</a>, <a title="Processing instruction" href="#dt-pi">processing instructions</a>, <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E89">[E89]</a><a href="#NT-XMLDecl">XML declarations</a>, <a href="#NT-TextDecl">text declarations</a>,
+and any white space that is at the top level of the document entity (that
+is, outside the document element and not inside any other markup).</span>]</p>
+<p>[<a name="dt-chardata" title="Character Data">Definition</a>: All text that is not markup
+constitutes the <b>character data</b> of the document.]</p>
+<p>The ampersand character (&amp;) and the left angle bracket (&lt;) may appear
+in their literal form <em>only</em> when used as markup delimiters, or
+within a <a title="Comment" href="#dt-comment">comment</a>, a <a title="Processing instruction" href="#dt-pi">processing
+instruction</a>, or a <a title="CDATA Section" href="#dt-cdsection">CDATA section</a>.<span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E18">[E18]</a>They
+are also legal within the <a title="Literal Entity Value" href="#dt-litentval">literal entity value</a>
+of an internal entity declaration; see <a href="#wf-entities"><b>4.3.2 Well-Formed Parsed Entities</b></a>.</span>
+If they are needed elsewhere, they must be <a title="escape" href="#dt-escape">escaped</a>
+using either <a title="Character Reference" href="#dt-charref">numeric character references</a>
+or the strings "<code>&amp;amp;</code>" and "<code>&amp;lt;</code>"
+respectively. The right angle bracket (&gt;) may be represented using the string "<code>&amp;gt;</code>",
+and must, <a title="For Compatibility" href="#dt-compat">for compatibility</a>, be escaped
+using "<code>&amp;gt;</code>" or a character reference when it
+appears in the string "<code>]]&gt;</code>" in content, when
+that string is not marking the end of a <a title="CDATA Section" href="#dt-cdsection">CDATA
+section</a>.</p>
+<p>In the content of elements, character data is any string of characters
+which does not contain the start-delimiter of any markup. In a CDATA section,
+character data is any string of characters not including the CDATA-section-close
+delimiter, "<code>]]&gt;</code>".</p>
+<p>To allow attribute values to contain both single and double quotes, the
+apostrophe or single-quote character (') may be represented as "<code>&amp;apos;</code>",
+and the double-quote character (") as "<code>&amp;quot;</code>".</p>
+
+<h5>Character Data</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-CharData"></a>[14]   </td><td><code>CharData</code></td><td>   ::=   </td><td><code>[^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;' [^&lt;&amp;]*)</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+</div>
+<div class="div2">
+
+<h3><a name="sec-comments"></a>2.5 Comments</h3>
+<p>[<a name="dt-comment" title="Comment">Definition</a>: <b>Comments</b> may appear
+anywhere in a document outside other <a title="Markup" href="#dt-markup">markup</a>;
+in addition, they may appear within the document type declaration at places
+allowed by the grammar. They are not part of the document's <a title="Character Data" href="#dt-chardata">character
+data</a>; an XML processor may, but need not, make it possible for an
+application to retrieve the text of comments. <a title="For Compatibility" href="#dt-compat">For
+compatibility</a>, the string "<code>--</code>" (double-hyphen)
+must not occur within comments.] <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E63">[E63]</a>Parameter
+entity references are not recognized within comments.</span></p>
+
+<h5>Comments</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-Comment"></a>[15]   </td><td><code>Comment</code></td><td>   ::=   </td><td><code>'&lt;!--' ((<a href="#NT-Char">Char</a> - '-') | ('-'
+(<a href="#NT-Char">Char</a> - '-')))* '--&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>An example of a comment:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!-- declarations for &lt;head&gt; &amp; &lt;body&gt; --&gt;</pre></td></tr></table>
+<div class="diff-add"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E27">[E27]</a>Note
+that the grammar does not allow a comment ending in <code>---&gt;</code>. The
+following example is <em>not</em> well-formed.</p></div>
+<div class="diff-add"><table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td class="diff-add"><pre>&lt;!-- B+, B, or B---&gt;</pre></td></tr></table></div>
+</div>
+<div class="div2">
+
+<h3><a name="sec-pi"></a>2.6 Processing Instructions</h3>
+<p>[<a name="dt-pi" title="Processing instruction">Definition</a>: <b>Processing instructions</b>
+(PIs) allow documents to contain instructions for applications.]</p>
+
+<h5>Processing Instructions</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-PI"></a>[16]   </td><td><code>PI</code></td><td>   ::=   </td><td><code>'&lt;?' <a href="#NT-PITarget">PITarget</a> (<a href="#NT-S">S</a>
+(<a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a>* '?&gt;' <a href="#NT-Char">Char</a>*)))? '?&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PITarget"></a>[17]   </td><td><code>PITarget</code></td><td>   ::=   </td><td><code><a href="#NT-Name">Name</a> - (('X' | 'x') ('M' |
+'m') ('L' | 'l'))</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>PIs are not part of the document's <a title="Character Data" href="#dt-chardata">character
+data</a>, but must be passed through to the application. The PI begins
+with a target (<a href="#NT-PITarget">PITarget</a>) used to identify the application
+to which the instruction is directed. The target names "<code>XML</code>", "<code>xml</code>",
+and so on are reserved for standardization in this or future versions of this
+specification. The XML <a title="Notation" href="#dt-notation">Notation</a> mechanism
+may be used for formal declaration of PI targets. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E63">[E63]</a>Parameter
+entity references are not recognized within processing instructions.</span></p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-cdata-sect"></a>2.7 CDATA Sections</h3>
+<p>[<a name="dt-cdsection" title="CDATA Section">Definition</a>: <b>CDATA sections</b>
+may occur anywhere character data may occur; they are used to escape blocks
+of text containing characters which would otherwise be recognized as markup.
+CDATA sections begin with the string "<code>&lt;![CDATA[</code>"
+and end with the string "<code>]]&gt;</code>":]</p>
+
+<h5>CDATA Sections</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-CDSect"></a>[18]   </td><td><code>CDSect</code></td><td>   ::=   </td><td><code><a href="#NT-CDStart">CDStart</a> <a href="#NT-CData">CData</a> <a href="#NT-CDEnd">CDEnd</a></code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-CDStart"></a>[19]   </td><td><code>CDStart</code></td><td>   ::=   </td><td><code>'&lt;![CDATA['</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-CData"></a>[20]   </td><td><code>CData</code></td><td>   ::=   </td><td><code>(<a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a>*
+']]&gt;' <a href="#NT-Char">Char</a>*)) </code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-CDEnd"></a>[21]   </td><td><code>CDEnd</code></td><td>   ::=   </td><td><code>']]&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>Within a CDATA section, only the <a href="#NT-CDEnd">CDEnd</a> string is
+recognized as markup, so that left angle brackets and ampersands may occur
+in their literal form; they need not (and cannot) be escaped using "<code>&amp;lt;</code>"
+and "<code>&amp;amp;</code>". CDATA sections cannot nest.</p>
+<p>An example of a CDATA section, in which "<code>&lt;greeting&gt;</code>"
+and "<code>&lt;/greeting&gt;</code>" are recognized as <a title="Character Data" href="#dt-chardata">character data</a>, not <a title="Markup" href="#dt-markup">markup</a>:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;![CDATA[&lt;greeting&gt;Hello, world!&lt;/greeting&gt;]]&gt; </pre></td></tr></table>
+</div>
+<div class="div2">
+
+<h3><a name="sec-prolog-dtd"></a>2.8 Prolog and Document Type Declaration</h3>
+<p>[<a name="dt-xmldecl" title="XML Declaration">Definition</a>: XML documents <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E107">[E107]</a>should</span>
+begin with an <b>XML declaration</b> which specifies the version of
+XML being used.] For example, the following is a complete XML document, <a title="Well-Formed" href="#dt-wellformed">well-formed</a> but not <a title="Validity" href="#dt-valid">valid</a>:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml version="1.0"?&gt; &lt;greeting&gt;Hello, world!&lt;/greeting&gt; </pre></td></tr></table>
+<p>and so is this:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;greeting&gt;Hello, world!&lt;/greeting&gt;</pre></td></tr></table>
+<p>The version number "<code>1.0</code>" should be used to indicate
+conformance to this version of this specification; it is an error for a document
+to use the value "<code>1.0</code>" if it does not conform to
+this version of this specification. It is the intent of the XML working group
+to give later versions of this specification numbers other than "<code>1.0</code>",
+but this intent does not indicate a commitment to produce any future versions
+of XML, nor if any are produced, to use any particular numbering scheme. Since
+future versions are not ruled out, this construct is provided as a means to
+allow the possibility of automatic version recognition, should it become necessary.
+Processors may signal an error if they receive documents labeled with versions
+they do not support.</p>
+<p>The function of the markup in an XML document is to describe its storage
+and logical structure and to associate attribute-value pairs with its logical
+structures. XML provides a mechanism, the <a title="Document Type Declaration" href="#dt-doctype">document
+type declaration</a>, to define constraints on the logical structure
+and to support the use of predefined storage units. [<a name="dt-valid" title="Validity">Definition</a>: An XML document is <b>valid</b> if it has an associated
+document type declaration and if the document complies with the constraints
+expressed in it.]</p>
+<p>The document type declaration must appear before the first <a title="Element" href="#dt-element">element</a>
+in the document.</p>
+
+<h5>Prolog</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-prolog"></a>[22]   </td><td><code>prolog</code></td><td>   ::=   </td><td><code><a href="#NT-XMLDecl">XMLDecl</a>? <a href="#NT-Misc">Misc</a>*
+(<a href="#NT-doctypedecl">doctypedecl</a> <a href="#NT-Misc">Misc</a>*)?</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-XMLDecl"></a>[23]   </td><td><code>XMLDecl</code></td><td>   ::=   </td><td><code>'&lt;?xml' <a href="#NT-VersionInfo">VersionInfo</a> <a href="#NT-EncodingDecl">EncodingDecl</a>? <a href="#NT-SDDecl">SDDecl</a>? <a href="#NT-S">S</a>? '?&gt;'</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td class="diff-chg"><a name="NT-VersionInfo"></a>[24]   </td><td class="diff-chg"><code>VersionInfo</code></td><td class="diff-chg">   ::=   </td><td class="diff-chg"><code><a href="#NT-S">S</a> 'version' <a href="#NT-Eq">Eq</a>
+("'" <a href="#NT-VersionNum">VersionNum</a> "'" | '"' <a href="#NT-VersionNum">VersionNum</a>
+'"')<i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E15">[E15]</a> */</i></code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Eq"></a>[25]   </td><td><code>Eq</code></td><td>   ::=   </td><td><code><a href="#NT-S">S</a>? '=' <a href="#NT-S">S</a>?</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-VersionNum"></a>[26]   </td><td><code>VersionNum</code></td><td>   ::=   </td><td><code>([a-zA-Z0-9_.:] | '-')+</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Misc"></a>[27]   </td><td><code>Misc</code></td><td>   ::=   </td><td><code><a href="#NT-Comment">Comment</a> | <a href="#NT-PI">PI</a>
+| <a href="#NT-S">S</a></code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>[<a name="dt-doctype" title="Document Type Declaration">Definition</a>: The XML <b>document
+type declaration</b> contains or points to <a title="markup declaration" href="#dt-markupdecl">markup
+declarations</a> that provide a grammar for a class of documents. This
+grammar is known as a document type definition, or <b>DTD</b>. The document
+type declaration can point to an external subset (a special kind of <a title="External Entity" href="#dt-extent">external entity</a>) containing markup declarations,
+or can contain the markup declarations directly in an internal subset, or
+can do both. The DTD for a document consists of both subsets taken together.]</p>
+<p>[<a name="dt-markupdecl" title="markup declaration">Definition</a>: A <b>markup declaration</b>
+is an <a title="Element Type declaration" href="#dt-eldecl">element type declaration</a>, an <a title="Attribute-List Declaration" href="#dt-attdecl">attribute-list declaration</a>, an <a title="entity declaration" href="#dt-entdecl">entity
+declaration</a>, or a <a title="Notation Declaration" href="#dt-notdecl">notation declaration</a>.]
+These declarations may be contained in whole or in part within <a title="Parameter entity" href="#dt-PE">parameter
+entities</a>, as described in the well-formedness and validity constraints
+below. For <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E14">[E14]</a>further</span>
+information, see <a href="#sec-physical-struct"><b>4 Physical Structures</b></a>.</p>
+
+<h5>Document Type Definition</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td class="diff-chg"><a name="NT-doctypedecl"></a>[28]   </td><td class="diff-chg"><code>doctypedecl</code></td><td class="diff-chg">   ::=   </td><td class="diff-chg"><code>'&lt;!DOCTYPE' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a>
+(<a href="#NT-S">S</a> <a href="#NT-ExternalID">ExternalID</a>)? <a href="#NT-S">S</a>?
+('[' (<a href="#NT-markupdecl">markupdecl</a> | <a href="#NT-DeclSep">DeclSep</a>)*
+']' <a href="#NT-S">S</a>?)? '&gt;'</code></td><xsltdebug></xsltdebug><td><a href="#vc-roottype">[VC: Root Element Type]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-add"><a href="#ExtSubset">[WFC: External
+Subset]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-chg"><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a> */</i></td></tr>
+<tr valign="baseline"><td class="diff-add"><a name="NT-DeclSep"></a>[28a]   </td><td class="diff-add"><code>DeclSep</code></td><td class="diff-add">   ::=   </td><td class="diff-add"><code><a href="#NT-PEReference">PEReference</a> | <a href="#NT-S">S</a></code></td><xsltdebug></xsltdebug><td class="diff-add"><a href="#PE-between-Decls">[WFC: PE
+Between Declarations]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-add"><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a> */</i></td></tr>
+<tr valign="baseline"><td><a name="NT-markupdecl"></a>[29]   </td><td><code>markupdecl</code></td><td>   ::=   </td><td><code><a href="#NT-elementdecl">elementdecl</a> | <a href="#NT-AttlistDecl">AttlistDecl</a> | <a href="#NT-EntityDecl">EntityDecl</a>
+| <a href="#NT-NotationDecl">NotationDecl</a> | <a href="#NT-PI">PI</a> | <a href="#NT-Comment">Comment</a> </code></td><xsltdebug></xsltdebug><td><a href="#vc-PEinMarkupDecl">[VC: Proper Declaration/PE Nesting]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#wfc-PEinInternalSubset">[WFC: PEs in Internal Subset]</a></td></tr>
+</tbody></table>
+<div class="diff-add"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E82">[E82]</a>Note
+that it is possible to construct a well-formed document containing a <a href="#NT-doctypedecl">doctypedecl</a>
+that neither points to an external subset nor contains an internal subset.</p></div>
+<p>The markup declarations may be made up in whole or in part of the <a title="Replacement Text" href="#dt-repltext">replacement text</a> of <a title="Parameter entity" href="#dt-PE">parameter
+entities</a>. The productions later in this specification for individual
+nonterminals (<a href="#NT-elementdecl">elementdecl</a>, <a href="#NT-AttlistDecl">AttlistDecl</a>,
+and so on) describe the declarations <em>after</em> all the parameter
+entities have been <a title="Include" href="#dt-include">included</a>.</p>
+<div class="diff-add"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E75">[E75]</a>Parameter
+entity references are recognized anywhere in the DTD (internal and external
+subsets and external parameter entities), except in literals, processing instructions,
+comments, and the contents of ignored conditional sections (see <a href="#sec-condition-sect"><b>3.4 Conditional Sections</b></a>).
+They are also recognized in entity value literals. The use of parameter entities
+in the internal subset is restricted as described below.</p></div>
+<div class="constraint"><p class="prefix"><a name="vc-roottype"></a><b>Validity constraint: Root Element Type</b></p><p>The <a href="#NT-Name">Name</a>
+in the document type declaration must match the element type of the <a title="Root Element" href="#dt-root">root element</a>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="vc-PEinMarkupDecl"></a><b>Validity constraint: Proper Declaration/PE Nesting</b></p>
+<p>Parameter-entity <a title="Replacement Text" href="#dt-repltext">replacement text</a>
+must be properly nested with markup declarations. That is to say, if either
+the first character or the last character of a markup declaration (<a href="#NT-markupdecl">markupdecl</a>
+above) is contained in the replacement text for a <a title="Parameter-entity reference" href="#dt-PERef">parameter-entity
+reference</a>, both must be contained in the same replacement text.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="wfc-PEinInternalSubset"></a><b>Well-formedness constraint: PEs in Internal Subset</b></p><p>In
+the internal DTD subset, <a title="Parameter-entity reference" href="#dt-PERef">parameter-entity references</a>
+can occur only where markup declarations can occur, not within markup declarations.
+(This does not apply to references that occur in external parameter entities
+or to the external subset.)</p>
+</div>
+<div class="diff-add"><div class="constraint"><p class="prefix"><a name="ExtSubset"></a><b>Well-formedness constraint: <a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a>External
+Subset</b></p><p>The external subset, if any, must match the production for <a href="#NT-extSubset">extSubset</a>.</p>
+</div></div>
+<div class="diff-add"><div class="constraint"><p class="prefix"><a name="PE-between-Decls"></a><b>Well-formedness constraint: <a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a>PE
+Between Declarations</b></p><p>The replacement text of a parameter entity reference
+in a <a href="#NT-DeclSep">DeclSep</a> must match the production <a href="#NT-extSubsetDecl">extSubsetDecl</a>.</p>
+</div></div>
+<p>Like the internal subset, the external subset and any external parameter
+entities <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a>referenced
+in a <a href="#NT-DeclSep">DeclSep</a></span> must consist of a series of
+complete markup declarations of the types allowed by the non-terminal symbol <a href="#NT-markupdecl">markupdecl</a>, interspersed with white space or <a title="Parameter-entity reference" href="#dt-PERef">parameter-entity references</a>. However, portions of
+the contents of the external subset or of <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a>these </span>
+external parameter entities may conditionally be ignored by using the <a title="conditional section" href="#dt-cond-section">conditional section</a> construct; this is not
+allowed in the internal subset.</p>
+
+<h5>External Subset</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-extSubset"></a>[30]   </td><td><code>extSubset</code></td><td>   ::=   </td><td><code><a href="#NT-TextDecl">TextDecl</a>? <a href="#NT-extSubsetDecl">extSubsetDecl</a></code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td class="diff-chg"><a name="NT-extSubsetDecl"></a>[31]   </td><td class="diff-chg"><code>extSubsetDecl</code></td><td class="diff-chg">   ::=   </td><td class="diff-chg"><code>( <a href="#NT-markupdecl">markupdecl</a> | <a href="#NT-conditionalSect">conditionalSect</a> | <a href="#NT-DeclSep">DeclSep</a>)*</code></td><xsltdebug></xsltdebug><td class="diff-chg"><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a> */</i></td></tr>
+</tbody></table>
+<p>The external subset and external parameter entities also differ from the
+internal subset in that in them, <a title="Parameter-entity reference" href="#dt-PERef">parameter-entity
+references</a> are permitted <em>within</em> markup declarations,
+not only <em>between</em> markup declarations.</p>
+<p>An example of an XML document with a document type declaration:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml version="1.0"?&gt; &lt;!DOCTYPE greeting SYSTEM "hello.dtd"&gt; &lt;greeting&gt;Hello, world!&lt;/greeting&gt; </pre></td></tr></table>
+<p>The <a title="System Identifier" href="#dt-sysid">system identifier</a> "<code>hello.dtd</code>"
+gives the <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E78">[E78]</a>address
+(a URI reference)</span> of a DTD for the document.</p>
+<p>The declarations can also be given locally, as in this example:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
+&lt;!DOCTYPE greeting [
+ &lt;!ELEMENT greeting (#PCDATA)&gt;
+]&gt;
+&lt;greeting&gt;Hello, world!&lt;/greeting&gt;</pre></td></tr></table>
+<p>If both the external and internal subsets are used, the internal subset
+is considered to occur before the external subset.
+This has the effect that entity and attribute-list declarations in the internal
+subset take precedence over those in the external subset.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-rmd"></a>2.9 Standalone Document Declaration</h3>
+<p>Markup declarations can affect the content of the document, as passed from
+an <a title="XML Processor" href="#dt-xml-proc">XML processor</a> to an application; examples
+are attribute defaults and entity declarations. The standalone document declaration,
+which may appear as a component of the XML declaration, signals whether or
+not there are such declarations which appear external to the <a title="Document Entity" href="#dt-docent">document
+entity</a><span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E64">[E64]</a>
+or in parameter entities. [<a name="dt-extmkpdecl" title="External Markup Declaration">Definition</a>: An <b>external
+markup declaration</b> is defined as a markup declaration occurring in
+the external subset or in a parameter entity (external or internal, the latter
+being included because non-validating processors are not required to read
+them).]</span></p>
+
+<h5>Standalone Document Declaration</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-SDDecl"></a>[32]   </td><td><code>SDDecl</code></td><td>   ::=   </td><td><code> <a href="#NT-S">S</a> 'standalone' <a href="#NT-Eq">Eq</a>
+(("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"')) </code></td><xsltdebug></xsltdebug><td><a href="#vc-check-rmd">[VC: Standalone Document Declaration]</a></td></tr>
+</tbody></table>
+<p>In a standalone document declaration, the value "yes" indicates
+that there are no <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E64">[E64]</a><a title="External Markup Declaration" href="#dt-extmkpdecl">external markup declarations</a></span> which
+affect the information passed from the XML processor to the application. The
+value "no" indicates that there are or may be such external
+markup declarations. Note that the standalone document declaration only denotes
+the presence of external <em>declarations</em>; the presence, in a document,
+of references to external <em>entities</em>, when those entities are internally
+declared, does not change its standalone status.</p>
+<p>If there are no external markup declarations, the standalone document declaration
+has no meaning. If there are external markup declarations but there is no
+standalone document declaration, the value "no" is assumed.</p>
+<p>Any XML document for which <code>standalone="no"</code> holds can be converted
+algorithmically to a standalone document, which may be desirable for some
+network delivery applications.</p>
+<div class="constraint"><p class="prefix"><a name="vc-check-rmd"></a><b>Validity constraint: Standalone Document Declaration</b></p><p>The
+standalone document declaration must have the value "no" if
+any external markup declarations contain declarations of:</p>
+<ul>
+<li><p>attributes with <a title="Attribute Default" href="#dt-default">default</a> values,
+if elements to which these attributes apply appear in the document without
+specifications of values for these attributes, or</p></li>
+<li><p>entities (other than <code>amp</code>,
+<code>lt</code>,
+<code>gt</code>,
+<code>apos</code>,
+<code>quot</code>), if <a title="Entity Reference" href="#dt-entref">references</a>
+to those entities appear in the document, or</p></li>
+<li><p>attributes with values subject to <a href="#AVNormalize"><cite>normalization</cite></a>,
+where the attribute appears in the document with a value which will change
+as a result of normalization, or</p></li>
+<li><p>element types with <a title="Element content" href="#dt-elemcontent">element content</a>,
+if white space occurs directly within any instance of those types.</p></li>
+</ul>
+</div>
+<p>An example XML declaration with a standalone document declaration:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml version="1.0" standalone='yes'?&gt;</pre></td></tr></table>
+</div>
+<div class="div2">
+
+<h3><a name="sec-white-space"></a>2.10 White Space Handling</h3>
+<p>In editing XML documents, it is often convenient to use "white space"
+(spaces, tabs, and blank lines<span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E39">[E39]</a>,
+denoted by the nonterminal <a href="#NT-S">S</a> in this specification</span>)
+to set apart the markup for greater readability. Such white space is typically
+not intended for inclusion in the delivered version of the document. On the
+other hand, "significant" white space that should be preserved
+in the delivered version is common, for example in poetry and source code.</p>
+<p>An <a title="XML Processor" href="#dt-xml-proc">XML processor</a> must always pass
+all characters in a document that are not markup through to the application.
+A <a title="Validating Processor" href="#dt-validating"> validating XML processor</a> must also
+inform the application which of these characters constitute white space appearing
+in <a title="Element content" href="#dt-elemcontent">element content</a>.</p>
+<p>A special <a title="Attribute" href="#dt-attr">attribute</a> named <code>xml:space</code>
+may be attached to an element to signal an intention that in that element,
+white space should be preserved by applications. In valid documents, this
+attribute, like any other, must be <a title="Attribute-List Declaration" href="#dt-attdecl">declared</a>
+if it is used. When declared, it must be given as an <a title="Enumerated Attribute Values" href="#dt-enumerated">enumerated
+type</a> whose <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E81">[E81]</a>values
+are one or both of</span> "default" and "preserve".
+For example:</p>
+<div class="diff-chg"><table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td class="diff-chg"><pre>&lt;!ATTLIST poem xml:space (default|preserve) 'preserve'&gt;
+
+&lt;!-- <a href="http://www.w3.org/XML/xml-19980210-errata#E81">[E81]</a>--&gt;
+&lt;!ATTLIST pre xml:space (preserve) #FIXED 'preserve'&gt;</pre></td></tr></table></div>
+<p>The value "default" signals that applications' default white-space
+processing modes are acceptable for this element; the value "preserve"
+indicates the intent that applications preserve all the white space. This
+declared intent is considered to apply to all elements within the content
+of the element where it is specified, unless overriden with another instance
+of the <code>xml:space</code> attribute.</p>
+<p>The <a title="Root Element" href="#dt-root">root element</a> of any document is considered
+to have signaled no intentions as regards application space handling, unless
+it provides a value for this attribute or the attribute is declared with a
+default value.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-line-ends"></a>2.11 End-of-Line Handling</h3>
+<p>XML <a title="Text Entity" href="#dt-parsedent">parsed entities</a> are often stored
+in computer files which, for editing convenience, are organized into lines.
+These lines are typically separated by some combination of the characters
+carriage-return (#xD) and line-feed (#xA).</p>
+<div class="diff-del"><p>To simplify the tasks of <a title="Application" href="#dt-app">applications</a>,
+wherever an external parsed entity or the literal entity value of an internal
+parsed entity contains either the literal two-character sequence "#xD#xA"
+or a standalone literal #xD, an <a title="XML Processor" href="#dt-xml-proc">XML processor</a>
+must pass to the application the single character #xA. (This behavior can
+conveniently be produced by normalizing all line breaks to #xA on input, before
+parsing.)</p></div>
+<div class="diff-add"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E104">[E104]</a>To
+simplify the tasks of <a title="Application" href="#dt-app">applications</a>, the characters
+passed to an application by the <a title="XML Processor" href="#dt-xml-proc">XML processor</a>
+must be as if the XML processor normalized all line breaks in external parsed
+entities (including the document entity) on input, before parsing, by translating
+both the two-character sequence #xD #xA and any #xD that is not followed by
+#xA to a single #xA character.</p></div>
+</div>
+<div class="div2">
+
+<h3><a name="sec-lang-tag"></a>2.12 Language Identification</h3>
+<p>In document processing, it is often useful to identify the natural or formal
+language in which the content is written. A special <a title="Attribute" href="#dt-attr">attribute</a>
+named <code>xml:lang</code> may be inserted in documents to specify the language
+used in the contents and attribute values of any element in an XML document.
+In valid documents, this attribute, like any other, must be <a title="Attribute-List Declaration" href="#dt-attdecl">declared</a>
+if it is used. <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E73">[E73]</a>The
+values of the attribute are language identifiers as defined by <a href="#RFC1766">[IETF RFC 1766]</a>, <cite>Tags
+for the Identification of Languages</cite>, or its successor on the IETF
+Standards Track.</span></p>
+<div class="diff-add"><div class="note"><p class="prefix"><b>Note:</b></p>
+<p><a href="http://www.w3.org/XML/xml-19980210-errata#E73">[E73]</a><a href="#RFC1766">[IETF RFC 1766]</a> tags are constructed from two-letter language codes as defined
+by <a href="#ISO639">[ISO 639]</a>, from two-letter country codes as defined by <a href="#ISO3166">[ISO 3166]</a>, or from language identifiers registered with the Internet
+Assigned Numbers Authority <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E58">[E58]</a><span class="diff-chg"><a href="#IANA-LANGCODES">[IANA-LANGCODES]</a></span></span>. It is expected that the successor
+to <a href="#RFC1766">[IETF RFC 1766]</a> will introduce three-letter language codes for
+languages not presently covered by <a href="#ISO639">[ISO 639]</a>.</p>
+</div></div>
+<div class="diff-add"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E73">[E73]</a>(Productions
+33 through 38 have been removed.)</p></div>
+<div class="diff-del">
+<h5>Language Identification</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td class="diff-del"><a name="NT-LanguageID"></a>[33]   </td><td class="diff-del"><code>LanguageID</code></td><td class="diff-del">   ::=   </td><td class="diff-del"><code><a href="#NT-Langcode">Langcode</a> ('-' <a href="#NT-Subcode">Subcode</a>)*</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td class="diff-del"><a name="NT-Langcode"></a>[34]   </td><td class="diff-del"><code>Langcode</code></td><td class="diff-del">   ::=   </td><td class="diff-del"><code><a href="#NT-ISO639Code">ISO639Code</a> | <a href="#NT-IanaCode">IanaCode</a>
+| <a href="#NT-UserCode">UserCode</a></code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td class="diff-del"><a name="NT-ISO639Code"></a>[35]   </td><td class="diff-del"><code>ISO639Code</code></td><td class="diff-del">   ::=   </td><td class="diff-del"><code>([a-z] | [A-Z]) ([a-z] | [A-Z])</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td class="diff-del"><a name="NT-IanaCode"></a>[36]   </td><td class="diff-del"><code>IanaCode</code></td><td class="diff-del">   ::=   </td><td class="diff-del"><code>('i' | 'I') '-' ([a-z] | [A-Z])+</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td class="diff-del"><a name="NT-UserCode"></a>[37]   </td><td class="diff-del"><code>UserCode</code></td><td class="diff-del">   ::=   </td><td class="diff-del"><code>('x' | 'X') '-' ([a-z] | [A-Z])+</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td class="diff-del"><a name="NT-Subcode"></a>[38]   </td><td class="diff-del"><code>Subcode</code></td><td class="diff-del">   ::=   </td><td class="diff-del"><code>([a-z] | [A-Z])+</code></td><xsltdebug></xsltdebug></tr></tbody></table></div>
+<div class="diff-del"><p>The <a href="#NT-Langcode">Langcode</a> may be any of the following:</p></div>
+<div class="diff-del"><ul>
+<li><p>a two-letter language code as defined by <a href="#ISO639">[ISO 639]</a>, <cite>Codes
+for the representation of names of languages</cite></p></li>
+<li><p>a language identifier registered with the Internet Assigned Numbers
+Authority <span class="diff-chg"><a href="#IANA-LANGCODES">[IANA-LANGCODES]</a></span>; these begin with the
+prefix "<code>i-</code>" (or "<code>I-</code>")</p>
+</li>
+<li><p>a language identifier assigned by the user, or agreed on between
+parties in private use; these must begin with the prefix "<code>x-</code>"
+or "<code>X-</code>" in order to ensure that they do not conflict
+with names later standardized or registered with IANA</p></li>
+</ul></div>
+<div class="diff-del"><p>There may be any number of <a href="#NT-Subcode">Subcode</a>
+segments; if the first subcode segment exists and the Subcode consists of
+two letters, then it must be a country code from <a href="#ISO3166">[ISO 3166]</a>,
+"Codes for the representation of names of countries." If the first subcode
+consists of more than two letters, it must be a subcode for the language in
+question registered with IANA, unless the <a href="#NT-Langcode">Langcode</a>
+begins with the prefix "<code>x-</code>" or "<code>X-</code>". </p></div>
+<div class="diff-del"><p>It is customary to give the language code in lower case, and
+the country code (if any) in upper case. Note that these values, unlike other
+names in XML documents, are case insensitive.</p></div>
+<p>For example:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;p xml:lang="en"&gt;The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+&lt;p xml:lang="en-GB"&gt;What colour is it?&lt;/p&gt;
+&lt;p xml:lang="en-US"&gt;What color is it?&lt;/p&gt;
+&lt;sp who="Faust" desc='leise' xml:lang="de"&gt;
+ &lt;l&gt;Habe nun, ach! Philosophie,&lt;/l&gt;
+ &lt;l&gt;Juristerei, und Medizin&lt;/l&gt;
+ &lt;l&gt;und leider auch Theologie&lt;/l&gt;
+ &lt;l&gt;durchaus studiert mit heißem Bemüh'n.&lt;/l&gt;
+&lt;/sp&gt;</pre></td></tr></table>
+
+<p>The intent declared with <code>xml:lang</code> is considered to apply to
+all attributes and content of the element where it is specified, unless overridden
+with an instance of <code>xml:lang</code> on another element within that content.</p>
+
+<p>A simple declaration for <code>xml:lang</code> might take the form</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>xml:lang NMTOKEN #IMPLIED</pre></td></tr></table>
+<p>but specific default values may also be given, if appropriate. In a collection
+of French poems for English students, with glosses and notes in English, the <code>xml:lang</code>
+attribute might be declared this way:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ATTLIST poem xml:lang NMTOKEN 'fr'&gt;
+&lt;!ATTLIST gloss xml:lang NMTOKEN 'en'&gt;
+&lt;!ATTLIST note xml:lang NMTOKEN 'en'&gt;</pre></td></tr></table>
+</div>
+</div>
+
+<div class="div1">
+
+<h2><a name="sec-logical-struct"></a>3 Logical Structures</h2>
+<p>[<a name="dt-element" title="Element">Definition</a>: Each <a title="XML Document" href="#dt-xml-doc">XML
+document</a> contains one or more <b>elements</b>, the boundaries
+of which are either delimited by <a title="Start-Tag" href="#dt-stag">start-tags</a>
+and <a title="End Tag" href="#dt-etag">end-tags</a>, or, for <a title="Empty" href="#dt-empty">empty</a>
+elements, by an <a title="empty-element tag" href="#dt-eetag">empty-element tag</a>. Each
+element has a type, identified by name, sometimes called its "generic
+identifier" (GI), and may have a set of attribute specifications.]
+Each attribute specification has a <a title="Attribute Name" href="#dt-attrname">name</a>
+and a <a title="Attribute Value" href="#dt-attrval">value</a>.</p>
+
+<h5>Element</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-element"></a>[39]   </td><td><code>element</code></td><td>   ::=   </td><td><code><a href="#NT-EmptyElemTag">EmptyElemTag</a></code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-STag">STag</a> <a href="#NT-content">content</a> <a href="#NT-ETag">ETag</a></code></td><td><a href="#GIMatch">[WFC: Element Type Match]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#elementvalid">[VC: Element Valid]</a></td></tr></tbody></table>
+<p>This specification does not constrain the semantics, use, or (beyond syntax)
+names of the element types and attributes, except that names beginning with
+a match to <code>(('X'|'x')('M'|'m')('L'|'l'))</code> are reserved for standardization
+in this or future versions of this specification.</p>
+<div class="constraint"><p class="prefix"><a name="GIMatch"></a><b>Well-formedness constraint: Element Type Match</b></p><p>The <a href="#NT-Name">Name</a>
+in an element's end-tag must match the element type in the start-tag.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="elementvalid"></a><b>Validity constraint: Element Valid</b></p><p>An element is valid
+if there is a declaration matching <a href="#NT-elementdecl">elementdecl</a>
+where the <a href="#NT-Name">Name</a> matches the element type, and one of
+the following holds:</p>
+<ol>
+<li><p>The declaration matches <b>EMPTY</b> and the element has no <a title="Content" href="#dt-content">content</a>.</p></li>
+<li><p>The declaration matches <a href="#NT-children">children</a> and the
+sequence of <a title="Parent/Child" href="#dt-parentchild">child elements</a> belongs
+to the language generated by the regular expression in the content model,
+with optional white space (characters matching the nonterminal <a href="#NT-S">S</a>)
+between <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E59">[E59]</a>the
+start-tag and the first child element, between child elements, or between
+the last child element and the end-tag. Note that a CDATA section containing
+only white space does not match the nonterminal <a href="#NT-S">S</a>, and
+hence cannot appear in these positions.</span></p></li>
+<li><p>The declaration matches <a href="#NT-Mixed">Mixed</a> and the content
+consists of <a title="Character Data" href="#dt-chardata">character data</a> and <a title="Parent/Child" href="#dt-parentchild">child elements</a> whose types match names in the
+content model.</p></li>
+<li><p>The declaration matches <b>ANY</b>, and the types of any <a title="Parent/Child" href="#dt-parentchild">child elements</a> have been declared.</p></li>
+</ol>
+</div>
+<div class="div2">
+
+<h3><a name="sec-starttags"></a>3.1 Start-Tags, End-Tags, and Empty-Element Tags</h3>
+<p>[<a name="dt-stag" title="Start-Tag">Definition</a>: The beginning of every non-empty
+XML element is marked by a <b>start-tag</b>.]</p>
+
+<h5>Start-tag</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-STag"></a>[40]   </td><td><code>STag</code></td><td>   ::=   </td><td><code>'&lt;' <a href="#NT-Name">Name</a> (<a href="#NT-S">S</a> <a href="#NT-Attribute">Attribute</a>)* <a href="#NT-S">S</a>? '&gt;'</code></td><xsltdebug></xsltdebug><td><a href="#uniqattspec">[WFC: Unique Att Spec]</a></td></tr>
+<tr valign="baseline"><td><a name="NT-Attribute"></a>[41]   </td><td><code>Attribute</code></td><td>   ::=   </td><td><code><a href="#NT-Name">Name</a> <a href="#NT-Eq">Eq</a> <a href="#NT-AttValue">AttValue</a></code></td><xsltdebug></xsltdebug><td><a href="#ValueType">[VC: Attribute Value Type]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#NoExternalRefs">[WFC: No External Entity References]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#CleanAttrVals">[WFC: No &lt; in Attribute Values]</a></td></tr>
+</tbody></table>
+<p>The <a href="#NT-Name">Name</a> in the start- and end-tags gives the element's <b>type</b>. [<a name="dt-attr" title="Attribute">Definition</a>: The <a href="#NT-Name">Name</a>-<a href="#NT-AttValue">AttValue</a>
+pairs are referred to as the <b>attribute specifications</b> of the
+element], [<a name="dt-attrname" title="Attribute Name">Definition</a>: with the <a href="#NT-Name">Name</a> in each pair referred to as the <b>attribute name</b>]
+and [<a name="dt-attrval" title="Attribute Value">Definition</a>: the content of the <a href="#NT-AttValue">AttValue</a> (the text between the <code>'</code> or <code>"</code>
+delimiters) as the <b>attribute value</b>.]<span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E46">[E46]</a>Note
+that the order of attribute specifications in a start-tag or empty-element
+tag is not significant.</span></p>
+<div class="constraint"><p class="prefix"><a name="uniqattspec"></a><b>Well-formedness constraint: Unique Att Spec</b></p><p>No attribute name
+may appear more than once in the same start-tag or empty-element tag.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="ValueType"></a><b>Validity constraint: Attribute Value Type</b></p><p>The attribute must
+have been declared; the value must be of the type declared for it. (For attribute
+types, see <a href="#attdecls"><b>3.3 Attribute-List Declarations</b></a>.)</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="NoExternalRefs"></a><b>Well-formedness constraint: No External Entity References</b></p><p>Attribute
+values cannot contain direct or indirect entity references to external entities.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="CleanAttrVals"></a><b>Well-formedness constraint: No <code>&lt;</code> in Attribute Values</b></p>
+<p>The <a title="Replacement Text" href="#dt-repltext">replacement text</a> of any entity
+referred to directly or indirectly in an attribute value <span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E83">[E83]</a>(other
+than "<code>&amp;lt;</code>") </span>must not contain a <code>&lt;</code>.</p>
+</div>
+<p>An example of a start-tag:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;termdef id="dt-dog" term="dog"&gt;</pre></td></tr></table>
+<p>[<a name="dt-etag" title="End Tag">Definition</a>: The end of every element that begins
+with a start-tag must be marked by an <b>end-tag</b> containing a name
+that echoes the element's type as given in the start-tag:]</p>
+
+<h5>End-tag</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-ETag"></a>[42]   </td><td><code>ETag</code></td><td>   ::=   </td><td><code>'&lt;/' <a href="#NT-Name">Name</a> <a href="#NT-S">S</a>?
+'&gt;'</code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>An example of an end-tag:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;/termdef&gt;</pre></td></tr></table>
+<p>[<a name="dt-content" title="Content">Definition</a>: The <a title="Text" href="#dt-text">text</a>
+between the start-tag and end-tag is called the element's <b>content</b>:]</p>
+
+<h5>Content of Elements</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td class="diff-chg"><a name="NT-content"></a>[43]   </td><td class="diff-chg"><code>content</code></td><td class="diff-chg">   ::=   </td><td class="diff-chg"><code><a href="#NT-CharData">CharData</a>? ((<a href="#NT-element">element</a>
+| <a href="#NT-Reference">Reference</a> | <a href="#NT-CDSect">CDSect</a>
+| <a href="#NT-PI">PI</a> | <a href="#NT-Comment">Comment</a>) <a href="#NT-CharData">CharData</a>?)*</code></td><xsltdebug></xsltdebug><td class="diff-chg"><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E71">[E71]</a> */</i></td></tr>
+</tbody></table>
+<p><span class="diff-chg">[<a name="dt-empty" title="Empty">Definition</a>: <a href="http://www.w3.org/XML/xml-19980210-errata#E97">[E97]</a>An element
+with no content is said to be <b>empty</b>.] The representation
+of an empty element is either a start-tag immediately followed by an end-tag,
+or an empty-element tag.</span> [<a name="dt-eetag" title="empty-element tag">Definition</a>: An <b>empty-element
+tag</b> takes a special form:]</p>
+
+<h5>Tags for Empty Elements</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-EmptyElemTag"></a>[44]   </td><td><code>EmptyElemTag</code></td><td>   ::=   </td><td><code>'&lt;' <a href="#NT-Name">Name</a> (<a href="#NT-S">S</a> <a href="#NT-Attribute">Attribute</a>)* <a href="#NT-S">S</a>? '/&gt;'</code></td><xsltdebug></xsltdebug><td><a href="#uniqattspec">[WFC: Unique Att Spec]</a></td></tr>
+</tbody></table>
+<p>Empty-element tags may be used for any element which has no content, whether
+or not it is declared using the keyword <b>EMPTY</b>. <a title="For interoperability" href="#dt-interop">For
+interoperability</a>, the empty-element tag <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E45">[E45]</a>should
+be used, and should only be used,</span> for elements which are declared
+EMPTY.</p>
+<p>Examples of empty elements:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;IMG align="left"
+ src="http://www.w3.org/Icons/WWW/w3c_home" /&gt;
+&lt;br&gt;&lt;/br&gt;
+&lt;br/&gt;</pre></td></tr></table>
+</div>
+<div class="div2">
+
+<h3><a name="elemdecls"></a>3.2 Element Type Declarations</h3>
+<p>The <a title="Element" href="#dt-element">element</a> structure of an <a title="XML Document" href="#dt-xml-doc">XML document</a> may, for <a title="Validity" href="#dt-valid">validation</a>
+purposes, be constrained using element type and attribute-list declarations.
+An element type declaration constrains the element's <a title="Content" href="#dt-content">content</a>.</p>
+<p>Element type declarations often constrain which element types can appear
+as <a title="Parent/Child" href="#dt-parentchild">children</a> of the element. At user
+option, an XML processor may issue a warning when a declaration mentions an
+element type for which no declaration is provided, but this is not an error.</p>
+<p>[<a name="dt-eldecl" title="Element Type declaration">Definition</a>: An <b>element
+type declaration</b> takes the form:]</p>
+
+<h5>Element Type Declaration</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-elementdecl"></a>[45]   </td><td><code>elementdecl</code></td><td>   ::=   </td><td><code>'&lt;!ELEMENT' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-S">S</a> <a href="#NT-contentspec">contentspec</a> <a href="#NT-S">S</a>?
+'&gt;'</code></td><xsltdebug></xsltdebug><td><a href="#EDUnique">[VC: Unique Element Type Declaration]</a></td></tr>
+<tr valign="baseline"><td><a name="NT-contentspec"></a>[46]   </td><td><code>contentspec</code></td><td>   ::=   </td><td><code>'EMPTY' | 'ANY' | <a href="#NT-Mixed">Mixed</a>
+| <a href="#NT-children">children</a> </code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>where the <a href="#NT-Name">Name</a> gives the element type being declared.</p>
+<div class="constraint"><p class="prefix"><a name="EDUnique"></a><b>Validity constraint: Unique Element Type Declaration</b></p><p>No element
+type may be declared more than once.</p>
+</div>
+<p>Examples of element type declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ELEMENT br EMPTY&gt;
+&lt;!ELEMENT p (#PCDATA|emph)* &gt;
+&lt;!ELEMENT %name.para; %content.para; &gt;
+&lt;!ELEMENT container ANY&gt;</pre></td></tr></table>
+<div class="div3">
+
+<h4><a name="sec-element-content"></a>3.2.1 Element Content</h4>
+<p>[<a name="dt-elemcontent" title="Element content">Definition</a>: An element <a title="Start-Tag" href="#dt-stag">type</a> has <b>element content</b> when elements
+of that type must contain only <a title="Parent/Child" href="#dt-parentchild">child</a>
+elements (no character data), optionally separated by white space (characters
+matching the nonterminal <a href="#NT-S">S</a>).][<a name="dt-content-model" title="Content model">Definition</a>: In this case, the constraint includes a <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E55">[E55]</a><b>content
+model</b></span>, a simple grammar governing the allowed types of the
+child elements and the order in which they are allowed to appear.]
+The grammar is built on content particles (<a href="#NT-cp">cp</a>s), which
+consist of names, choice lists of content particles, or sequence lists of
+content particles:</p>
+
+<h5>Element-content Models</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-children"></a>[47]   </td><td><code>children</code></td><td>   ::=   </td><td><code>(<a href="#NT-choice">choice</a> | <a href="#NT-seq">seq</a>)
+('?' | '*' | '+')?</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-cp"></a>[48]   </td><td><code>cp</code></td><td>   ::=   </td><td><code>(<a href="#NT-Name">Name</a> | <a href="#NT-choice">choice</a>
+| <a href="#NT-seq">seq</a>) ('?' | '*' | '+')?</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td class="diff-chg"><a name="NT-choice"></a>[49]   </td><td class="diff-chg"><code>choice</code></td><td class="diff-chg">   ::=   </td><td class="diff-chg"><code>'(' <a href="#NT-S">S</a>? <a href="#NT-cp">cp</a> ( <a href="#NT-S">S</a>? '|' <a href="#NT-S">S</a>? <a href="#NT-cp">cp</a> )+ <a href="#NT-S">S</a>? ')'</code></td><xsltdebug></xsltdebug><td class="diff-chg"><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E50">[E50]</a> */</i></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-chg"><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E52">[E52]</a> */</i></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#vc-PEinGroup">[VC: Proper Group/PE Nesting]</a></td></tr>
+<tr valign="baseline"><td class="diff-chg"><a name="NT-seq"></a>[50]   </td><td class="diff-chg"><code>seq</code></td><td class="diff-chg">   ::=   </td><td class="diff-chg"><code>'(' <a href="#NT-S">S</a>? <a href="#NT-cp">cp</a> ( <a href="#NT-S">S</a>? ',' <a href="#NT-S">S</a>? <a href="#NT-cp">cp</a> )* <a href="#NT-S">S</a>? ')'</code></td><xsltdebug></xsltdebug><td class="diff-chg"><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E52">[E52]</a> */</i></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#vc-PEinGroup">[VC: Proper Group/PE Nesting]</a></td></tr>
+</tbody></table>
+<p>where each <a href="#NT-Name">Name</a> is the type of an element which
+may appear as a <a title="Parent/Child" href="#dt-parentchild">child</a>. Any content
+particle in a choice list may appear in the <a title="Element content" href="#dt-elemcontent">element
+content</a> at the location where the choice list appears in the grammar;
+content particles occurring in a sequence list must each appear in the <a title="Element content" href="#dt-elemcontent">element content</a> in the order given in the list.
+The optional character following a name or list governs whether the element
+or the content particles in the list may occur one or more (<code>+</code>),
+zero or more (<code>*</code>), or zero or one times (<code>?</code>). The
+absence of such an operator means that the element or content particle must
+appear exactly once. This syntax and meaning are identical to those used in
+the productions in this specification.</p>
+<p>The content of an element matches a content model if and only if it is
+possible to trace out a path through the content model, obeying the sequence,
+choice, and repetition operators and matching each element in the content
+against an element type in the content model. <a title="For Compatibility" href="#dt-compat">For
+compatibility</a>, it is an error if an element in the document can
+match more than one occurrence of an element type in the content model. For
+more information, see <a href="#determinism"><b>E Deterministic Content Models</b></a>.</p>
+
+
+<div class="constraint"><p class="prefix"><a name="vc-PEinGroup"></a><b>Validity constraint: Proper Group/PE Nesting</b></p><p>Parameter-entity <a title="Replacement Text" href="#dt-repltext">replacement text</a> must be properly nested with <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E11">[E11]</a>parenthesized</span>
+groups. That is to say, if either of the opening or closing parentheses in
+a <a href="#NT-choice">choice</a>, <a href="#NT-seq">seq</a>, or <a href="#NT-Mixed">Mixed</a>
+construct is contained in the replacement text for a <a title="Parameter-entity reference" href="#dt-PERef">parameter
+entity</a>, both must be contained in the same replacement text.</p>
+<div class="diff-chg"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E19">[E19]</a><a title="For interoperability" href="#dt-interop">For interoperability</a>, if a parameter-entity reference
+appears in a <a href="#NT-choice">choice</a>, <a href="#NT-seq">seq</a>, or <a href="#NT-Mixed">Mixed</a> construct, its replacement text should contain at
+least one non-blank character, and neither the first nor last non-blank character
+of the replacement text should be a connector (<code>|</code> or <code>,</code>).</p></div>
+</div>
+<p>Examples of element-content models:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ELEMENT spec (front, body, back?)&gt;
+&lt;!ELEMENT div1 (head, (p | list | note)*, div2*)&gt;
+&lt;!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*&gt;</pre></td></tr></table>
+</div>
+<div class="div3">
+
+<h4><a name="sec-mixed-content"></a>3.2.2 Mixed Content</h4>
+<p>[<a name="dt-mixed" title="Mixed Content">Definition</a>: An element <a title="Start-Tag" href="#dt-stag">type</a>
+has <b>mixed content</b> when elements of that type may contain character
+data, optionally interspersed with <a title="Parent/Child" href="#dt-parentchild">child</a>
+elements.] In this case, the types of the child elements may be constrained,
+but not their order or their number of occurrences:</p>
+
+<h5>Mixed-content Declaration</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-Mixed"></a>[51]   </td><td><code>Mixed</code></td><td>   ::=   </td><td><code>'(' <a href="#NT-S">S</a>? '#PCDATA' (<a href="#NT-S">S</a>?
+'|' <a href="#NT-S">S</a>? <a href="#NT-Name">Name</a>)* <a href="#NT-S">S</a>?
+')*' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| '(' <a href="#NT-S">S</a>? '#PCDATA' <a href="#NT-S">S</a>? ')' </code></td><td><a href="#vc-PEinGroup">[VC: Proper Group/PE Nesting]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#vc-MixedChildrenUnique">[VC: No Duplicate Types]</a></td></tr>
+</tbody></table>
+<p>where the <a href="#NT-Name">Name</a>s give the types of elements that
+may appear as children. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E10">[E10]</a>The
+keyword <b>#PCDATA</b> derives historically from the term "parsed
+character data."</span></p>
+<div class="constraint"><p class="prefix"><a name="vc-MixedChildrenUnique"></a><b>Validity constraint: No Duplicate Types</b></p><p>The
+same name must not appear more than once in a single mixed-content declaration.</p>
+</div>
+<p>Examples of mixed content declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ELEMENT p (#PCDATA|a|ul|b|i|em)*&gt;
+&lt;!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* &gt;
+&lt;!ELEMENT b (#PCDATA)&gt;</pre></td></tr></table>
+</div>
+</div>
+<div class="div2">
+
+<h3><a name="attdecls"></a>3.3 Attribute-List Declarations</h3>
+<p><a title="Attribute" href="#dt-attr">Attributes</a> are used to associate name-value
+pairs with <a title="Element" href="#dt-element">elements</a>. Attribute specifications
+may appear only within <a title="Start-Tag" href="#dt-stag">start-tags</a> and <a title="empty-element tag" href="#dt-eetag">empty-element tags</a>; thus, the productions used to
+recognize them appear in <a href="#sec-starttags"><b>3.1 Start-Tags, End-Tags, and Empty-Element Tags</b></a>. Attribute-list declarations
+may be used:</p>
+<ul>
+<li><p>To define the set of attributes pertaining to a given element type.</p>
+</li>
+<li><p>To establish type constraints for these attributes.</p></li>
+<li><p>To provide <a title="Attribute Default" href="#dt-default">default values</a> for
+attributes.</p></li>
+</ul>
+<p>[<a name="dt-attdecl" title="Attribute-List Declaration">Definition</a>: <b>Attribute-list
+declarations</b> specify the name, data type, and default value (if any)
+of each attribute associated with a given element type:]</p>
+
+<h5>Attribute-list Declaration</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-AttlistDecl"></a>[52]   </td><td><code>AttlistDecl</code></td><td>   ::=   </td><td><code>'&lt;!ATTLIST' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-AttDef">AttDef</a>* <a href="#NT-S">S</a>? '&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-AttDef"></a>[53]   </td><td><code>AttDef</code></td><td>   ::=   </td><td><code><a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-S">S</a> <a href="#NT-AttType">AttType</a> <a href="#NT-S">S</a> <a href="#NT-DefaultDecl">DefaultDecl</a></code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>The <a href="#NT-Name">Name</a> in the <a href="#NT-AttlistDecl">AttlistDecl</a>
+rule is the type of an element. At user option, an XML processor may issue
+a warning if attributes are declared for an element type not itself declared,
+but this is not an error. The <a href="#NT-Name">Name</a> in the <a href="#NT-AttDef">AttDef</a>
+rule is the name of the attribute.</p>
+<p>When more than one <a href="#NT-AttlistDecl">AttlistDecl</a> is provided
+for a given element type, the contents of all those provided are merged. When
+more than one definition is provided for the same attribute of a given element
+type, the first declaration is binding and later declarations are ignored. <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E9">[E9]</a><a title="For interoperability" href="#dt-interop">For interoperability,</a> writers of DTDs may choose
+to provide at most one attribute-list declaration for a given element type,
+at most one attribute definition for a given attribute name in an attribute-list
+declaration, and at least one attribute definition in each attribute-list
+declaration.</span> For interoperability, an XML processor may at user option
+issue a warning when more than one attribute-list declaration is provided
+for a given element type, or more than one attribute definition is provided
+for a given attribute, but this is not an error.</p>
+<div class="div3">
+
+<h4><a name="sec-attribute-types"></a>3.3.1 Attribute Types</h4>
+<p>XML attribute types are of three kinds: a string type, a set of tokenized
+types, and enumerated types. The string type may take any literal string as
+a value; the tokenized types have varying lexical and semantic constraints<span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E8">[E8]</a>.
+The validity constraints noted in the grammar are applied after the attribute
+value has been normalized as described in <a href="#attdecls"><b>3.3 Attribute-List Declarations</b></a>.</span></p>
+
+<h5>Attribute Types</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-AttType"></a>[54]   </td><td><code>AttType</code></td><td>   ::=   </td><td><code><a href="#NT-StringType">StringType</a> | <a href="#NT-TokenizedType">TokenizedType</a>
+| <a href="#NT-EnumeratedType">EnumeratedType</a> </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-StringType"></a>[55]   </td><td><code>StringType</code></td><td>   ::=   </td><td><code>'CDATA'</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-TokenizedType"></a>[56]   </td><td><code>TokenizedType</code></td><td>   ::=   </td><td><code>'ID'</code></td><xsltdebug></xsltdebug><td><a href="#id">[VC: ID]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#one-id-per-el">[VC: One ID per Element Type]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#id-default">[VC: ID Attribute Default]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'IDREF'</code></td><td><a href="#idref">[VC: IDREF]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'IDREFS'</code></td><td><a href="#idref">[VC: IDREF]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'ENTITY'</code></td><td><a href="#entname">[VC: Entity Name]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'ENTITIES'</code></td><td><a href="#entname">[VC: Entity Name]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'NMTOKEN'</code></td><td><a href="#nmtok">[VC: Name Token]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'NMTOKENS'</code></td><td><a href="#nmtok">[VC: Name Token]</a></td></tr>
+</tbody></table>
+<div class="constraint"><p class="prefix"><a name="id"></a><b>Validity constraint: ID</b></p><p>Values of type <b>ID</b> must match the <a href="#NT-Name">Name</a> production. A name must not appear more than once
+in an XML document as a value of this type; i.e., ID values must uniquely
+identify the elements which bear them.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="one-id-per-el"></a><b>Validity constraint: One ID per Element Type</b></p><p>No element
+type may have more than one ID attribute specified.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="id-default"></a><b>Validity constraint: ID Attribute Default</b></p><p>An ID attribute
+must have a declared default of <b>#IMPLIED</b> or <b>#REQUIRED</b>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="idref"></a><b>Validity constraint: IDREF</b></p><p>Values of type <b>IDREF</b> must
+match the <a href="#NT-Name">Name</a> production, and values of type <b>IDREFS</b>
+must match <a href="#NT-Names">Names</a>; each <a href="#NT-Name">Name</a>
+must match the value of an ID attribute on some element in the XML document;
+i.e. <b>IDREF</b> values must match the value of some ID attribute.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="entname"></a><b>Validity constraint: Entity Name</b></p><p>Values of type <b>ENTITY</b>
+must match the <a href="#NT-Name">Name</a> production, values of type <b>ENTITIES</b>
+must match <a href="#NT-Names">Names</a>; each <a href="#NT-Name">Name</a>
+must match the name of an <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a>
+declared in the <a title="Document Type Declaration" href="#dt-doctype">DTD</a>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="nmtok"></a><b>Validity constraint: Name Token</b></p><p>Values of type <b>NMTOKEN</b>
+must match the <a href="#NT-Nmtoken">Nmtoken</a> production; values of type <b>NMTOKENS</b>
+must match <a title="" href="#NT-Nmtokens">Nmtokens</a>.</p>
+</div>
+
+<p>[<a name="dt-enumerated" title="Enumerated Attribute Values">Definition</a>: <b>Enumerated attributes</b> can take one of a list of values
+provided in the declaration]. There are two kinds of enumerated types:</p>
+
+<h5>Enumerated Attribute Types</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-EnumeratedType"></a>[57]   </td><td><code>EnumeratedType</code></td><td>   ::=   </td><td><code><a href="#NT-NotationType">NotationType</a>
+| <a href="#NT-Enumeration">Enumeration</a> </code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-NotationType"></a>[58]   </td><td><code>NotationType</code></td><td>   ::=   </td><td><code>'NOTATION' <a href="#NT-S">S</a> '(' <a href="#NT-S">S</a>? <a href="#NT-Name">Name</a> (<a href="#NT-S">S</a>? '|' <a href="#NT-S">S</a>? <a href="#NT-Name">Name</a>)* <a href="#NT-S">S</a>? ')' </code></td><xsltdebug></xsltdebug><td><a href="#notatn">[VC: Notation Attributes]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-add"><a href="#OneNotationPer">[VC: One
+Notation Per Element Type]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-add"><a href="#NoNotationEmpty">[VC: No
+Notation on Empty Element]</a></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Enumeration"></a>[59]   </td><td><code>Enumeration</code></td><td>   ::=   </td><td><code>'(' <a href="#NT-S">S</a>? <a href="#NT-Nmtoken">Nmtoken</a>
+(<a href="#NT-S">S</a>? '|' <a href="#NT-S">S</a>? <a href="#NT-Nmtoken">Nmtoken</a>)* <a href="#NT-S">S</a>? ')'</code></td><xsltdebug></xsltdebug><td><a href="#enum">[VC: Enumeration]</a></td></tr></tbody></table>
+<p>A <b>NOTATION</b> attribute identifies a <a title="Notation" href="#dt-notation">notation</a>,
+declared in the DTD with associated system and/or public identifiers, to be
+used in interpreting the element to which the attribute is attached.</p>
+<div class="constraint"><p class="prefix"><a name="notatn"></a><b>Validity constraint: Notation Attributes</b></p><p>Values of this type
+must match one of the <a href="#Notations"><cite>notation</cite></a> names
+included in the declaration; all notation names in the declaration must be
+declared.</p>
+</div>
+<div class="diff-add"><div class="constraint"><p class="prefix"><a name="OneNotationPer"></a><b>Validity constraint: <a href="http://www.w3.org/XML/xml-19980210-errata#E7">[E7]</a>One
+Notation Per Element Type</b></p><p>No element type may have more than one <b>NOTATION</b>
+attribute specified.</p>
+</div></div>
+<div class="diff-add"><div class="constraint"><p class="prefix"><a name="NoNotationEmpty"></a><b>Validity constraint: <a href="http://www.w3.org/XML/xml-19980210-errata#E68">[E68]</a>No
+Notation on Empty Element</b></p><p><a title="For Compatibility" href="#dt-compat">For compatibility</a>,
+an attribute of type <b>NOTATION</b> must not be declared on an element
+declared <b>EMPTY</b>.</p>
+</div></div>
+<div class="constraint"><p class="prefix"><a name="enum"></a><b>Validity constraint: Enumeration</b></p><p>Values of this type must match
+one of the <a href="#NT-Nmtoken">Nmtoken</a> tokens in the declaration.</p>
+</div>
+<p><a title="For interoperability" href="#dt-interop">For interoperability,</a> the same <a href="#NT-Nmtoken">Nmtoken</a> should not occur more than once in the enumerated
+attribute types of a single element type.</p>
+</div>
+<div class="div3">
+
+<h4><a name="sec-attr-defaults"></a>3.3.2 Attribute Defaults</h4>
+<p>An <a title="Attribute-List Declaration" href="#dt-attdecl">attribute declaration</a> provides information
+on whether the attribute's presence is required, and if not, how an XML processor
+should react if a declared attribute is absent in a document.</p>
+
+<h5>Attribute Defaults</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-DefaultDecl"></a>[60]   </td><td><code>DefaultDecl</code></td><td>   ::=   </td><td><code>'#REQUIRED' | '#IMPLIED' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| (('#FIXED' S)? <a href="#NT-AttValue">AttValue</a>)</code></td><td><a href="#RequiredAttr">[VC: Required Attribute]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#defattrvalid">[VC: Attribute Default Legal]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#CleanAttrVals">[WFC: No &lt; in Attribute Values]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#FixedAttr">[VC: Fixed Attribute Default]</a></td></tr>
+</tbody></table>
+<p>In an attribute declaration, <b>#REQUIRED</b> means that the attribute
+must always be provided, <b>#IMPLIED</b> that no default value is provided. [<a name="dt-default" title="Attribute Default">Definition</a>: If
+the declaration is neither <b>#REQUIRED</b> nor <b>#IMPLIED</b>, then
+the <a href="#NT-AttValue">AttValue</a> value contains the declared <b>default</b>
+value; the <b>#FIXED</b> keyword states that the attribute must always have
+the default value. If a default value is declared, when an XML processor encounters
+an omitted attribute, it is to behave as though the attribute were present
+with the declared default value.]</p>
+<div class="constraint"><p class="prefix"><a name="RequiredAttr"></a><b>Validity constraint: Required Attribute</b></p><p>If the default
+declaration is the keyword <b>#REQUIRED</b>, then the attribute must be
+specified for all elements of the type in the attribute-list declaration.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="defattrvalid"></a><b>Validity constraint: Attribute Default Legal</b></p><p>The declared
+default value must meet the lexical constraints of the declared attribute
+type.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="FixedAttr"></a><b>Validity constraint: Fixed Attribute Default</b></p><p>If an attribute
+has a default value declared with the <b>#FIXED</b> keyword, instances of
+that attribute must match the default value.</p>
+</div>
+<p>Examples of attribute-list declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ATTLIST termdef
+ id ID #REQUIRED
+ name CDATA #IMPLIED&gt;
+&lt;!ATTLIST list
+ type (bullets|ordered|glossary) "ordered"&gt;
+&lt;!ATTLIST form
+ method CDATA #FIXED "POST"&gt;</pre></td></tr></table>
+</div>
+<div class="diff-chg"><div class="div3">
+
+<h4><a name="AVNormalize"></a>3.3.3 <a href="http://www.w3.org/XML/xml-19980210-errata#E70">[E70]</a>Attribute-Value
+Normalization</h4>
+<p>Before the value of an attribute is passed to the application or checked
+for validity, the XML processor must normalize the attribute value by applying
+the algorithm below, or by using some other method such that the value passed
+to the application is the same as that produced by the algorithm.</p>
+<ol>
+<li><p>All line breaks must have been normalized on input to #xA as described
+in <a href="#sec-line-ends"><b>2.11 End-of-Line Handling</b></a>, so the rest of this algorithm operates
+on text normalized in this way.</p></li>
+<li><p>Begin with a normalized value consisting of the empty string.</p>
+</li>
+<li><p>For each character, entity reference, or character reference in the
+unnormalized attribute value, beginning with the first and continuing to the
+last, do the following:</p>
+<ul>
+<li><p>For a character reference, append the referenced character to the
+normalized value.</p></li>
+<li><p>For an entity reference, recursively apply step 3 of this algorithm
+to the replacement text of the entity.</p></li>
+<li><p>For a white space character (#x20, #xD, #xA, #x9), append a space
+character (#x20) to the normalized value.</p></li>
+<li><p>For another character, append the character to the normalized value.</p>
+</li>
+</ul>
+</li>
+</ol>
+<p>If the attribute type is not CDATA, then the XML processor must further
+process the normalized attribute value by discarding any leading and trailing
+space (#x20) characters, and by replacing sequences of space (#x20) characters
+by a single space (#x20) character.</p>
+<p>Note that if the unnormalized attribute value contains a character reference
+to a white space character other than space (#x20), the normalized value contains
+the referenced character itself (#xD, #xA or #x9). This contrasts with the
+case where the unnormalized value contains a white space character (not a
+reference), which is replaced with a space character (#x20) in the normalized
+value and also contrasts with the case where the unnormalized value contains
+an entity reference whose replacement text contains a white space character;
+being recursively processed, the white space character is replaced with a
+space character (#x20) in the normalized value.</p>
+<p>All attributes for which no declaration has been read should be treated
+by a non-validating <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E95">[E95]</a>processor</span>
+as if declared <b>CDATA</b>.</p>
+<p>Following are examples of attribute normalization. Given the following
+declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY d "&amp;#xD;"&gt;
+&lt;!ENTITY a "&amp;#xA;"&gt;
+&lt;!ENTITY da "&amp;#xD;&amp;#xA;"&gt;</pre></td></tr></table>
+<p>the attribute specifications in the left column below would be normalized
+to the character sequences of the middle column if the attribute <code>a</code>
+is declared <b>NMTOKENS</b> and to those of the right columns if <code>a</code>
+is declared <b>CDATA</b>.</p>
+<table border="1" frame="border"><thead><tr><th rowspan="1" colspan="1">Attribute specification</th>
+<th rowspan="1" colspan="1">a is NMTOKENS</th><th rowspan="1" colspan="1">a is CDATA</th></tr></thead><tbody><tr><td rowspan="1" colspan="1"><table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>a="
+
+xyz"</pre></td></tr></table></td><td rowspan="1" colspan="1"><code>x y z</code></td><td rowspan="1" colspan="1"><code>#x20 #x20 x y z</code></td>
+</tr><tr><td rowspan="1" colspan="1"><table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>a="&amp;d;&amp;d;A&amp;a;&amp;a;B&amp;da;"</pre></td></tr></table></td><td rowspan="1" colspan="1"><code>A
+#x20 B</code></td><td rowspan="1" colspan="1"><code>#x20 #x20 A #x20 #x20 B #x20 #x20</code></td>
+</tr><tr><td rowspan="1" colspan="1"><table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>a=
+"&amp;#xd;&amp;#xd;A&amp;#xa;&amp;#xa;B&amp;#xd;&amp;#xa;"</pre></td></tr></table></td><td rowspan="1" colspan="1"><code>#xD
+#xD A #xA #xA B #xD #xA</code></td><td rowspan="1" colspan="1"><code>#xD #xD A #xA #xA B #xD #xD</code></td>
+</tr></tbody></table>
+<p>Note that the last example is invalid (but well-formed) if <code>a</code>
+is declared to be of type <b>NMTOKENS</b>.</p>
+</div></div>
+</div>
+<div class="div2">
+
+<h3><a name="sec-condition-sect"></a>3.4 Conditional Sections</h3>
+<p>[<a name="dt-cond-section" title="conditional section">Definition</a>: <b>Conditional
+sections</b> are portions of the <a title="Document Type Declaration" href="#dt-doctype">document type
+declaration external subset</a> which are included in, or excluded from,
+the logical structure of the DTD based on the keyword which governs them.]</p>
+
+<h5>Conditional Section</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-conditionalSect"></a>[61]   </td><td><code>conditionalSect</code></td><td>   ::=   </td><td><code><a href="#NT-includeSect">includeSect</a> | <a href="#NT-ignoreSect">ignoreSect</a> </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-includeSect"></a>[62]   </td><td><code>includeSect</code></td><td>   ::=   </td><td><code>'&lt;![' S? 'INCLUDE' S? '[' <a href="#NT-extSubsetDecl">extSubsetDecl</a>
+']]&gt;' </code></td><xsltdebug></xsltdebug><td><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</a> */</i></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-add"><a href="#condsec-nesting">[VC: Proper
+Conditional Section/PE Nesting]</a></td></tr>
+<tr valign="baseline"><td><a name="NT-ignoreSect"></a>[63]   </td><td><code>ignoreSect</code></td><td>   ::=   </td><td><code>'&lt;![' S? 'IGNORE' S? '[' <a href="#NT-ignoreSectContents">ignoreSectContents</a>*
+']]&gt;'</code></td><xsltdebug></xsltdebug><td><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</a> */</i></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-add"><a href="#condsec-nesting">[VC: Proper
+Conditional Section/PE Nesting]</a></td></tr>
+<tr valign="baseline"><td><a name="NT-ignoreSectContents"></a>[64]   </td><td><code>ignoreSectContents</code></td><td>   ::=   </td><td><code><a href="#NT-Ignore">Ignore</a> ('&lt;![' <a href="#NT-ignoreSectContents">ignoreSectContents</a> ']]&gt;' <a href="#NT-Ignore">Ignore</a>)*</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Ignore"></a>[65]   </td><td><code>Ignore</code></td><td>   ::=   </td><td><code><a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a>*
+('&lt;![' | ']]&gt;') <a href="#NT-Char">Char</a>*) </code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<div class="diff-add"><div class="constraint"><p class="prefix"><a name="condsec-nesting"></a><b>Validity constraint: <a href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</a>Proper
+Conditional Section/PE Nesting</b></p><p>If any of the "<code>&lt;![</code>",
+"<code>[</code>", or "<code>]]&gt;</code>" of a conditional section is contained
+in the replacement text for a parameter-entity reference, all of them must
+be contained in the same replacement text.</p>
+</div></div>
+<p>Like the internal and external DTD subsets, a conditional section may contain
+one or more complete declarations, comments, processing instructions, or nested
+conditional sections, intermingled with white space.</p>
+<p>If the keyword of the conditional section is <b>INCLUDE</b>, then the
+contents of the conditional section are part of the DTD. If the keyword of
+the conditional section is <b>IGNORE</b>, then the contents of the conditional
+section are not logically part of the DTD. <span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</a>Note that
+for reliable parsing, the contents of even ignored conditional sections must
+be read in order to detect nested conditional sections and ensure that the
+end of the outermost (ignored) conditional section is properly detected.</span>
+If a conditional section with a keyword of <b>INCLUDE</b> occurs within
+a larger conditional section with a keyword of <b>IGNORE</b>, both the outer
+and the inner conditional sections are ignored.<span class="diff-add"> <a href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</a>The contents
+of an ignored conditional section are parsed by ignoring all characters after
+the "<code>[</code>" following the keyword, except conditional section starts
+"<code>&lt;![</code>" and ends "<code>]]&gt;</code>", until the matching conditional
+section end is found. Parameter entity references are not recognized in this
+process.</span></p>
+<p>If the keyword of the conditional section is a parameter-entity reference,
+the parameter entity must be replaced by its content before the processor
+decides whether to include or ignore the conditional section.</p>
+<p>An example:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY % draft 'INCLUDE' &gt;
+&lt;!ENTITY % final 'IGNORE' &gt;
+
+&lt;![%draft;[
+&lt;!ELEMENT book (comments*, title, body, supplements?)&gt;
+]]&gt;
+&lt;![%final;[
+&lt;!ELEMENT book (title, body, supplements?)&gt;
+]]&gt;</pre></td></tr></table>
+</div>
+
+</div>
+
+<div class="div1">
+
+<h2><a name="sec-physical-struct"></a>4 Physical Structures</h2>
+<p>[<a name="dt-entity" title="Entity">Definition</a>: An XML document may consist of one
+or many storage units. <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E6">[E6]</a>These
+are called <b>entities</b>; they all have <b>content</b> and are
+all (except for the <a title="Document Entity" href="#dt-docent">document entity</a> and
+the <a title="Document Type Declaration" href="#dt-doctype">external DTD subset</a>) identified by
+entity <b>name</b></span>.] Each XML document has one entity
+called the <a title="Document Entity" href="#dt-docent">document entity</a>, which serves
+as the starting point for the <a title="XML Processor" href="#dt-xml-proc">XML processor</a>
+and may contain the whole document.</p>
+<p>Entities may be either parsed or unparsed. [<a name="dt-parsedent" title="Text Entity">Definition</a>: A <b>parsed
+entity's</b> contents are referred to as its <a title="Replacement Text" href="#dt-repltext">replacement
+text</a>; this <a title="Text" href="#dt-text">text</a> is considered an
+integral part of the document.]</p>
+<p>[<a name="dt-unparsed" title="Unparsed Entity">Definition</a>: An <b>unparsed entity</b>
+is a resource whose contents may or may not be <a title="Text" href="#dt-text">text</a>,
+and if text, <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E25">[E25]</a>may
+be other than</span> XML. Each unparsed entity has an associated <a title="Notation" href="#dt-notation">notation</a>, identified by name. Beyond a requirement
+that an XML processor make the identifiers for the entity and notation available
+to the application, XML places no constraints on the contents of unparsed
+entities.]</p>
+<p>Parsed entities are invoked by name using entity references; unparsed entities
+by name, given in the value of <b>ENTITY</b> or <b>ENTITIES</b> attributes.</p>
+<p>[<a name="gen-entity" title="general entity">Definition</a>: <b>General entities</b>
+are entities for use within the document content. In this specification, general
+entities are sometimes referred to with the unqualified term <em>entity</em>
+when this leads to no ambiguity.] [<a name="dt-PE" title="Parameter entity">Definition</a>: <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E53">[E53]</a><b>Parameter
+entities</b></span> are parsed entities for use within the DTD.]
+These two types of entities use different forms of reference and are recognized
+in different contexts. Furthermore, they occupy different namespaces; a parameter
+entity and a general entity with the same name are two distinct entities.</p>
+<div class="div2">
+
+<h3><a name="sec-references"></a>4.1 Character and Entity References</h3>
+<p>[<a name="dt-charref" title="Character Reference">Definition</a>: A <b>character
+reference</b> refers to a specific character in the ISO/IEC 10646 character
+set, for example one not directly accessible from available input devices.]</p>
+
+<h5>Character Reference</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-CharRef"></a>[66]   </td><td><code>CharRef</code></td><td>   ::=   </td><td><code>'&amp;#' [0-9]+ ';' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| '&amp;#x' [0-9a-fA-F]+ ';'</code></td><td><a href="#wf-Legalchar">[WFC: Legal Character]</a></td></tr></tbody></table>
+<div class="constraint"><p class="prefix"><a name="wf-Legalchar"></a><b>Well-formedness constraint: Legal Character</b></p><p>Characters referred
+to using character references must match the production for <a title="" href="#NT-Char">Char</a>.</p>
+</div>
+<p>If the character reference begins with "<code>&amp;#x</code>",
+the digits and letters up to the terminating <code>;</code> provide a hexadecimal
+representation of the character's code point in ISO/IEC 10646. If it begins
+just with "<code>&amp;#</code>", the digits up to the terminating <code>;</code>
+provide a decimal representation of the character's code point.</p>
+<p>[<a name="dt-entref" title="Entity Reference">Definition</a>: An <b>entity reference</b>
+refers to the content of a named entity.] [<a name="dt-GERef" title="General Entity Reference">Definition</a>: References to parsed general entities use
+ampersand (<code>&amp;</code>) and semicolon (<code>;</code>) as delimiters.] [<a name="dt-PERef" title="Parameter-entity reference">Definition</a>: <b>Parameter-entity references</b>
+use percent-sign (<code>%</code>) and semicolon (<code>;</code>) as delimiters.]</p>
+
+<h5>Entity Reference</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-Reference"></a>[67]   </td><td><code>Reference</code></td><td>   ::=   </td><td><code><a href="#NT-EntityRef">EntityRef</a> | <a href="#NT-CharRef">CharRef</a></code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-EntityRef"></a>[68]   </td><td><code>EntityRef</code></td><td>   ::=   </td><td><code>'&amp;' <a href="#NT-Name">Name</a> ';'</code></td><xsltdebug></xsltdebug><td><a href="#wf-entdeclared">[WFC: Entity Declared]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#vc-entdeclared">[VC: Entity Declared]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#textent">[WFC: Parsed Entity]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#norecursion">[WFC: No Recursion]</a></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PEReference"></a>[69]   </td><td><code>PEReference</code></td><td>   ::=   </td><td><code>'%' <a href="#NT-Name">Name</a> ';'</code></td><xsltdebug></xsltdebug><td><a href="#vc-entdeclared">[VC: Entity Declared]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#norecursion">[WFC: No Recursion]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#indtd">[WFC: In DTD]</a></td></tr></tbody></table>
+<div class="constraint"><p class="prefix"><a name="wf-entdeclared"></a><b>Well-formedness constraint: Entity Declared</b></p><p>In a document
+without any DTD, a document with only an internal DTD subset which contains
+no parameter entity references, or a document with "<code>standalone='yes'</code>", <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E34">[E34]</a>for
+an entity reference that does not occur within the external subset or a parameter
+entity, the <a href="#NT-Name">Name</a> given in the entity reference must <a title="match" href="#dt-match">match</a> that in an <a href="#sec-entity-decl"><cite>entity
+declaration</cite></a> that does not occur within the external subset or a
+parameter entity</span>, except that well-formed documents need not declare
+any of the following entities: <code>amp</code>,
+<code>lt</code>,
+<code>gt</code>,
+<code>apos</code>,
+<code>quot</code>. <span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E29">[E29]</a>The declaration
+of a parameter entity must precede any reference to it. Similarly, </span>The
+declaration of a general entity must precede any reference to it which appears
+in a default value in an attribute-list declaration.</p>
+<p>Note that if entities are declared in the external subset or in external
+parameter entities, a non-validating processor is <a href="#include-if-valid"><cite>not
+obligated to</cite></a> read and process their declarations; for such documents,
+the rule that an entity must be declared is a well-formedness constraint only
+if <a href="#sec-rmd"><cite>standalone='yes'</cite></a>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="vc-entdeclared"></a><b>Validity constraint: Entity Declared</b></p><p>In a document with
+an external subset or external parameter entities with "<code>standalone='no'</code>",
+the <a href="#NT-Name">Name</a> given in the entity reference must <a title="match" href="#dt-match">match</a> that in an <a href="#sec-entity-decl"><cite>entity
+declaration</cite></a>. For interoperability, valid documents should declare
+the entities <code>amp</code>,
+<code>lt</code>,
+<code>gt</code>,
+<code>apos</code>,
+<code>quot</code>, in the form specified in <a href="#sec-predefined-ent"><b>4.6 Predefined Entities</b></a>.
+The declaration of a parameter entity must precede any reference to it. Similarly,
+the declaration of a general entity must precede any <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E92">[E92]</a>attribute-list
+declaration containing a default value with a direct or indirect reference
+to that general entity.</span></p>
+</div>
+
+<div class="constraint"><p class="prefix"><a name="textent"></a><b>Well-formedness constraint: Parsed Entity</b></p><p>An entity reference must
+not contain the name of an <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a>.
+Unparsed entities may be referred to only in <a title="Attribute Value" href="#dt-attrval">attribute
+values</a> declared to be of type <b>ENTITY</b> or <b>ENTITIES</b>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="norecursion"></a><b>Well-formedness constraint: No Recursion</b></p><p>A parsed entity must
+not contain a recursive reference to itself, either directly or indirectly.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="indtd"></a><b>Well-formedness constraint: In DTD</b></p><p>Parameter-entity references may
+only appear in the <a title="Document Type Declaration" href="#dt-doctype">DTD</a>.</p>
+</div>
+<p>Examples of character and entity references:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>Type &lt;key&gt;less-than&lt;/key&gt; (&amp;#x3C;) to save options.
+This document was prepared on &amp;docdate; and
+is classified &amp;security-level;.</pre></td></tr></table>
+<p>Example of a parameter-entity reference:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!-- declare the parameter entity "ISOLat2"... --&gt;
+&lt;!ENTITY % ISOLat2
+ SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" &gt;
+&lt;!-- ... now reference it. --&gt;
+%ISOLat2;</pre></td></tr></table>
+</div>
+<div class="div2">
+
+<h3><a name="sec-entity-decl"></a>4.2 Entity Declarations</h3>
+<p>[<a name="dt-entdecl" title="entity declaration">Definition</a>: Entities are declared
+thus:]</p>
+
+<h5>Entity Declaration</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-EntityDecl"></a>[70]   </td><td><code>EntityDecl</code></td><td>   ::=   </td><td><code><a href="#NT-GEDecl">GEDecl</a> | <a href="#NT-PEDecl">PEDecl</a></code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-GEDecl"></a>[71]   </td><td><code>GEDecl</code></td><td>   ::=   </td><td><code>'&lt;!ENTITY' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-S">S</a> <a href="#NT-EntityDef">EntityDef</a> <a href="#NT-S">S</a>?
+'&gt;'</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-PEDecl"></a>[72]   </td><td><code>PEDecl</code></td><td>   ::=   </td><td><code>'&lt;!ENTITY' <a href="#NT-S">S</a> '%' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-S">S</a> <a href="#NT-PEDef">PEDef</a> <a href="#NT-S">S</a>? '&gt;'</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-EntityDef"></a>[73]   </td><td><code>EntityDef</code></td><td>   ::=   </td><td><code><a href="#NT-EntityValue">EntityValue</a> | (<a href="#NT-ExternalID">ExternalID</a> <a href="#NT-NDataDecl">NDataDecl</a>?)</code></td><xsltdebug></xsltdebug></tr>
+
+<tr valign="baseline"><td><a name="NT-PEDef"></a>[74]   </td><td><code>PEDef</code></td><td>   ::=   </td><td><code><a href="#NT-EntityValue">EntityValue</a> | <a href="#NT-ExternalID">ExternalID</a></code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>The <a href="#NT-Name">Name</a> identifies the entity in an <a title="Entity Reference" href="#dt-entref">entity
+reference</a> or, in the case of an unparsed entity, in the value of
+an <b>ENTITY</b> or <b>ENTITIES</b> attribute. If the same entity is declared
+more than once, the first declaration encountered is binding; at user option,
+an XML processor may issue a warning if entities are declared multiple times.</p>
+<div class="div3">
+
+<h4><a name="sec-internal-ent"></a>4.2.1 Internal Entities</h4>
+<p>[<a name="dt-internent" title="Internal Entity Replacement Text">Definition</a>: If the
+entity definition is an <a href="#NT-EntityValue">EntityValue</a>, the defined
+entity is called an <b>internal entity</b>. There is no separate physical
+storage object, and the content of the entity is given in the declaration.]
+Note that some processing of entity and character references in the <a title="Literal Entity Value" href="#dt-litentval">literal entity value</a> may be required to produce
+the correct <a title="Replacement Text" href="#dt-repltext">replacement text</a>: see <a href="#intern-replacement"><b>4.5 Construction of Internal Entity Replacement Text</b></a>.</p>
+<p>An internal entity is a <a title="Text Entity" href="#dt-parsedent">parsed entity</a>.</p>
+<p>Example of an internal entity declaration:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY Pub-Status "This is a pre-release of the
+ specification."&gt;</pre></td></tr></table>
+</div>
+<div class="div3">
+
+<h4><a name="sec-external-ent"></a>4.2.2 External Entities</h4>
+<p>[<a name="dt-extent" title="External Entity">Definition</a>: If the entity is not internal,
+it is an <b>external entity</b>, declared as follows:]</p>
+
+<h5>External Entity Declaration</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-ExternalID"></a>[75]   </td><td><code>ExternalID</code></td><td>   ::=   </td><td><code>'SYSTEM' <a href="#NT-S">S</a> <a href="#NT-SystemLiteral">SystemLiteral</a></code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'PUBLIC' <a href="#NT-S">S</a> <a href="#NT-PubidLiteral">PubidLiteral</a> <a href="#NT-S">S</a> <a href="#NT-SystemLiteral">SystemLiteral</a> </code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-NDataDecl"></a>[76]   </td><td><code>NDataDecl</code></td><td>   ::=   </td><td><code><a href="#NT-S">S</a> 'NDATA' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a></code></td><xsltdebug></xsltdebug><td><a href="#not-declared">[VC: Notation Declared]</a></td></tr></tbody></table>
+<p>If the <a href="#NT-NDataDecl">NDataDecl</a> is present, this is a general <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a>; otherwise it is a parsed entity.</p>
+<div class="constraint"><p class="prefix"><a name="not-declared"></a><b>Validity constraint: Notation Declared</b></p><p>The <a href="#NT-Name">Name</a>
+must match the declared name of a <a title="Notation" href="#dt-notation">notation</a>.</p>
+</div>
+<p><span class="diff-chg">[<a name="dt-sysid" title="System Identifier">Definition</a>: The <a href="#NT-SystemLiteral">SystemLiteral</a> is called the entity's <b>system
+identifier</b>. It is a <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E88">[E88]</a>URI
+reference</span><span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E66">[E66]</a>
+(as defined in <a href="#rfc2396">[IETF RFC 2396]</a>, updated by <a href="#rfc2732">[IETF RFC 2732]</a>)</span>, <a href="http://www.w3.org/XML/xml-19980210-errata#E76">[E76]</a>meant
+to be dereferenced to obtain input for the XML processor to construct the
+entity's replacement text.] It is an error for a fragment identifier
+(beginning with a <code>#</code> character) to be part of a system identifier.</span>
+Unless otherwise provided by information outside the scope of this specification
+(e.g. a special XML element type defined by a particular DTD, or a processing
+instruction defined by a particular application specification), relative URIs
+are relative to the location of the resource within which the entity declaration
+occurs. A URI might thus be relative to the <a title="Document Entity" href="#dt-docent">document
+entity</a>, to the entity containing the <a title="Document Type Declaration" href="#dt-doctype">external
+DTD subset</a>, or to some other <a title="External Entity" href="#dt-extent">external parameter
+entity</a>.</p>
+<div class="diff-chg"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E78">[E78]</a>URI
+references require encoding and escaping of certain characters. The disallowed
+characters include all non-ASCII characters, plus the excluded characters
+listed in Section 2.4 of <a href="#rfc2396">[IETF RFC 2396]</a>, except for the number sign
+(<code>#</code>) and percent sign (<code>%</code>) characters and the square
+bracket characters re-allowed in <a href="#rfc2732">[IETF RFC 2732]</a>. Disallowed characters
+must be escaped as follows:</p></div>
+<div class="diff-add"><ol>
+<li><p>Each disallowed character is converted to UTF-8 <a href="#rfc2279">[IETF RFC 2279]</a>
+as one or more bytes.</p></li>
+<li><p>Any octets corresponding to a disallowed character are escaped with
+the URI escaping mechanism (that is, converted to <code>%</code><var>HH</var>,
+where HH is the hexadecimal notation of the byte value).</p></li>
+<li><p>The original character is replaced by the resulting character sequence.</p>
+</li>
+</ol></div>
+<p>[<a name="dt-pubid" title="Public identifier">Definition</a>: In addition to a system
+identifier, an external identifier may include a <b>public identifier</b>.]
+An XML processor attempting to retrieve the entity's content may use the public
+identifier to try to generate an alternative <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E88">[E88]</a>URI reference</span>.
+If the processor is unable to do so, it must use the <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E88">[E88]</a>URI
+reference</span> specified in the system literal. Before a match is attempted,
+all strings of white space in the public identifier must be normalized to
+single space characters (#x20), and leading and trailing white space must
+be removed.</p>
+<p>Examples of external entity declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY open-hatch
+ SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml"&gt;
+&lt;!ENTITY open-hatch
+ PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
+ "http://www.textuality.com/boilerplate/OpenHatch.xml"&gt;
+&lt;!ENTITY hatch-pic
+ SYSTEM "../grafix/OpenHatch.gif"
+ NDATA gif &gt;</pre></td></tr></table>
+</div>
+</div>
+<div class="div2">
+
+<h3><a name="TextEntities"></a>4.3 Parsed Entities</h3>
+<div class="div3">
+
+<h4><a name="sec-TextDecl"></a>4.3.1 The Text Declaration</h4>
+<p>External parsed entities <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E107">[E107]</a>should</span> each begin with a <b>text declaration</b>.</p>
+
+<h5>Text Declaration</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-TextDecl"></a>[77]   </td><td><code>TextDecl</code></td><td>   ::=   </td><td><code>'&lt;?xml' <a href="#NT-VersionInfo">VersionInfo</a>? <a href="#NT-EncodingDecl">EncodingDecl</a> <a href="#NT-S">S</a>? '?&gt;'</code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>The text declaration must be provided literally, not by reference to a
+parsed entity. No text declaration may appear at any position other than the
+beginning of an external parsed entity. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E94">[E94]</a>The text declaration
+in an external parsed entity is not considered part of its <a title="Replacement Text" href="#dt-repltext">replacement
+text</a>.</span></p>
+</div>
+<div class="div3">
+
+<h4><a name="wf-entities"></a>4.3.2 Well-Formed Parsed Entities</h4>
+<p>The document entity is well-formed if it matches the production labeled <a href="#NT-document">document</a>. An external general parsed entity is well-formed
+if it matches the production labeled <a href="#NT-extParsedEnt">extParsedEnt</a>. <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a>All
+external parameter entities are well-formed by definition.</span></p>
+
+<h5>Well-Formed External Parsed Entity</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-extParsedEnt"></a>[78]   </td><td><code>extParsedEnt</code></td><td>   ::=   </td><td><code><a href="#NT-TextDecl">TextDecl</a>? <a href="#NT-content">content</a></code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td class="diff-del"><a name="NT-extPE"></a>[79]   </td><td class="diff-del"><code>extPE</code></td><td class="diff-del">   ::=   </td><td class="diff-del"><code><a href="#NT-TextDecl">TextDecl</a>? <a href="#NT-extSubsetDecl">extSubsetDecl</a></code></td><xsltdebug></xsltdebug><td class="diff-del"><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a> */</i></td></tr></tbody></table>
+<p>An internal general parsed entity is well-formed if its replacement text
+matches the production labeled <a href="#NT-content">content</a>. All internal
+parameter entities are well-formed by definition.</p>
+<p>A consequence of well-formedness in entities is that the logical and physical
+structures in an XML document are properly nested; no <a title="Start-Tag" href="#dt-stag">start-tag</a>, <a title="End Tag" href="#dt-etag">end-tag</a>, <a title="Empty" href="#dt-empty">empty-element tag</a>, <a title="Element" href="#dt-element">element</a>, <a title="Comment" href="#dt-comment">comment</a>, <a title="Processing instruction" href="#dt-pi">processing instruction</a>, <a title="Character Reference" href="#dt-charref">character
+reference</a>, or <a title="Entity Reference" href="#dt-entref">entity reference</a>
+can begin in one entity and end in another.</p>
+</div>
+<div class="div3">
+
+<h4><a name="charencoding"></a>4.3.3 Character Encoding in Entities</h4>
+<p>Each external parsed entity in an XML document may use a different encoding
+for its characters. All XML processors must be able to read entities in <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E56">[E56]</a>both
+the UTF-8 and UTF-16 encodings.</span> <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E77">[E77]</a>The terms "UTF-8"
+and "UTF-16" in this specification do not apply to character
+encodings with any other labels, even if the encodings or labels are very
+similar to UTF-8 or UTF-16.</span></p>
+<p>Entities encoded in UTF-16 must begin with the Byte Order Mark described
+by <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</a>Annex
+F of <a href="#ISO10646">[ISO/IEC 10646]</a>, Annex H of <a href="#ISO10646-2000">[ISO/IEC 10646-2000]</a>, section
+2.4 of <a href="#Unicode">[Unicode]</a>, and section 2.7 of <a href="#Unicode3">[Unicode3]</a></span>
+(the ZERO WIDTH NO-BREAK SPACE character, #xFEFF). This is an encoding signature,
+not part of either the markup or the character data of the XML document. XML
+processors must be able to use this character to differentiate between UTF-8
+and UTF-16 encoded documents.</p>
+<p>Although an XML processor is required to read only entities in the UTF-8
+and UTF-16 encodings, it is recognized that other encodings are used around
+the world, and it may be desired for XML processors to read entities that
+use them. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E47">[E47]</a>In
+the absence of external character encoding information (such as MIME headers),</span>
+parsed entities which are stored in an encoding other than UTF-8 or UTF-16
+must begin with a text declaration <span class="diff-add">(see <a href="#sec-TextDecl"><b>4.3.1 The Text Declaration</b></a>) </span>containing
+an encoding declaration:</p>
+
+<h5>Encoding Declaration</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-EncodingDecl"></a>[80]   </td><td><code>EncodingDecl</code></td><td>   ::=   </td><td><code><a href="#NT-S">S</a> 'encoding' <a href="#NT-Eq">Eq</a>
+('"' <a href="#NT-EncName">EncName</a> '"' | "'" <a href="#NT-EncName">EncName</a>
+"'" ) </code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-EncName"></a>[81]   </td><td><code>EncName</code></td><td>   ::=   </td><td><code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code></td><xsltdebug></xsltdebug><td><i>/* Encoding
+name contains only Latin characters */</i></td></tr></tbody></table>
+<p>In the <a title="Document Entity" href="#dt-docent">document entity</a>, the encoding
+declaration is part of the <a title="XML Declaration" href="#dt-xmldecl">XML declaration</a>.
+The <a href="#NT-EncName">EncName</a> is the name of the encoding used.</p>
+
+<p>In an encoding declaration, the values "<code>UTF-8</code>", "<code>UTF-16</code>", "<code>ISO-10646-UCS-2</code>", and "<code>ISO-10646-UCS-4</code>" should be used
+for the various encodings and transformations of Unicode / ISO/IEC 10646,
+the values "<code>ISO-8859-1</code>", "<code>ISO-8859-2</code>",
+... <a href="http://www.w3.org/XML/xml-19980210-errata#E106">[E106]</a><span class="diff-chg">"<code>ISO-8859-</code><var>n</var>" (where <var>n</var>
+is the part number)</span> should be used for the parts of ISO 8859, and
+the values "<code>ISO-2022-JP</code>", "<code>Shift_JIS</code>",
+and "<code>EUC-JP</code>" should be used for the various encoded
+forms of JIS X-0208-1997. <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E57">[E57]</a>It
+is recommended that character encodings registered (as <em>charset</em>s)
+with the Internet Assigned Numbers Authority <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E58">[E58]</a><a href="#IANA">[IANA-CHARSETS]</a></span>,
+other than those just listed, be referred to using their registered names;
+other encodings should use names starting with an "x-" prefix.
+XML processors should match character encoding names in a case-insensitive
+way and should either interpret an IANA-registered name as the encoding registered
+at IANA for that name or treat it as unknown (processors are, of course, not
+required to support all IANA-registered encodings).</span></p>
+<p>In the absence of information provided by an external transport protocol
+(e.g. HTTP or MIME), it is an <a title="Error" href="#dt-error">error</a> for
+an entity including an encoding declaration to be presented to the XML processor
+in an encoding other than that named in the declaration, <span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E5">[E5]</a>for
+an encoding declaration to occur other than at the beginning of an external
+entity, </span>or for an entity which begins with neither a Byte Order Mark
+nor an encoding declaration to use an encoding other than UTF-8. Note that
+since ASCII is a subset of UTF-8, ordinary ASCII entities do not strictly
+need an encoding declaration.</p>
+<div class="diff-add"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E5">[E5]</a>It
+is <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E36">[E36]</a>a
+fatal</span> error for a <a href="#NT-TextDecl">TextDecl</a> to occur other
+than at the beginning of an external entity.</p></div>
+<p>It is a <a title="Fatal Error" href="#dt-fatal">fatal error</a> when an XML processor
+encounters an entity with an encoding that it is unable to process. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E79">[E79]</a>It
+is a fatal error if an XML entity is determined (via default, encoding declaration,
+or higher-level protocol) to be in a certain encoding but contains octet sequences
+that are not legal in that encoding. It is also a fatal error if an XML entity
+contains no encoding declaration and its content is not legal UTF-8 or UTF-16.</span></p>
+<p>Examples of <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E23">[E23]</a>text
+declarations containing </span>encoding declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml encoding='UTF-8'?&gt;
+&lt;?xml encoding='EUC-JP'?&gt;</pre></td></tr></table>
+</div>
+</div>
+<div class="div2">
+
+<h3><a name="entproc"></a>4.4 XML Processor Treatment of Entities and References</h3>
+<p>The table below summarizes the contexts in which character references,
+entity references, and invocations of unparsed entities might appear and the
+required behavior of an <a title="XML Processor" href="#dt-xml-proc">XML processor</a>
+in each case. The labels in the leftmost column describe the recognition context: </p><dl>
+<dt class="label">Reference in Content</dt>
+<dd>
+<p>as a reference anywhere after the <a title="Start-Tag" href="#dt-stag">start-tag</a>
+and before the <a title="End Tag" href="#dt-etag">end-tag</a> of an element; corresponds
+to the nonterminal <a href="#NT-content">content</a>.</p>
+</dd>
+<dt class="label">Reference in Attribute Value</dt>
+<dd>
+<p>as a reference within either the value of an attribute in a <a title="Start-Tag" href="#dt-stag">start-tag</a>,
+or a default value in an <a title="Attribute-List Declaration" href="#dt-attdecl">attribute declaration</a>;
+corresponds to the nonterminal <a href="#NT-AttValue">AttValue</a>.</p>
+</dd>
+<dt class="label">Occurs as Attribute Value</dt>
+<dd>
+<p>as a <a href="#NT-Name">Name</a>, not a reference, appearing either as
+the value of an attribute which has been declared as type <b>ENTITY</b>,
+or as one of the space-separated tokens in the value of an attribute which
+has been declared as type <b>ENTITIES</b>.</p>
+</dd>
+<dt class="label">Reference in Entity Value</dt>
+<dd>
+<p>as a reference within a parameter or internal entity's <a title="Literal Entity Value" href="#dt-litentval">literal
+entity value</a> in the entity's declaration; corresponds to the nonterminal <a href="#NT-EntityValue">EntityValue</a>.</p>
+</dd>
+<dt class="label">Reference in DTD</dt>
+<dd>
+<div class="diff-chg"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</a>as
+a reference within either the internal or external subsets of the <a title="Document Type Declaration" href="#dt-doctype">DTD</a>, but outside of an <a href="#NT-EntityValue">EntityValue</a>, <a href="#NT-AttValue">AttValue</a>, <a href="#NT-PI">PI</a>, <a href="#NT-Comment">Comment</a>, <a href="#NT-SystemLiteral">SystemLiteral</a>, <a href="#NT-PubidLiteral">PubidLiteral</a>,
+or the contents of an ignored conditional section (see <a href="#sec-condition-sect"><b>3.4 Conditional Sections</b></a>).</p></div>
+<p>.</p>
+</dd>
+</dl><p></p>
+<table border="1" frame="border" cellpadding="7"><tbody align="center"><tr>
+<td rowspan="2" colspan="1"></td><td colspan="4" align="center" valign="bottom" rowspan="1">Entity
+Type</td><td rowspan="2" align="center" colspan="1">Character</td></tr><tr align="center" valign="bottom"><td rowspan="1" colspan="1">Parameter</td><td rowspan="1" colspan="1">Internal General</td><td rowspan="1" colspan="1">External Parsed
+General</td><td rowspan="1" colspan="1">Unparsed</td></tr><tr align="center" valign="middle"><td align="right" rowspan="1" colspan="1">Reference
+in Content</td><td rowspan="1" colspan="1"><a href="#not-recognized"><cite>Not recognized</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#included"><cite>Included</cite></a></td><td rowspan="1" colspan="1"><a href="#include-if-valid"><cite>Included
+if validating</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#included"><cite>Included</cite></a></td></tr><tr align="center" valign="middle"><td align="right" rowspan="1" colspan="1">Reference in Attribute Value</td><td rowspan="1" colspan="1"><a href="#not-recognized"><cite>Not recognized</cite></a></td><td rowspan="1" colspan="1"><a href="#inliteral"><cite>Included
+in literal</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td>
+<td rowspan="1" colspan="1"><a href="http://www.w3.org/XML/xml-19980210-errata#E51">[E51]</a><div class="diff-chg"><a href="#forbidden"><cite>Forbidden</cite></a></div></td><td rowspan="1" colspan="1"><a href="#included"><cite>Included</cite></a></td>
+</tr><tr align="center" valign="middle"><td align="right" rowspan="1" colspan="1">Occurs as Attribute
+Value</td><td rowspan="1" colspan="1"><a href="#not-recognized"><cite>Not recognized</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td><td rowspan="1" colspan="1"><a href="http://www.w3.org/XML/xml-19980210-errata#E51">[E51]</a><div class="diff-chg"><a href="#forbidden"><cite>Forbidden</cite></a></div></td><td rowspan="1" colspan="1"><a href="#notify"><cite>Notify</cite></a></td>
+<td rowspan="1" colspan="1"><a href="http://www.w3.org/XML/xml-19980210-errata#E51">[E51]</a><div class="diff-chg"><a href="#not-recognized"><cite>Not recognized</cite></a></div></td></tr><tr align="center" valign="middle"><td align="right" rowspan="1" colspan="1">Reference in EntityValue</td><td rowspan="1" colspan="1"><a href="#inliteral"><cite>Included in literal</cite></a></td><td rowspan="1" colspan="1"><a href="#bypass"><cite>Bypassed</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#bypass"><cite>Bypassed</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#included"><cite>Included</cite></a></td></tr><tr align="center" valign="middle"><td align="right" rowspan="1" colspan="1">Reference in DTD</td><td rowspan="1" colspan="1"><a href="#as-PE"><cite>Included
+as PE</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td></tr></tbody></table>
+<div class="div3">
+
+<h4><a name="not-recognized"></a>4.4.1 Not Recognized</h4>
+<p>Outside the DTD, the <code>%</code> character has no special significance;
+thus, what would be parameter entity references in the DTD are not recognized
+as markup in <a href="#NT-content">content</a>. Similarly, the names of unparsed
+entities are not recognized except when they appear in the value of an appropriately
+declared attribute.</p>
+</div>
+<div class="div3">
+
+<h4><a name="included"></a>4.4.2 Included</h4>
+<p>[<a name="dt-include" title="Include">Definition</a>: An entity is <b>included</b>
+when its <a title="Replacement Text" href="#dt-repltext">replacement text</a> is retrieved
+and processed, in place of the reference itself, as though it were part of
+the document at the location the reference was recognized.] The replacement
+text may contain both <a title="Character Data" href="#dt-chardata">character data</a>
+and (except for parameter entities) <a title="Markup" href="#dt-markup">markup</a>,
+which must be recognized in the usual way<span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E65">[E65]</a>, except that
+the replacement text of entities used to escape markup delimiters (the entities <code>amp</code>,
+<code>lt</code>,
+<code>gt</code>,
+<code>apos</code>,
+<code>quot</code>)
+is always treated as data</span>. (The string "<code>AT&amp;amp;T;</code>"
+expands to "<code>AT&amp;T;</code>" and the remaining ampersand
+is not recognized as an entity-reference delimiter.) A character reference
+is <b>included</b> when the indicated character is processed in place
+of the reference itself. </p>
+</div>
+<div class="div3">
+
+<h4><a name="include-if-valid"></a>4.4.3 Included If Validating</h4>
+<p>When an XML processor recognizes a reference to a parsed entity, in order
+to <a title="Validity" href="#dt-valid">validate</a> the document, the processor
+must <a title="Include" href="#dt-include">include</a> its replacement text. If
+the entity is external, and the processor is not attempting to validate the
+XML document, the processor <a title="May" href="#dt-may">may</a>, but need
+not, include the entity's replacement text. If a non-validating <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E95">[E95]</a>processor</span>
+does not include the replacement text, it must inform the application that
+it recognized, but did not read, the entity.</p>
+<p>This rule is based on the recognition that the automatic inclusion provided
+by the SGML and XML entity mechanism, primarily designed to support modularity
+in authoring, is not necessarily appropriate for other applications, in particular
+document browsing. Browsers, for example, when encountering an external parsed
+entity reference, might choose to provide a visual indication of the entity's
+presence and retrieve it for display only on demand.</p>
+</div>
+<div class="div3">
+
+<h4><a name="forbidden"></a>4.4.4 Forbidden</h4>
+<p>The following are forbidden, and constitute <a title="Fatal Error" href="#dt-fatal">fatal</a>
+errors:</p>
+<ul>
+<li><p>the appearance of a reference to an <a title="Unparsed Entity" href="#dt-unparsed">unparsed
+entity</a>.</p></li>
+<li><p>the appearance of any character or general-entity reference in the
+DTD except within an <a href="#NT-EntityValue">EntityValue</a> or <a href="#NT-AttValue">AttValue</a>.</p>
+</li>
+<li><p>a reference to an external entity in an attribute value.</p></li>
+</ul>
+</div>
+<div class="div3">
+
+<h4><a name="inliteral"></a>4.4.5 Included in Literal</h4>
+<p>When an <a title="Entity Reference" href="#dt-entref">entity reference</a> appears in
+an attribute value, or a parameter entity reference appears in a literal entity
+value, its <a title="Replacement Text" href="#dt-repltext">replacement text</a> is processed
+in place of the reference itself as though it were part of the document at
+the location the reference was recognized, except that a single or double
+quote character in the replacement text is always treated as a normal data
+character and will not terminate the literal. For example, this is well-formed:</p>
+<div class="diff-chg"><table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td class="diff-chg"><pre>&lt;!-- <a href="http://www.w3.org/XML/xml-19980210-errata#E4">[E4]</a> --&gt;
+&lt;!ENTITY % YN '"Yes"' &gt;
+&lt;!ENTITY WhatHeSaid "He said %YN;" &gt;</pre></td></tr></table></div>
+<p>while this is not:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY EndAttr "27'" &gt;
+&lt;element attribute='a-&amp;EndAttr;&gt;</pre></td></tr></table>
+</div>
+<div class="div3">
+
+<h4><a name="notify"></a>4.4.6 Notify</h4>
+<p>When the name of an <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a>
+appears as a token in the value of an attribute of declared type <b>ENTITY</b>
+or <b>ENTITIES</b>, a validating processor must inform the application of
+the <a title="System Identifier" href="#dt-sysid">system</a> and <a title="Public identifier" href="#dt-pubid">public</a>
+(if any) identifiers for both the entity and its associated <a title="Notation" href="#dt-notation">notation</a>.</p>
+</div>
+<div class="div3">
+
+<h4><a name="bypass"></a>4.4.7 Bypassed</h4>
+<p>When a general entity reference appears in the <a href="#NT-EntityValue">EntityValue</a>
+in an entity declaration, it is bypassed and left as is.</p>
+</div>
+<div class="div3">
+
+<h4><a name="as-PE"></a>4.4.8 Included as PE</h4>
+<p>Just as with external parsed entities, parameter entities need only be <a href="#include-if-valid"><cite>included if validating</cite></a>. When a parameter-entity
+reference is recognized in the DTD and included, its <a title="Replacement Text" href="#dt-repltext">replacement
+text</a> is enlarged by the attachment of one leading and one following
+space (#x20) character; the intent is to constrain the replacement text of
+parameter entities to contain an integral number of grammatical tokens in
+the DTD. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E96">[E96]</a>This
+behavior does not apply to parameter entity references within entity values;
+these are described in <a href="#inliteral"><b>4.4.5 Included in Literal</b></a>.</span></p>
+</div>
+</div>
+<div class="div2">
+
+<h3><a name="intern-replacement"></a>4.5 Construction of Internal Entity Replacement Text</h3>
+<p>In discussing the treatment of internal entities, it is useful to distinguish
+two forms of the entity's value. [<a name="dt-litentval" title="Literal Entity Value">Definition</a>: The <b>literal
+entity value</b> is the quoted string actually present in the entity declaration,
+corresponding to the non-terminal <a href="#NT-EntityValue">EntityValue</a>.] [<a name="dt-repltext" title="Replacement Text">Definition</a>: The <b>replacement text</b>
+is the content of the entity, after replacement of character references and
+parameter-entity references.]</p>
+<p>The literal entity value as given in an internal entity declaration (<a href="#NT-EntityValue">EntityValue</a>) may contain character, parameter-entity,
+and general-entity references. Such references must be contained entirely
+within the literal entity value. The actual replacement text that is <a title="Include" href="#dt-include">included</a> as described above must contain the <em>replacement
+text</em> of any parameter entities referred to, and must contain the character
+referred to, in place of any character references in the literal entity value;
+however, general-entity references must be left as-is, unexpanded. For example,
+given the following declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY % pub "&amp;#xc9;ditions Gallimard" &gt;
+&lt;!ENTITY rights "All rights reserved" &gt;
+&lt;!ENTITY book "La Peste: Albert Camus,
+&amp;#xA9; 1947 %pub;. &amp;rights;" &gt;</pre></td></tr></table>
+<p>then the replacement text for the entity "<code>book</code>"
+is:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>La Peste: Albert Camus,
+© 1947 Éditions Gallimard. &amp;rights;</pre></td></tr></table>
+<p>The general-entity reference "<code>&amp;rights;</code>" would
+be expanded should the reference "<code>&amp;book;</code>" appear
+in the document's content or an attribute value.</p>
+<p>These simple rules may have complex interactions; for a detailed discussion
+of a difficult example, see <a href="#sec-entexpand"><b>D Expansion of Entity and Character References</b></a>.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-predefined-ent"></a>4.6 Predefined Entities</h3>
+<p>[<a name="dt-escape" title="escape">Definition</a>: Entity and character references can
+both be used to <b>escape</b> the left angle bracket, ampersand, and
+other delimiters. A set of general entities (<code>amp</code>,
+<code>lt</code>,
+<code>gt</code>,
+<code>apos</code>,
+<code>quot</code>) is specified for
+this purpose. Numeric character references may also be used; they are expanded
+immediately when recognized and must be treated as character data, so the
+numeric character references "<code>&amp;#60;</code>" and "<code>&amp;#38;</code>"
+may be used to escape <code>&lt;</code> and <code>&amp;</code> when they occur
+in character data.]</p>
+<p>All XML processors must recognize these entities whether they are declared
+or not. <a title="For interoperability" href="#dt-interop">For interoperability</a>, valid XML
+documents should declare these entities, like any others, before using them. <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E80">[E80]</a>If
+the entities <code>lt</code> or <code>amp</code> are declared, they must be
+declared as internal entities whose replacement text is a character reference
+to the <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E103">[E103]</a>respective
+character (less-than sign or ampersand)</span> being escaped; the double
+escaping is required for these entities so that references to them produce
+a well-formed result. If the entities <code>gt</code>, <code>apos</code>,
+or <code>quot</code> are declared, they must be declared as internal entities
+whose replacement text is the single character being escaped (or a character
+reference to that character; the double escaping here is unnecessary but harmless).
+For example:</span></p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY lt "&amp;#38;#60;"&gt;
+&lt;!ENTITY gt "&amp;#62;"&gt;
+&lt;!ENTITY amp "&amp;#38;#38;"&gt;
+&lt;!ENTITY apos "&amp;#39;"&gt;
+&lt;!ENTITY quot "&amp;#34;"&gt;</pre></td></tr></table>
+<div class="diff-del"><p>Note that the <code>&lt;</code> and <code>&amp;</code> characters
+in the declarations of "<code>lt</code>" and "<code>amp</code>"
+are doubly escaped to meet the requirement that entity replacement be well-formed.</p></div>
+</div>
+<div class="div2">
+
+<h3><a name="Notations"></a>4.7 Notation Declarations</h3>
+<p>[<a name="dt-notation" title="Notation">Definition</a>: <b>Notations</b> identify
+by name the format of <a title="External Entity" href="#dt-extent">unparsed entities</a>,
+the format of elements which bear a notation attribute, or the application
+to which a <a title="Processing instruction" href="#dt-pi">processing instruction</a> is addressed.]</p>
+<p>[<a name="dt-notdecl" title="Notation Declaration">Definition</a>: <b>Notation declarations</b>
+provide a name for the notation, for use in entity and attribute-list declarations
+and in attribute specifications, and an external identifier for the notation
+which may allow an XML processor or its client application to locate a helper
+application capable of processing data in the given notation.]</p>
+
+<h5>Notation Declarations</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-NotationDecl"></a>[82]   </td><td><code>NotationDecl</code></td><td>   ::=   </td><td><code>'&lt;!NOTATION' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-S">S</a> (<a href="#NT-ExternalID">ExternalID</a> | <a href="#NT-PublicID">PublicID</a>) <a href="#NT-S">S</a>? '&gt;'</code></td><xsltdebug></xsltdebug><td class="diff-add"><a href="#UniqueNotationName">[VC: Unique
+Notation Name]</a></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PublicID"></a>[83]   </td><td><code>PublicID</code></td><td>   ::=   </td><td><code>'PUBLIC' <a href="#NT-S">S</a> <a href="#NT-PubidLiteral">PubidLiteral</a> </code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<div class="diff-add"><div class="constraint"><p class="prefix"><a name="UniqueNotationName"></a><b>Validity constraint: <a href="http://www.w3.org/XML/xml-19980210-errata#E22">[E22]</a>Unique
+Notation Name</b></p><p>Only one notation declaration can declare a given <a href="#NT-Name">Name</a>.</p>
+</div></div>
+<p>XML processors must provide applications with the name and external identifier(s)
+of any notation declared and referred to in an attribute value, attribute
+definition, or entity declaration. They may additionally resolve the external
+identifier into the <a title="System Identifier" href="#dt-sysid">system identifier</a>, file
+name, or other information needed to allow the application to call a processor
+for data in the notation described. (It is not an error, however, for XML
+documents to declare and refer to notations for which notation-specific applications
+are not available on the system where the XML processor or application is
+running.)</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-doc-entity"></a>4.8 Document Entity</h3>
+<p>[<a name="dt-docent" title="Document Entity">Definition</a>: The <b>document entity</b>
+serves as the root of the entity tree and a starting-point for an <a title="XML Processor" href="#dt-xml-proc">XML processor</a>.] This specification does
+not specify how the document entity is to be located by an XML processor;
+unlike other entities, the document entity has no name and might well appear
+on a processor input stream without any identification at all.</p>
+</div>
+</div>
+
+<div class="div1">
+
+<h2><a name="sec-conformance"></a>5 Conformance</h2>
+<div class="div2">
+
+<h3><a name="proc-types"></a>5.1 Validating and Non-Validating Processors</h3>
+<p>Conforming <a title="XML Processor" href="#dt-xml-proc">XML processors</a> fall into
+two classes: validating and non-validating.</p>
+<p>Validating and non-validating processors alike must report violations of
+this specification's well-formedness constraints in the content of the <a title="Document Entity" href="#dt-docent">document entity</a> and any other <a title="Text Entity" href="#dt-parsedent">parsed
+entities</a> that they read.</p>
+<p>[<a name="dt-validating" title="Validating Processor">Definition</a>: <b>Validating
+processors</b> must<span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E21">[E21]</a>,
+at user option,</span> report violations of the constraints expressed by
+the declarations in the <a title="Document Type Declaration" href="#dt-doctype">DTD</a>, and failures
+to fulfill the validity constraints given in this specification.]
+To accomplish this, validating XML processors must read and process the entire
+DTD and all external parsed entities referenced in the document.</p>
+<p>Non-validating processors are required to check only the <a title="Document Entity" href="#dt-docent">document
+entity</a>, including the entire internal DTD subset, for well-formedness. [<a name="dt-use-mdecl" title="Process Declarations">Definition</a>: While they are not required
+to check the document for validity, they are required to <b>process</b>
+all the declarations they read in the internal DTD subset and in any parameter
+entity that they read, up to the first reference to a parameter entity that
+they do <em>not</em> read; that is to say, they must use the information
+in those declarations to <a href="#AVNormalize"><cite>normalize</cite></a>
+attribute values, <a href="#included"><cite>include</cite></a> the replacement
+text of internal entities, and supply <a href="#sec-attr-defaults"><cite>default
+attribute values</cite></a>.] <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E33">[E33]</a>Except when <code>standalone="yes"</code>, </span>they
+must not <a title="Process Declarations" href="#dt-use-mdecl">process</a> <a title="entity declaration" href="#dt-entdecl">entity
+declarations</a> or <a title="Attribute-List Declaration" href="#dt-attdecl">attribute-list declarations</a>
+encountered after a reference to a parameter entity that is not read, since
+the entity may have contained overriding declarations.</p>
+</div>
+<div class="div2">
+
+<h3><a name="safe-behavior"></a>5.2 Using XML Processors</h3>
+<p>The behavior of a validating XML processor is highly predictable; it must
+read every piece of a document and report all well-formedness and validity
+violations. Less is required of a non-validating processor; it need not read
+any part of the document other than the document entity. This has two effects
+that may be important to users of XML processors:</p>
+<ul>
+<li><p>Certain well-formedness errors, specifically those that require reading
+external entities, may not be detected by a non-validating processor. Examples
+include the constraints entitled <a href="#wf-entdeclared"><cite>Entity Declared</cite></a>, <a href="#textent"><cite>Parsed Entity</cite></a>, and <a href="#norecursion"><cite>No
+Recursion</cite></a>, as well as some of the cases described as <a href="#forbidden"><cite>forbidden</cite></a> in <a href="#entproc"><b>4.4 XML Processor Treatment of Entities and References</b></a>.</p></li>
+<li><p>The information passed from the processor to the application may
+vary, depending on whether the processor reads parameter and external entities.
+For example, a non-validating processor may not <a href="#AVNormalize"><cite>normalize</cite></a>
+attribute values, <a href="#included"><cite>include</cite></a> the replacement
+text of internal entities, or supply <a href="#sec-attr-defaults"><cite>default
+attribute values</cite></a>, where doing so depends on having read declarations
+in external or parameter entities.</p></li>
+</ul>
+<p>For maximum reliability in interoperating between different XML processors,
+applications which use non-validating processors should not rely on any behaviors
+not required of such processors. Applications which require facilities such
+as the use of default attributes or internal entities which are declared in
+external entities should use validating XML processors.</p>
+</div>
+</div>
+<div class="div1">
+
+<h2><a name="sec-notation"></a>6 Notation</h2>
+<p>The formal grammar of XML is given in this specification using a simple
+Extended Backus-Naur Form (EBNF) notation. Each rule in the grammar defines
+one symbol, in the form</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>symbol ::= expression</pre></td></tr></table>
+<p>Symbols are written with an initial capital letter if they are <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E42">[E42]</a>the
+start symbol of a regular language,</span> otherwise with an initial lower
+case letter. Literal strings are quoted.</p>
+<p>Within the expression on the right-hand side of a rule, the following expressions
+are used to match strings of one or more characters: </p><dl>
+<dt class="label"><code>#xN</code></dt>
+<dd>
+<p>where <code>N</code> is a hexadecimal integer, the expression matches the
+character in ISO/IEC 10646 whose canonical (UCS-4) code value, when interpreted
+as an unsigned binary number, has the value indicated. The number of leading
+zeros in the <code>#xN</code> form is insignificant; the number of leading
+zeros in the corresponding code value is governed by the character encoding
+in use and is not significant for XML.</p>
+</dd>
+<dt class="label"><code>[a-zA-Z]</code>, <code>[#xN-#xN]</code></dt>
+<dd>
+<p>matches any <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E93">[E93]</a><a href="#NT-Char">Char</a></span> with a value in the range(s) indicated (inclusive).</p>
+</dd>
+<dt class="label"><span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E3">[E3]</a><code>[abc]</code>, <code>[#xN#xN#xN]</code></span></dt>
+<dd><div class="diff-add">
+<p>matches any <a href="#NT-Char">Char</a> with a value among the characters
+enumerated. Enumerations and ranges can be mixed in one set of brackets.</p>
+</div></dd>
+<dt class="label"><code>[^a-z]</code>, <code>[^#xN-#xN]</code></dt>
+<dd>
+<p>matches any <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E93">[E93]</a><a href="#NT-Char">Char</a></span> with a value <em>outside</em> the range
+indicated.</p>
+</dd>
+<dt class="label"><code>[^abc]</code>, <code>[^#xN#xN#xN]</code></dt>
+<dd>
+<p>matches any <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E93">[E93]</a><a href="#NT-Char">Char</a></span> with a value not among the characters given. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E3">[E3]</a>Enumerations
+and ranges of forbidden values can be mixed in one set of brackets.</span></p>
+</dd>
+<dt class="label"><code>"string"</code></dt>
+<dd>
+<p>matches a literal string <a title="match" href="#dt-match">matching</a> that
+given inside the double quotes.</p>
+</dd>
+<dt class="label"><code>'string'</code></dt>
+<dd>
+<p>matches a literal string <a title="match" href="#dt-match">matching</a> that
+given inside the single quotes.</p>
+</dd>
+</dl><p> These symbols may be combined to match more complex patterns as follows,
+where <code>A</code> and <code>B</code> represent simple expressions: </p><dl>
+<dt class="label">(<code>expression</code>)</dt>
+<dd>
+<p><code>expression</code> is treated as a unit and may be combined as described
+in this list.</p>
+</dd>
+<dt class="label"><code>A?</code></dt>
+<dd>
+<p>matches <code>A</code> or nothing; optional <code>A</code>.</p>
+</dd>
+<dt class="label"><code>A B</code></dt>
+<dd>
+<p>matches <code>A</code> followed by <code>B</code>. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E20">[E20]</a>This
+operator has higher precedence than alternation; thus <code>A B | C D</code>
+is identical to <code>(A B) | (C D)</code>.</span></p>
+</dd>
+<dt class="label"><code>A | B</code></dt>
+<dd>
+<p>matches <code>A</code> or <code>B</code> but not both.</p>
+</dd>
+<dt class="label"><code>A - B</code></dt>
+<dd>
+<p>matches any string that matches <code>A</code> but does not match <code>B</code>.</p>
+</dd>
+<dt class="label"><code>A+</code></dt>
+<dd>
+<p>matches one or more occurrences of <code>A</code>.<span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E20">[E20]</a>Concatenation
+has higher precedence than alternation; thus <code>A+ | B+</code> is identical
+to <code>(A+) | (B+)</code>.</span></p>
+</dd>
+<dt class="label"><code>A*</code></dt>
+<dd>
+<p>matches zero or more occurrences of <code>A</code>. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E20">[E20]</a>Concatenation
+has higher precedence than alternation; thus <code>A* | B*</code> is identical
+to <code>(A*) | (B*)</code>.</span></p>
+</dd>
+</dl><p> Other notations used in the productions are: </p><dl>
+<dt class="label"><code>/* ... */</code></dt>
+<dd>
+<p>comment.</p>
+</dd>
+<dt class="label"><code>[ wfc: ... ]</code></dt>
+<dd>
+<p>well-formedness constraint; this identifies by name a constraint on <a title="Well-Formed" href="#dt-wellformed">well-formed</a> documents associated with a production.</p>
+</dd>
+<dt class="label"><code>[ vc: ... ]</code></dt>
+<dd>
+<p>validity constraint; this identifies by name a constraint on <a title="Validity" href="#dt-valid">valid</a>
+documents associated with a production.</p>
+</dd>
+</dl><p></p>
+</div>
+</div><div class="back">
+
+
+<div class="div1">
+
+<h2><a name="sec-bibliography"></a>A References</h2>
+<div class="div2">
+
+<h3><a name="sec-existing-stds"></a>A.1 Normative References</h3>
+<dl>
+<dt class="label"><span class="diff-chg"><a name="IANA"></a>IANA-CHARSETS</span></dt><dd><div class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E58">[E58]</a>(Internet
+Assigned Numbers Authority) <cite>Official Names for Character Sets</cite>,
+ed. Keld Simonsen et al. See <a href="ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets">ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets</a>. </div></dd>
+<dt class="label"><a name="RFC1766"></a>IETF RFC 1766</dt><dd>IETF
+(Internet Engineering Task Force). <cite>RFC 1766: Tags for the Identification
+of Languages</cite>, ed. H. Alvestrand. 1995. (See <a href="http://www.ietf.org/rfc/rfc1766.txt">http://www.ietf.org/rfc/rfc1766.txt</a>.)</dd>
+<dt class="label"><span class="diff-del"><a name="ISO639-old"></a>ISO 639</span></dt><dd><div class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E38">[E38]</a>
+(International Organization for Standardization). <cite>ISO 639:1988 (E).
+Code for the representation of names of languages.</cite> [Geneva]: International
+Organization for Standardization, 1988.</div></dd>
+<dt class="label"><span class="diff-del"><a name="ISO3166-old"></a>ISO 3166</span></dt><dd><div class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E38">[E38]</a>
+(International Organization for Standardization). <cite>ISO 3166-1:1997
+(E). Codes for the representation of names of countries and their subdivisions --
+Part 1: Country codes</cite> [Geneva]: International Organization for
+Standardization, 1997.</div></dd>
+<dt class="label"><a name="ISO10646"></a>ISO/IEC 10646</dt><dd>ISO (International Organization for
+Standardization). <cite>ISO/IEC 10646-1993 (E). Information technology --
+Universal Multiple-Octet Coded Character Set (UCS) -- Part 1: Architecture
+and Basic Multilingual Plane.</cite> [Geneva]: International Organization
+for Standardization, 1993 (plus amendments AM 1 through AM 7).</dd>
+<dt class="label"><span class="diff-add"><a name="ISO10646-2000"></a>ISO/IEC 10646-2000</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</a> ISO (International
+Organization for Standardization). <cite>ISO/IEC 10646-1:2000. Information
+technology -- Universal Multiple-Octet Coded Character Set (UCS) --
+Part 1: Architecture and Basic Multilingual Plane.</cite> [Geneva]: International
+Organization for Standardization, 2000.</div></dd>
+<dt class="label"><a name="Unicode"></a>Unicode</dt><dd>The Unicode Consortium. <em>The Unicode
+Standard, Version 2.0.</em> Reading, Mass.: Addison-Wesley Developers Press,
+1996.</dd>
+<dt class="label"><span class="diff-add"><a name="Unicode3"></a>Unicode3</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</a>
+The Unicode Consortium. <em>The Unicode Standard, Version 3.0.</em> Reading,
+Mass.: Addison-Wesley Developers Press, 2000. ISBN 0-201-61633-5.</div></dd>
+</dl></div>
+<div class="div2">
+
+
+<h3><a name="null"></a>A.2 Other References</h3>
+<dl>
+<dt class="label"><a name="Aho"></a>Aho/Ullman</dt><dd>Aho, Alfred V., Ravi Sethi, and Jeffrey D.
+Ullman. <cite>Compilers: Principles, Techniques, and Tools</cite>.
+Reading: Addison-Wesley, 1986, rpt. corr. 1988.</dd>
+<dt class="label"><a name="Berners-Lee"></a>Berners-Lee et al.</dt><dd> Berners-Lee, T., R. Fielding,
+and L. Masinter. <cite>Uniform Resource Identifiers (URI): Generic Syntax
+and Semantics</cite>. 1997. (Work in progress; see updates to RFC1738.)</dd>
+<dt class="label"><span class="diff-chg"><a name="ABK"></a>Brüggemann-Klein</span></dt><dd><div class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E2">[E2]</a>Brüggemann-Klein,
+Anne. Formal Models in Document Processing. Habilitationsschrift. Faculty
+of Mathematics at the University of Freiburg, 1993. (See <a href="ftp://ftp.informatik.uni-freiburg.de/documents/papers/brueggem/habil.ps">ftp://ftp.informatik.uni-freiburg.de/documents/papers/brueggem/habil.ps</a>.)</div></dd>
+<dt class="label"><span class="diff-chg"><a name="ABKDW"></a>Brüggemann-Klein and Wood</span></dt><dd><div class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E2">[E2]</a>Brüggemann-Klein,
+Anne, and Derick Wood. <cite>Deterministic Regular Languages</cite>.
+Universität Freiburg, Institut für Informatik, Bericht 38, Oktober 1991. Extended
+abstract in A. Finkel, M. Jantzen, Hrsg., STACS 1992, S. 173-184. Springer-Verlag,
+Berlin 1992. Lecture Notes in Computer Science 577. Full version titled <cite>One-Unambiguous
+Regular Languages</cite> in Information and Computation 140 (2): 229-253,
+February 1998.</div></dd>
+<dt class="label"><a name="Clark"></a>Clark</dt><dd>James Clark. Comparison of SGML and XML. See <a href="http://www.w3.org/TR/NOTE-sgml-xml-971215">http://www.w3.org/TR/NOTE-sgml-xml-971215</a>. </dd>
+<dt class="label"><span class="diff-add"><a name="IANA-LANGCODES"></a>IANA-LANGCODES</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E58">[E58]</a>(Internet
+Assigned Numbers Authority) <cite>Registry of Language Tags</cite>,
+ed. Keld Simonsen et al. (See <a href="http://www.isi.edu/in-notes/iana/assignments/languages/">http://www.isi.edu/in-notes/iana/assignments/languages/</a>.)</div></dd>
+<dt class="label"><span class="diff-del"><a name="RFC1738"></a>IETF RFC1738</span></dt><dd><div class="diff-del">IETF
+(Internet Engineering Task Force). <cite>RFC 1738: Uniform Resource Locators
+(URL)</cite>, ed. T. Berners-Lee, L. Masinter, M. McCahill. 1994. (See <a href="http://www.ietf.org/rfc/rfc1738.txt">http://www.ietf.org/rfc/rfc1738.txt</a>.)</div></dd>
+<dt class="label"><span class="diff-del"><a name="RFC1808"></a>IETF RFC1808</span></dt><dd><div class="diff-del">IETF
+(Internet Engineering Task Force). <cite>RFC 1808: Relative Uniform Resource
+Locators</cite>, ed. R. Fielding. 1995. (See <a href="http://www.ietf.org/rfc/rfc1808.txt">http://www.ietf.org/rfc/rfc1808.txt</a>.)</div></dd>
+<dt class="label"><a name="RFC2141"></a>IETF RFC2141</dt><dd>IETF
+(Internet Engineering Task Force). <em>RFC 2141: URN Syntax</em>, ed.
+R. Moats. 1997. (See <a href="http://www.ietf.org/rfc/rfc2141.txt">http://www.ietf.org/rfc/rfc2141.txt</a>.)</dd>
+<dt class="label"><span class="diff-add"><a name="rfc2279"></a>IETF RFC 2279</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E78">[E78]</a>IETF
+(Internet Engineering Task Force). <cite>RFC 2279: UTF-8, a transformation
+format of ISO 10646</cite>, <span class="diff-add">ed. F. Yergeau, </span>1998. (See <a href="http://www.ietf.org/rfc/rfc2279.txt">http://www.ietf.org/rfc/rfc2279.txt</a>.)</div></dd>
+<dt class="label"><span class="diff-add"><a name="rfc2376"></a>IETF RFC 2376</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E48">[E48]</a>IETF
+(Internet Engineering Task Force). <cite>RFC 2376: XML Media Types</cite>.
+ed. E. Whitehead, M. Murata. 1998. (See <a href="http://www.ietf.org/rfc/rfc2376.txt">http://www.ietf.org/rfc/rfc2376.txt</a>.)</div></dd>
+<dt class="label"><span class="diff-add"><a name="rfc2396"></a>IETF RFC 2396</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E66">[E66]</a>IETF
+(Internet Engineering Task Force). <cite>RFC 2396: Uniform Resource Identifiers
+(URI): Generic Syntax</cite>. T. Berners-Lee, R. Fielding, L. Masinter.
+1998. (See <a href="http://www.ietf.org/rfc/rfc2396.txt">http://www.ietf.org/rfc/rfc2396.txt</a>.)</div></dd>
+<dt class="label"><span class="diff-add"><a name="rfc2732"></a>IETF RFC 2732</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E66">[E66]</a>IETF
+(Internet Engineering Task Force). <cite>RFC 2732: Format for Literal
+IPv6 Addresses in URL's</cite>. R. Hinden, B. Carpenter, L. Masinter.
+1999. (See <a href="http://www.ietf.org/rfc/rfc2732.txt">http://www.ietf.org/rfc/rfc2732.txt</a>.)</div></dd>
+<dt class="label"><span class="diff-add"><a name="rfc2781"></a>IETF RFC 2781</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E77">[E77]</a>
+IETF (Internet Engineering Task Force). <em>RFC 2781: UTF-16, an encoding
+of ISO 10646</em>, ed. P. Hoffman, F. Yergeau. 2000. (See <a href="http://www.ietf.org/rfc/rfc2781.txt">http://www.ietf.org/rfc/rfc2781.txt</a>.)</div></dd>
+<dt class="label"><span class="diff-add"><a name="ISO639"></a>ISO 639</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E38">[E38]</a>
+(International Organization for Standardization). <cite>ISO 639:1988 (E).
+Code for the representation of names of languages.</cite> [Geneva]: International
+Organization for Standardization, 1988.</div></dd>
+<dt class="label"><span class="diff-add"><a name="ISO3166"></a>ISO 3166</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E38">[E38]</a>
+(International Organization for Standardization). <cite>ISO 3166-1:1997
+(E). Codes for the representation of names of countries and their subdivisions --
+Part 1: Country codes</cite> [Geneva]: International Organization for
+Standardization, 1997.</div></dd>
+<dt class="label"><a name="ISO8879"></a>ISO 8879</dt><dd>ISO (International Organization for Standardization). <cite>ISO
+8879:1986(E). Information processing -- Text and Office Systems --
+Standard Generalized Markup Language (SGML).</cite> First edition --
+1986-10-15. [Geneva]: International Organization for Standardization, 1986. </dd>
+<dt class="label"><a name="ISO10744"></a>ISO/IEC 10744</dt><dd>ISO (International Organization for
+Standardization). <cite>ISO/IEC 10744-1992 (E). Information technology --
+Hypermedia/Time-based Structuring Language (HyTime). </cite> [Geneva]:
+International Organization for Standardization, 1992. <em>Extended Facilities
+Annexe.</em> [Geneva]: International Organization for Standardization, 1996. </dd>
+<dt class="label"><span class="diff-add"><a name="websgml"></a>WEBSGML</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E43">[E43]</a>ISO
+(International Organization for Standardization). <cite>ISO 8879:1986
+TC2. Information technology -- Document Description and Processing Languages. </cite>
+[Geneva]: International Organization for Standardization, 1998. (See <a href="http://www.sgmlsource.com/8879rev/n0029.htm">http://www.sgmlsource.com/8879rev/n0029.htm</a>.)</div></dd>
+<dt class="label"><span class="diff-add"><a name="xml-names"></a>XML Names</span></dt><dd><div class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E98">[E98]</a>Tim Bray,
+Dave Hollander, and Andrew Layman, editors. <cite>Namespaces in XML</cite>.
+Textuality, Hewlett-Packard, and Microsoft. World Wide Web Consortium, 1999. (See <a href="http://www.w3.org/TR/REC-xml-names/">http://www.w3.org/TR/REC-xml-names/</a>.)</div></dd>
+</dl></div>
+</div>
+<div class="div1">
+
+<h2><a name="CharClasses"></a>B Character Classes</h2>
+<p>Following the characteristics defined in the Unicode standard, characters
+are classed as base characters (among others, these contain the alphabetic
+characters of the Latin alphabet<span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E84">[E84]</a>, without
+diacritics</span>), ideographic characters, and combining characters (among
+others, this class contains most diacritics)<span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E30">[E30]</a>; these classes
+combine to form the class of letters.</span> Digits and extenders are also
+distinguished.</p>
+
+<h5>Characters</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-Letter"></a>[84]   </td><td><code>Letter</code></td><td>   ::=   </td><td><code><a href="#NT-BaseChar">BaseChar</a> | <a href="#NT-Ideographic">Ideographic</a></code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-BaseChar"></a>[85]   </td><td><code>BaseChar</code></td><td>   ::=   </td><td><code>[#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6]
+| [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E]
+| [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0]
+| [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1]
+| #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1]
+| [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC
+| #x03DE | #x03E0 | [#x03E2-#x03F3] | [#x0401-#x040C]
+| [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] | [#x0490-#x04C4]
+| [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] | [#x04EE-#x04F5]
+| [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 | [#x0561-#x0586]
+| [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] | [#x0641-#x064A]
+| [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] | [#x06D0-#x06D3]
+| #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D
+| [#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8]
+| [#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD]
+| [#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10]
+| [#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36]
+| [#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74]
+| [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8]
+| [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD
+| #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28]
+| [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D
+| [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90]
+| [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F]
+| [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9]
+| [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33]
+| [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90]
+| [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE
+| [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28]
+| [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30
+| [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84
+| [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97]
+| [#x0E99-#x0E9F] | [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7
+| [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | #x0EB0 | [#x0EB2-#x0EB3]
+| #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | [#x0F49-#x0F69]
+| [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | [#x1102-#x1103]
+| [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | [#x110E-#x1112]
+| #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150
+| [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163
+| #x1165 | #x1167 | #x1169 | [#x116D-#x116E] | [#x1172-#x1173]
+| #x1175 | #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF]
+| [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | #x11EB
+| #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9]
+| [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D]
+| [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D]
+| [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4]
+| [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC]
+| [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B]
+| #x212E | [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA]
+| [#x3105-#x312C] | [#xAC00-#xD7A3] </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Ideographic"></a>[86]   </td><td><code>Ideographic</code></td><td>   ::=   </td><td><code>[#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-CombiningChar"></a>[87]   </td><td><code>CombiningChar</code></td><td>   ::=   </td><td><code>[#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486]
+| [#x0591-#x05A1] | [#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF
+| [#x05C1-#x05C2] | #x05C4 | [#x064B-#x0652] | #x0670
+| [#x06D6-#x06DC] | [#x06DD-#x06DF] | [#x06E0-#x06E4] | [#x06E7-#x06E8]
+| [#x06EA-#x06ED] | [#x0901-#x0903] | #x093C | [#x093E-#x094C]
+| #x094D | [#x0951-#x0954] | [#x0962-#x0963] | [#x0981-#x0983]
+| #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] | [#x09C7-#x09C8]
+| [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] | #x0A02
+| #x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48]
+| [#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC
+| [#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03]
+| #x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D]
+| [#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8]
+| [#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44]
+| [#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83]
+| [#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6]
+| [#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D]
+| #x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E]
+| #x0EB1 | [#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD]
+| [#x0F18-#x0F19] | #x0F35 | #x0F37 | #x0F39 | #x0F3E
+| #x0F3F | [#x0F71-#x0F84] | [#x0F86-#x0F8B] | [#x0F90-#x0F95]
+| #x0F97 | [#x0F99-#x0FAD] | [#x0FB1-#x0FB7] | #x0FB9
+| [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] | #x3099
+| #x309A </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Digit"></a>[88]   </td><td><code>Digit</code></td><td>   ::=   </td><td><code>[#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9]
+| [#x0966-#x096F] | [#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF]
+| [#x0B66-#x0B6F] | [#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF]
+| [#x0D66-#x0D6F] | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29] </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Extender"></a>[89]   </td><td><code>Extender</code></td><td>   ::=   </td><td><code>#x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640
+| #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | [#x309D-#x309E]
+| [#x30FC-#x30FE] </code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>The character classes defined here can be derived from the Unicode <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</a>2.0</span>
+character database as follows:</p>
+<ul>
+<li><p>Name start characters must have one of the categories Ll, Lu, Lo,
+Lt, Nl.</p></li>
+<li><p>Name characters other than Name-start characters must have one of
+the categories Mc, Me, Mn, Lm, or Nd.</p></li>
+<li><p>Characters in the compatibility area (i.e. with character code greater
+than #xF900 and less than #xFFFE) are not allowed in XML names.</p></li>
+<li><p>Characters which have a font or compatibility decomposition (i.e.
+those with a "compatibility formatting tag" in field 5 of the
+database -- marked by field 5 beginning with a "&lt;") are not
+allowed.</p></li>
+<li><p>The following characters are treated as name-start characters rather
+than name characters, because the property file classifies them as Alphabetic:
+[#x02BB-#x02C1], #x0559, #x06E5, #x06E6.</p></li>
+<li><p>Characters #x20DD-#x20E0 are excluded (in accordance with Unicode <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</a>2.0</span>,
+section 5.14).</p></li>
+<li><p>Character #x00B7 is classified as an extender, because the property
+list so identifies it.</p></li>
+<li><p>Character #x0387 is added as a name character, because #x00B7 is
+its canonical equivalent.</p></li>
+<li><p>Characters ':' and '_' are allowed as name-start characters.</p>
+</li>
+<li><p>Characters '-' and '.' are allowed as name characters.</p></li>
+</ul>
+</div>
+<div class="div1">
+
+<h2><a name="sec-xml-and-sgml"></a>C XML and SGML (Non-Normative)</h2>
+<p><span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E43">[E43]</a>XML
+is designed to be a subset of SGML, in that every XML document should also
+be a conforming SGML document.</span> For a detailed comparison of the additional
+restrictions that XML places on documents beyond those of SGML, see <a href="#Clark">[Clark]</a>.</p>
+</div>
+<div class="div1">
+
+<h2><a name="sec-entexpand"></a>D Expansion of Entity and Character References (Non-Normative)</h2>
+<p>This appendix contains some examples illustrating the sequence of entity-
+and character-reference recognition and expansion, as specified in <a href="#entproc"><b>4.4 XML Processor Treatment of Entities and References</b></a>.</p>
+<p>If the DTD contains the declaration</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY example "&lt;p&gt;An ampersand (&amp;#38;#38;) may be escaped
+numerically (&amp;#38;#38;#38;) or with a general entity
+(&amp;amp;amp;).&lt;/p&gt;" &gt;</pre></td></tr></table>
+<p>then the XML processor will recognize the character references when it
+parses the entity declaration, and resolve them before storing the following
+string as the value of the entity "<code>example</code>":</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;p&gt;An ampersand (&amp;#38;) may be escaped
+numerically (&amp;#38;#38;) or with a general entity
+(&amp;amp;amp;).&lt;/p&gt;</pre></td></tr></table>
+<p>A reference in the document to "<code>&amp;example;</code>"
+will cause the text to be reparsed, at which time the start- and end-tags
+of the <code>p</code> element will be recognized and the three references will
+be recognized and expanded, resulting in a <code>p</code> element with the following
+content (all data, no delimiters or markup):</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>An ampersand (&amp;) may be escaped
+numerically (&amp;#38;) or with a general entity
+(&amp;amp;).</pre></td></tr></table>
+<p>A more complex example will illustrate the rules and their effects fully.
+In the following example, the line numbers are solely for reference.</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>1 &lt;?xml version='1.0'?&gt;
+2 &lt;!DOCTYPE test [
+3 &lt;!ELEMENT test (#PCDATA) &gt;
+4 &lt;!ENTITY % xx '&amp;#37;zz;'&gt;
+5 &lt;!ENTITY % zz '&amp;#60;!ENTITY tricky "error-prone" &gt;' &gt;
+6 %xx;
+7 ]&gt;
+8 &lt;test&gt;This sample shows a &amp;tricky; method.&lt;/test&gt;</pre></td></tr></table>
+<p>This produces the following:</p>
+<ul>
+<li><p>in line 4, the reference to character 37 is expanded immediately,
+and the parameter entity "<code>xx</code>" is stored in the symbol
+table with the value "<code>%zz;</code>". Since the replacement
+text is not rescanned, the reference to parameter entity "<code>zz</code>"
+is not recognized. (And it would be an error if it were, since "<code>zz</code>"
+is not yet declared.)</p></li>
+<li><p>in line 5, the character reference "<code>&amp;#60;</code>"
+is expanded immediately and the parameter entity "<code>zz</code>"
+is stored with the replacement text "<code>&lt;!ENTITY tricky "error-prone"
+&gt;</code>", which is a well-formed entity declaration.</p></li>
+<li><p>in line 6, the reference to "<code>xx</code>" is recognized,
+and the replacement text of "<code>xx</code>" (namely "<code>%zz;</code>")
+is parsed. The reference to "<code>zz</code>" is recognized in
+its turn, and its replacement text ("<code>&lt;!ENTITY tricky "error-prone"
+&gt;</code>") is parsed. The general entity "<code>tricky</code>"
+has now been declared, with the replacement text "<code>error-prone</code>".</p>
+</li>
+<li><p>in line 8, the reference to the general entity "<code>tricky</code>"
+is recognized, and it is expanded, so the full content of the <code>test</code>
+element is the self-describing (and ungrammatical) string <em>This sample
+shows a error-prone method.</em></p></li>
+</ul>
+</div>
+<div class="div1">
+
+<h2><a name="determinism"></a>E Deterministic Content Models (Non-Normative)</h2>
+<p><span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E102">[E102]</a>As
+noted in <a href="#sec-element-content"><b>3.2.1 Element Content</b></a>, it is required that content
+models in element type declarations be deterministic. This requirement is <a title="For Compatibility" href="#dt-compat">for compatibility</a> with SGML (which calls deterministic
+content models "unambiguous");</span> XML processors built
+using SGML systems may flag non-deterministic content models as errors.</p>
+<p>For example, the content model <code>((b, c) | (b, d))</code> is non-deterministic,
+because given an initial <code>b</code> the <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E95">[E95]</a>XML processor</span>
+cannot know which <code>b</code> in the model is being matched without looking
+ahead to see which element follows the <code>b</code>. In this case, the two references
+to <code>b</code> can be collapsed into a single reference, making the model read <code>(b,
+(c | d))</code>. An initial <code>b</code> now clearly matches only a single name
+in the content model. The <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E95">[E95]</a>processor</span> doesn't need to look ahead to see what follows; either <code>c</code> or <code>d</code>
+would be accepted.</p>
+<p>More formally: a finite state automaton may be constructed from the content
+model using the standard algorithms, e.g. algorithm 3.5 in section 3.9 of
+Aho, Sethi, and Ullman <a href="#Aho">[Aho/Ullman]</a>. In many such algorithms, a follow
+set is constructed for each position in the regular expression (i.e., each
+leaf node in the syntax tree for the regular expression); if any position
+has a follow set in which more than one following position is labeled with
+the same element type name, then the content model is in error and may be
+reported as an error.</p>
+<p>Algorithms exist which allow many but not all non-deterministic content
+models to be reduced automatically to equivalent deterministic models; see
+Brüggemann-Klein 1991 <a href="#ABK">[Brüggemann-Klein]</a>.</p>
+</div>
+<div class="div1">
+
+<h2><a name="sec-guessing"></a>F <a href="http://www.w3.org/XML/xml-19980210-errata#E105">[E105]</a><a href="http://www.w3.org/XML/xml-19980210-errata#E48">[E48]</a>Autodetection
+of Character Encodings (Non-Normative)</h2>
+<p>The XML encoding declaration functions as an internal label on each entity,
+indicating which character encoding is in use. Before an XML processor can
+read the internal label, however, it apparently has to know what character
+encoding is in use--which is what the internal label is trying to indicate.
+In the general case, this is a hopeless situation. It is not entirely hopeless
+in XML, however, because XML limits the general case in two ways: each implementation
+is assumed to support only a finite set of character encodings, and the XML
+encoding declaration is restricted in position and content in order to make
+it feasible to autodetect the character encoding in use in each entity in
+normal cases. Also, in many cases other sources of information are available
+in addition to the XML data stream itself. Two cases may be distinguished,
+depending on whether the XML entity is presented to the processor without,
+or with, any accompanying (external) information. We consider the first case
+first.</p>
+<div class="div2">
+<div class="diff-add">
+<h3><a name="sec-guessing-no-ext-info"></a>F.1 Detection Without External Encoding Information</h3></div>
+<p>Because each XML entity <span class="diff-add">not accompanied by external
+encoding information and </span>not in UTF-8 or UTF-16 <span class="diff-chg">encoding</span> <em>must</em>
+begin with an XML encoding declaration, in which the first characters must
+be '<code>&lt;?xml</code>', any conforming processor can detect, after two
+to four octets of input, which of the following cases apply. In reading this
+list, it may help to know that in UCS-4, '&lt;' is "<code>#x0000003C</code>"
+and '?' is "<code>#x0000003F</code>", and the Byte Order Mark
+required of UTF-16 data streams is "<code>#xFEFF</code>". <span class="diff-add">The notation <var>##</var> is used to denote any byte value except <span class="diff-chg">that two consecutive <var>##</var>s cannot be both 00</span>.</span></p>
+<div class="diff-add"><p>With a Byte Order Mark:</p></div>
+<div class="diff-add"><table border="1" frame="border"><tbody><tr><td rowspan="1" colspan="1"><code>00 00 FE
+FF</code></td><td rowspan="1" colspan="1">UCS-4, big-endian machine (1234 order)</td></tr><tr><td rowspan="1" colspan="1"><code>FF
+FE 00 00</code></td><td rowspan="1" colspan="1">UCS-4, little-endian machine (4321 order)</td></tr>
+<tr><td rowspan="1" colspan="1"><code>00 00 FF FE</code></td><td rowspan="1" colspan="1">UCS-4, unusual octet order (2143)</td>
+</tr><tr><td rowspan="1" colspan="1"><code>FE FF 00 00</code></td><td rowspan="1" colspan="1">UCS-4, unusual octet order (3412)</td>
+</tr><tr><td rowspan="1" colspan="1"><code>FE FF ## ##</code></td><td rowspan="1" colspan="1">UTF-16, big-endian</td></tr>
+<tr><td rowspan="1" colspan="1"><code>FF FE ## ##</code></td><td rowspan="1" colspan="1">UTF-16, little-endian</td></tr><tr>
+<td rowspan="1" colspan="1"><code>EF BB BF</code></td><td rowspan="1" colspan="1">UTF-8</td></tr></tbody></table></div>
+<div class="diff-add"><p>Without a Byte Order Mark:</p></div>
+<div class="diff-add"><table border="1" frame="border"><tbody><tr><td rowspan="1" colspan="1"><code>00 00 00 3C</code></td>
+<td rowspan="4" colspan="1">UCS-4 or other encoding with a 32-bit code unit and ASCII
+characters encoded as ASCII values, in respectively big-endian (1234), little-endian
+(4321) and two unusual byte orders (2143 and 3412). The encoding declaration
+must be read to determine which of UCS-4 or other supported 32-bit encodings
+applies.</td></tr><tr><td rowspan="1" colspan="1"><code>3C 00 00 00</code></td>
+
+</tr><tr><td rowspan="1" colspan="1"><code>00 00 3C 00</code></td>
+
+</tr><tr><td rowspan="1" colspan="1"><code>00 3C 00 00</code></td>
+
+</tr><tr><td rowspan="1" colspan="1"><code>00 3C 00 3F</code></td><td rowspan="1" colspan="1">UTF-16BE or big-endian ISO-10646-UCS-2
+or other encoding with a 16-bit code unit in big-endian order and ASCII characters
+encoded as ASCII values (the encoding declaration must be read to determine
+which)</td></tr><tr><td rowspan="1" colspan="1"><code>3C 00 3F 00</code></td><td rowspan="1" colspan="1">UTF-16LE or little-endian
+ISO-10646-UCS-2 or other encoding with a 16-bit code unit in little-endian
+order and ASCII characters encoded as ASCII values (the encoding declaration
+must be read to determine which)</td></tr><tr><td rowspan="1" colspan="1"><code>3C 3F 78 6D</code></td>
+<td rowspan="1" colspan="1">UTF-8, ISO 646, ASCII, some part of ISO 8859, Shift-JIS, EUC, or any other
+7-bit, 8-bit, or mixed-width encoding which ensures that the characters of
+ASCII have their normal positions, width, and values; the actual encoding
+declaration must be read to detect which of these applies, but since all of
+these encodings use the same bit patterns for the relevant ASCII characters,
+the encoding declaration itself may be read reliably</td></tr><tr><td rowspan="1" colspan="1"><code>4C
+6F A7 94</code></td><td rowspan="1" colspan="1">EBCDIC (in some flavor; the full encoding declaration
+must be read to tell which code page is in use)</td></tr><tr><td rowspan="1" colspan="1">Other</td>
+<td rowspan="1" colspan="1">UTF-8 without an encoding declaration, or else the data stream is mislabeled
+(lacking a required encoding declaration), corrupt, fragmentary, or enclosed
+in a wrapper of some kind</td></tr></tbody></table></div>
+<div class="diff-add"><div class="note"><p class="prefix"><b>Note:</b></p>
+<p>In cases above which do not require reading the encoding declaration to
+determine the encoding, section 4.3.3 still requires that the encoding declaration,
+if present, be read and that the encoding name be checked to match the actual
+encoding of the entity. Also, it is possible that new character encodings
+will be invented that will make it necessary to use the encoding declaration
+to determine the encoding, in cases where this is not required at present.</p>
+</div></div>
+<p>This level of autodetection is enough to read the XML encoding declaration
+and parse the character-encoding identifier, which is still necessary to distinguish
+the individual members of each family of encodings (e.g. to tell UTF-8 from
+8859, and the parts of 8859 from each other, or to distinguish the specific
+EBCDIC code page in use, and so on).</p>
+<p>Because the contents of the encoding declaration are restricted to <span class="diff-chg">characters from the ASCII repertoire (however encoded)</span>,
+a processor can reliably read the entire encoding declaration as soon as it
+has detected which family of encodings is in use. Since in practice, all widely
+used character encodings fall into one of the categories above, the XML encoding
+declaration allows reasonably reliable in-band labeling of character encodings,
+even when external sources of information at the operating-system or transport-protocol
+level are unreliable. <span class="diff-del">Note that since external parsed entities
+in UTF-16 may begin with any character, this autodetection does not always
+work. Also, </span><span class="diff-add">Character encodings such as UTF-7
+that make overloaded usage of ASCII-valued bytes may fail to be reliably detected.</span></p>
+<p>Once the processor has detected the character encoding in use, it can act
+appropriately, whether by invoking a separate input routine for each case,
+or by calling the proper conversion function on each character of input.</p>
+<p>Like any self-labeling system, the XML encoding declaration will not work
+if any software changes the entity's character set or encoding without updating
+the encoding declaration. Implementors of character-encoding routines should
+be careful to ensure the accuracy of the internal and external information
+used to label the entity.</p>
+</div>
+<div class="div2">
+<div class="diff-add">
+<h3><a name="sec-guessing-with-ext-info"></a>F.2 Priorities in the Presence of External Encoding Information</h3></div>
+<p>The second possible case occurs when the XML entity is accompanied by encoding
+information, as in some file systems and some network protocols. When multiple
+sources of information are available, their relative priority and the preferred
+method of handling conflict should be specified as part of the higher-level
+protocol used to deliver XML. <span class="diff-chg">In particular, please refer
+to <a href="#rfc2376">[IETF RFC 2376]</a> or its successor, which defines the <code>text/xml</code>
+and <code>application/xml</code> MIME types and provides some useful guidance.
+In the interests of interoperability, however, the following rule is recommended.</span></p>
+<ul>
+<li><p>If an XML entity is in a file, the Byte-Order Mark and encoding declaration <span class="diff-del">PI </span>are used (if present) to determine the character encoding.<span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E74">[E74]</a>
+All other heuristics and sources of information are solely for error recovery.</span></p>
+</li>
+</ul>
+<div class="diff-del"><ul>
+<li><p>If an XML entity is delivered with a MIME type of text/xml, then
+the <code>charset</code> parameter on the MIME type determines the character
+encoding method; all other heuristics and sources of information are solely
+for error recovery.</p></li>
+<li><p>If an XML entity is delivered with a MIME type of application/xml,
+then the Byte-Order Mark and encoding-declaration PI are used (if present)
+to determine the character encoding. All other heuristics and sources of information
+are solely for error recovery.</p></li>
+</ul></div>
+<div class="diff-del"><p>These rules apply only in the absence of protocol-level documentation;
+in particular, when the MIME types text/xml and application/xml are defined,
+the recommendations of the relevant RFC will supersede these rules.</p></div>
+</div>
+</div>
+<div class="div1">
+
+<h2><a name="sec-xml-wg"></a>G W3C XML Working Group (Non-Normative)</h2>
+<p>This specification was prepared and approved for publication by the W3C
+XML Working Group (WG). WG approval of this specification does not necessarily
+imply that all WG members voted for its approval. The current and former members
+of the XML WG are:</p>
+<ul>
+<li>Jon Bosak, Sun (<i>Chair</i>)
+</li>
+<li>James Clark (<i>Technical Lead</i>) </li>
+<li>Tim Bray, Textuality and Netscape
+ (<i>XML Co-editor</i>) </li>
+<li>Jean Paoli, Microsoft (<i>XML
+Co-editor</i>) </li>
+<li>C. M. Sperberg-McQueen, U. of Ill.
+ (<i>XML Co-editor</i>) </li>
+<li>Dan Connolly, W3C (<i>W3C Liaison</i>)
+</li>
+<li>Paula Angerstein, Texcel</li>
+<li>Steve DeRose, INSO</li>
+<li>Dave Hollander, HP</li>
+<li>Eliot Kimber, ISOGEN</li>
+<li>Eve Maler, ArborText</li>
+<li>Tom Magliery, NCSA</li>
+<li>Murray Maloney<span class="diff-chg">, SoftQuad, Grif
+SA, Muzmo and Veo Systems</span></li>
+<li><span class="diff-chg">MURATA Makoto (FAMILY Given)</span>, Fuji
+Xerox Information Systems</li>
+<li>Joel Nava, Adobe</li>
+<li>Conleth O'Connell, Vignette
+</li>
+<li>Peter Sharpe, SoftQuad</li>
+<li>John Tigue, DataChannel</li>
+</ul>
+</div>
+<div class="diff-add"><div class="div1">
+
+<h2><a name="sec-core-wg"></a>H W3C XML Core Group (Non-Normative)</h2>
+<p>The second edition of this specification was prepared by the W3C XML Core
+Working Group (WG). The members of the WG at the time of publication of this
+edition were:</p>
+<ul>
+<li>Paula Angerstein, Vignette</li>
+<li>Daniel Austin, Ask Jeeves</li>
+<li>Tim Boland</li>
+<li>Allen Brown, Microsoft</li>
+<li>Dan Connolly, W3C (<i>Staff
+Contact</i>) </li>
+<li>John Cowan, Reuters Limited
+</li>
+<li>John Evdemon, XMLSolutions Corporation
+</li>
+<li>Paul Grosso, Arbortext (<i>Co-Chair</i>)
+</li>
+<li>Arnaud Le Hors, IBM (<i>Co-Chair</i>)
+</li>
+<li>Eve Maler, Sun Microsystems
+ (<i>Second Edition Editor</i>) </li>
+<li>Jonathan Marsh, Microsoft</li>
+<li>MURATA Makoto (FAMILY Given), IBM
+</li>
+<li>Mark Needleman, Data Research Associates
+</li>
+<li>David Orchard, Jamcracker</li>
+<li>Lew Shannon, NCR</li>
+<li>Richard Tobin, University of Edinburgh
+</li>
+<li>Daniel Veillard, W3C</li>
+<li>Dan Vint, Lexica</li>
+<li>Norman Walsh, Sun Microsystems
+</li>
+<li>François Yergeau, Alis Technologies
+ (<i>Errata List Editor</i>) </li>
+<li>Kongyi Zhou, Oracle</li>
+</ul>
+</div></div>
+<div class="diff-add"><div class="div1">
+
+<h2><a name="id2683713"></a>I Production Notes (Non-Normative)</h2>
+<p>This Second Edition was encoded in the <a href="http://www.w3.org/XML/1998/06/xmlspec-v21.dtd">XMLspec
+DTD</a> (which has <a href="http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm">documentation</a>
+available). The HTML versions were produced with a combination of the <a href="http://www.w3.org/XML/1998/06/xmlspec.xsl">xmlspec.xsl</a>, <a href="http://www.w3.org/XML/1998/06/diffspec.xsl">diffspec.xsl</a>,
+and <a href="http://www.w3.org/XML/1998/06/REC-xml-2e.xsl">REC-xml-2e.xsl</a>
+XSLT stylesheets. The PDF version was produced with the <a href="http://www.tdb.uu.se/~jan/html2ps.html">html2ps</a>
+facility and a distiller program.</p>
+</div></div>
+</div></body></html>
diff --git a/libxslt/tests/xmlspec/REC-xml-20001006.html b/libxslt/tests/xmlspec/REC-xml-20001006.html
new file mode 100644
index 0000000..341dbdc
--- /dev/null
+++ b/libxslt/tests/xmlspec/REC-xml-20001006.html
@@ -0,0 +1,2495 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="EN"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Extensible Markup Language (XML) 1.0 (Second Edition)</title><style type="text/css">
+code { font-family: monospace; }
+
+div.constraint,
+div.issue,
+div.note,
+div.notice { margin-left: 2em; }
+
+dt.label { display: run-in; }
+
+li p { margin-top: 0.3em;
+ margin-bottom: 0.3em; }
+ </style><link rel="stylesheet" type="text/css" href="W3C-REC.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>Extensible Markup Language (XML) 1.0 (Second Edition)</h1>
+<h2>W3C Recommendation 6 October 2000</h2><dl><dt>This version:</dt><dd><a href="http://www.w3.org/TR/2000/REC-xml-20001006">http://www.w3.org/TR/2000/REC-xml-20001006</a>
+(<a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XHTML</a>, <a href="http://www.w3.org/TR/2000/REC-xml-20001006.xml">XML</a>, <a href="http://www.w3.org/TR/2000/REC-xml-20001006.pdf">PDF</a>, <a href="http://www.w3.org/TR/2000/REC-xml-20001006-review.html">XHTML
+review version</a> with color-coded revision indicators)</dd><dt>Latest version:</dt><dd><a href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</a></dd><dt>Previous versions:</dt><dd><a href="http://www.w3.org/TR/2000/WD-xml-2e-20000814"> http://www.w3.org/TR/2000/WD-xml-2e-20000814</a>
+<a href="http://www.w3.org/TR/1998/REC-xml-19980210"> http://www.w3.org/TR/1998/REC-xml-19980210</a> </dd><dt>Editors:</dt>
+<dd>Tim Bray, Textuality and Netscape <a href="mailto:tbray@textuality.com">&lt;tbray@textuality.com&gt;</a></dd>
+<dd>Jean Paoli, Microsoft <a href="mailto:jeanpa@microsoft.com">&lt;jeanpa@microsoft.com&gt;</a></dd>
+<dd>C. M. Sperberg-McQueen, University
+of Illinois at Chicago and Text Encoding Initiative <a href="mailto:cmsmcq@uic.edu">&lt;cmsmcq@uic.edu&gt;</a></dd>
+<dd>Eve Maler, Sun Microsystems,
+Inc. <a href="mailto:elm@east.sun.com">&lt;eve.maler@east.sun.com&gt;</a> - Second Edition</dd>
+</dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2000 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.lcs.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.inria.fr/"><abbr lang="fr" title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr></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>, <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</a>, and <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</a> rules apply.</p></div><hr><div id="abstract">
+<h2><a name="abstract">Abstract</a></h2>
+<p>The Extensible Markup Language (XML) is a subset of SGML that is completely
+described in this document. Its goal is to enable generic SGML to be served,
+received, and processed on the Web in the way that is now possible with HTML.
+XML has been designed for ease of implementation and for interoperability
+with both SGML and HTML.</p>
+</div><div id="status">
+<h2><a name="status">Status of this Document</a></h2>
+<p>This document has been reviewed by W3C Members and other interested parties
+and has been endorsed by the Director as a W3C Recommendation. It is a stable
+document and may be used as reference material or cited as a normative reference
+from another document. W3C's role in making the Recommendation is to draw
+attention to the specification and to promote its widespread deployment. This
+enhances the functionality and interoperability of the Web.</p>
+<p>This document specifies a syntax created by subsetting an existing, widely
+used international text processing standard (Standard Generalized Markup Language,
+ISO 8879:1986(E) as amended and corrected) for use on the World Wide Web.
+It is a product of the W3C XML Activity, details of which can be found at <a href="http://www.w3.org/XML/">http://www.w3.org/XML</a>.
+The English version of this specification is the only normative version. However,
+for translations of this document, see <a href="http://www.w3.org/XML/#trans">http://www.w3.org/XML/#trans</a>. A
+list of current W3C Recommendations and other technical documents can be found
+at <a href="http://www.w3.org/TR/">http://www.w3.org/TR</a>.</p>
+
+<p>This second edition is <em>not</em> a new version of XML (first published 10 February 1998);
+it merely incorporates the changes dictated by the first-edition errata (available
+at <a href="http://www.w3.org/XML/xml-19980210-errata">http://www.w3.org/XML/xml-19980210-errata</a>)
+as a convenience to readers. The errata list for this second edition is available
+at <a href="http://www.w3.org/XML/xml-V10-2e-errata">http://www.w3.org/XML/xml-V10-2e-errata</a>.</p>
+<p>Please report errors in this document to <a href="mailto:xml-editor@w3.org">xml-editor@w3.org</a>; <a href="http://lists.w3.org/Archives/Public/xml-editor">archives</a> are available.</p>
+<div class="note"><p class="prefix"><b>Note:</b></p>
+<p>C. M. Sperberg-McQueen's affiliation has changed since the publication
+of the first edition. He is now at the World Wide Web Consortium, and can
+be contacted at <a href="mailto:cmsmcq@w3.org">cmsmcq@w3.org</a>.</p>
+</div>
+</div>
+<div class="toc">
+<h2><a name="contents">Table of Contents</a></h2><p class="toc">1 <a href="#sec-intro">Introduction</a><br>    1.1 <a href="#sec-origin-goals">Origin and Goals</a><br>    1.2 <a href="#sec-terminology">Terminology</a><br>2 <a href="#sec-documents">Documents</a><br>    2.1 <a href="#sec-well-formed">Well-Formed XML Documents</a><br>    2.2 <a href="#charsets">Characters</a><br>    2.3 <a href="#sec-common-syn">Common Syntactic Constructs</a><br>    2.4 <a href="#syntax">Character Data and Markup</a><br>    2.5 <a href="#sec-comments">Comments</a><br>    2.6 <a href="#sec-pi">Processing Instructions</a><br>    2.7 <a href="#sec-cdata-sect">CDATA Sections</a><br>    2.8 <a href="#sec-prolog-dtd">Prolog and Document Type Declaration</a><br>    2.9 <a href="#sec-rmd">Standalone Document Declaration</a><br>    2.10 <a href="#sec-white-space">White Space Handling</a><br>    2.11 <a href="#sec-line-ends">End-of-Line Handling</a><br>    2.12 <a href="#sec-lang-tag">Language Identification</a><br>3 <a href="#sec-logical-struct">Logical Structures</a><br>    3.1 <a href="#sec-starttags">Start-Tags, End-Tags, and Empty-Element Tags</a><br>    3.2 <a href="#elemdecls">Element Type Declarations</a><br>        3.2.1 <a href="#sec-element-content">Element Content</a><br>        3.2.2 <a href="#sec-mixed-content">Mixed Content</a><br>    3.3 <a href="#attdecls">Attribute-List Declarations</a><br>        3.3.1 <a href="#sec-attribute-types">Attribute Types</a><br>        3.3.2 <a href="#sec-attr-defaults">Attribute Defaults</a><br>        3.3.3 <a href="#AVNormalize">Attribute-Value
+Normalization</a><br>    3.4 <a href="#sec-condition-sect">Conditional Sections</a><br>4 <a href="#sec-physical-struct">Physical Structures</a><br>    4.1 <a href="#sec-references">Character and Entity References</a><br>    4.2 <a href="#sec-entity-decl">Entity Declarations</a><br>        4.2.1 <a href="#sec-internal-ent">Internal Entities</a><br>        4.2.2 <a href="#sec-external-ent">External Entities</a><br>    4.3 <a href="#TextEntities">Parsed Entities</a><br>        4.3.1 <a href="#sec-TextDecl">The Text Declaration</a><br>        4.3.2 <a href="#wf-entities">Well-Formed Parsed Entities</a><br>        4.3.3 <a href="#charencoding">Character Encoding in Entities</a><br>    4.4 <a href="#entproc">XML Processor Treatment of Entities and References</a><br>        4.4.1 <a href="#not-recognized">Not Recognized</a><br>        4.4.2 <a href="#included">Included</a><br>        4.4.3 <a href="#include-if-valid">Included If Validating</a><br>        4.4.4 <a href="#forbidden">Forbidden</a><br>        4.4.5 <a href="#inliteral">Included in Literal</a><br>        4.4.6 <a href="#notify">Notify</a><br>        4.4.7 <a href="#bypass">Bypassed</a><br>        4.4.8 <a href="#as-PE">Included as PE</a><br>    4.5 <a href="#intern-replacement">Construction of Internal Entity Replacement Text</a><br>    4.6 <a href="#sec-predefined-ent">Predefined Entities</a><br>    4.7 <a href="#Notations">Notation Declarations</a><br>    4.8 <a href="#sec-doc-entity">Document Entity</a><br>5 <a href="#sec-conformance">Conformance</a><br>    5.1 <a href="#proc-types">Validating and Non-Validating Processors</a><br>    5.2 <a href="#safe-behavior">Using XML Processors</a><br>6 <a href="#sec-notation">Notation</a><br></p>
+<h3>Appendices</h3><p class="toc">A <a href="#sec-bibliography">References</a><br>    A.1 <a href="#sec-existing-stds">Normative References</a><br>    A.2 <a href="#null">Other References</a><br>B <a href="#CharClasses">Character Classes</a><br>C <a href="#sec-xml-and-sgml">XML and SGML</a> (Non-Normative)<br>D <a href="#sec-entexpand">Expansion of Entity and Character References</a> (Non-Normative)<br>E <a href="#determinism">Deterministic Content Models</a> (Non-Normative)<br>F <a href="#sec-guessing">Autodetection
+of Character Encodings</a> (Non-Normative)<br>    F.1 <a href="#sec-guessing-no-ext-info">Detection Without External Encoding Information</a><br>    F.2 <a href="#sec-guessing-with-ext-info">Priorities in the Presence of External Encoding Information</a><br>G <a href="#sec-xml-wg">W3C XML Working Group</a> (Non-Normative)<br>H <a href="#sec-core-wg">W3C XML Core Group</a> (Non-Normative)<br>I <a href="#id2683713">Production Notes</a> (Non-Normative)<br></p></div><hr><div class="body">
+<div class="div1">
+
+<h2><a name="sec-intro"></a>1 Introduction</h2>
+<p>Extensible Markup Language, abbreviated XML, describes a class of data
+objects called <a title="XML Document" href="#dt-xml-doc">XML documents</a> and partially
+describes the behavior of computer programs which process them. XML is an
+application profile or restricted form of SGML, the Standard Generalized Markup
+Language <a href="#ISO8879">[ISO 8879]</a>. By construction, XML documents are conforming
+SGML documents.</p>
+<p>XML documents are made up of storage units called <a title="Entity" href="#dt-entity">entities</a>,
+which contain either parsed or unparsed data. Parsed data is made up of <a title="Character" href="#dt-character">characters</a>, some of which form <a title="Character Data" href="#dt-chardata">character
+data</a>, and some of which form <a title="Markup" href="#dt-markup">markup</a>.
+Markup encodes a description of the document's storage layout and logical
+structure. XML provides a mechanism to impose constraints on the storage layout
+and logical structure.</p>
+<p>[<a name="dt-xml-proc" title="XML Processor">Definition</a>: A software module called
+an <b>XML processor</b> is used to read XML documents and provide access
+to their content and structure.] [<a name="dt-app" title="Application">Definition</a>: It
+is assumed that an XML processor is doing its work on behalf of another module,
+called the <b>application</b>.] This specification describes
+the required behavior of an XML processor in terms of how it must read XML
+data and the information it must provide to the application.</p>
+<div class="div2">
+
+<h3><a name="sec-origin-goals"></a>1.1 Origin and Goals</h3>
+<p>XML was developed by an XML Working Group (originally known as the SGML
+Editorial Review Board) formed under the auspices of the World Wide Web Consortium
+(W3C) in 1996. It was chaired by Jon Bosak of Sun Microsystems with the active
+participation of an XML Special Interest Group (previously known as the SGML
+Working Group) also organized by the W3C. The membership of the XML Working
+Group is given in an appendix. Dan Connolly served as the WG's contact with
+the W3C.</p>
+<p>The design goals for XML are:</p>
+<ol>
+<li><p>XML shall be straightforwardly usable over the Internet.</p></li>
+<li><p>XML shall support a wide variety of applications.</p></li>
+<li><p>XML shall be compatible with SGML.</p></li>
+<li><p>It shall be easy to write programs which process XML documents.</p>
+</li>
+<li><p>The number of optional features in XML is to be kept to the absolute
+minimum, ideally zero.</p></li>
+<li><p>XML documents should be human-legible and reasonably clear.</p></li>
+<li><p>The XML design should be prepared quickly.</p></li>
+<li><p>The design of XML shall be formal and concise.</p></li>
+<li><p>XML documents shall be easy to create.</p></li>
+<li><p>Terseness in XML markup is of minimal importance.</p></li>
+</ol>
+<p>This specification, together with associated standards (Unicode and ISO/IEC
+10646 for characters, Internet RFC 1766 for language identification tags,
+ISO 639 for language name codes, and ISO 3166 for country name codes), provides
+all the information necessary to understand XML Version 1.0 and
+construct computer programs to process it.</p>
+<p>This version of the XML specification may be distributed freely, as long as
+all text and legal notices remain intact.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-terminology"></a>1.2 Terminology</h3>
+<p>The terminology used to describe XML documents is defined in the body of
+this specification. The terms defined in the following list are used in building
+those definitions and in describing the actions of an XML processor: </p><dl>
+<dt class="label">may</dt>
+<dd>
+<p>[<a name="dt-may" title="May">Definition</a>: Conforming documents and XML processors
+are permitted to but need not behave as described.]</p>
+</dd>
+<dt class="label">must</dt>
+<dd>
+<p>[<a name="dt-must" title="Must">Definition</a>: Conforming documents and XML processors
+are required to behave as described; otherwise they are in error. ]</p>
+</dd>
+<dt class="label">error</dt>
+<dd>
+<p>[<a name="dt-error" title="Error">Definition</a>: A violation of the rules of this specification;
+results are undefined. Conforming software may detect and report an error
+and may recover from it.]</p>
+</dd>
+<dt class="label">fatal error</dt>
+<dd>
+<p>[<a name="dt-fatal" title="Fatal Error">Definition</a>: An error which a conforming <a title="XML Processor" href="#dt-xml-proc">XML processor</a> must detect and report to the application.
+After encountering a fatal error, the processor may continue processing the
+data to search for further errors and may report such errors to the application.
+In order to support correction of errors, the processor may make unprocessed
+data from the document (with intermingled character data and markup) available
+to the application. Once a fatal error is detected, however, the processor
+must not continue normal processing (i.e., it must not continue to pass character
+data and information about the document's logical structure to the application
+in the normal way).]</p>
+</dd>
+<dt class="label">at user option</dt>
+<dd>
+<p>[<a name="dt-atuseroption" title="At user option">Definition</a>: Conforming software
+may or must (depending on the modal verb in the sentence) behave as described;
+if it does, it must provide users a means to enable or disable the behavior
+described.]</p>
+</dd>
+<dt class="label">validity constraint</dt>
+<dd>
+<p>[<a name="dt-vc" title="Validity constraint">Definition</a>: A rule which applies to
+all <a title="Validity" href="#dt-valid">valid</a> XML documents. Violations of validity
+constraints are errors; they must, at user option, be reported by <a title="Validating Processor" href="#dt-validating">validating XML processors</a>.]</p>
+</dd>
+<dt class="label">well-formedness constraint</dt>
+<dd>
+<p>[<a name="dt-wfc" title="Well-formedness constraint">Definition</a>: A rule which applies
+to all <a title="Well-Formed" href="#dt-wellformed">well-formed</a> XML documents. Violations
+of well-formedness constraints are <a title="Fatal Error" href="#dt-fatal">fatal errors</a>.]</p>
+</dd>
+<dt class="label">match</dt>
+<dd>
+<p>[<a name="dt-match" title="match">Definition</a>: (Of strings or names:) Two strings
+or names being compared must be identical. Characters with multiple possible
+representations in ISO/IEC 10646 (e.g. characters with both precomposed and
+base+diacritic forms) match only if they have the same representation in both
+strings. No
+case folding is performed. (Of strings and rules in the grammar:) A string
+matches a grammatical production if it belongs to the language generated by
+that production. (Of content and content models:) An element matches its declaration
+when it conforms in the fashion described in the constraint <a href="#elementvalid"><b>[VC: Element Valid]</b></a>.]</p>
+</dd>
+<dt class="label">for compatibility</dt>
+<dd>
+<p>[<a name="dt-compat" title="For Compatibility">Definition</a>: Marks
+a sentence describing a feature of XML included solely to ensure
+that XML remains compatible with SGML.]</p>
+</dd>
+<dt class="label">for interoperability</dt>
+<dd>
+<p>[<a name="dt-interop" title="For interoperability">Definition</a>: Marks
+a sentence describing a non-binding recommendation included to increase
+the chances that XML documents can be processed by the existing installed
+base of SGML processors which predate the WebSGML Adaptations Annex to ISO 8879.]</p>
+</dd>
+</dl><p></p>
+</div>
+</div>
+
+<div class="div1">
+
+<h2><a name="sec-documents"></a>2 Documents</h2>
+<p>[<a name="dt-xml-doc" title="XML Document">Definition</a>: A data object is an <b>XML
+document</b> if it is <a title="Well-Formed" href="#dt-wellformed">well-formed</a>,
+as defined in this specification. A well-formed XML document may in addition
+be <a title="Validity" href="#dt-valid">valid</a> if it meets certain further constraints.]</p>
+<p>Each XML document has both a logical and a physical structure. Physically,
+the document is composed of units called <a title="Entity" href="#dt-entity">entities</a>.
+An entity may <a title="Entity Reference" href="#dt-entref">refer</a> to other entities to
+cause their inclusion in the document. A document begins in a "root"
+or <a title="Document Entity" href="#dt-docent">document entity</a>. Logically, the document
+is composed of declarations, elements, comments, character references, and
+processing instructions, all of which are indicated in the document by explicit
+markup. The logical and physical structures must nest properly, as described
+in <a href="#wf-entities"><b>4.3.2 Well-Formed Parsed Entities</b></a>.</p>
+<div class="div2">
+
+<h3><a name="sec-well-formed"></a>2.1 Well-Formed XML Documents</h3>
+<p>[<a name="dt-wellformed" title="Well-Formed">Definition</a>: A textual object is a <b>well-formed</b>
+XML document if:]</p>
+<ol>
+<li><p>Taken as a whole, it matches the production labeled <a href="#NT-document">document</a>.</p>
+</li>
+<li><p>It meets all the well-formedness constraints given in this specification.</p>
+</li>
+<li><p>Each of the <a title="Text Entity" href="#dt-parsedent">parsed entities</a>
+which is referenced directly or indirectly within the document is <a title="Well-Formed" href="#dt-wellformed">well-formed</a>.</p></li>
+</ol>
+
+<h5>Document</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-document"></a>[1]   </td><td><code>document</code></td><td>   ::=   </td><td><code><a href="#NT-prolog">prolog</a> <a href="#NT-element">element</a> <a href="#NT-Misc">Misc</a>*</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>Matching the <a href="#NT-document">document</a> production implies that:</p>
+<ol>
+<li><p>It contains one or more <a title="Element" href="#dt-element">elements</a>.</p>
+</li>
+
+<li><p>[<a name="dt-root" title="Root Element">Definition</a>: There is exactly one element,
+called the <b>root</b>, or document element, no part of which appears
+in the <a title="Content" href="#dt-content">content</a> of any other element.] For
+all other elements, if the <a title="Start-Tag" href="#dt-stag">start-tag</a> is in
+the content of another element, the <a title="End Tag" href="#dt-etag">end-tag</a>
+is in the content of the same element. More simply stated, the elements,
+delimited by start- and end-tags, nest properly within each other.</p></li>
+</ol>
+<p>[<a name="dt-parentchild" title="Parent/Child">Definition</a>: As a consequence of this,
+for each non-root element <code>C</code> in the document, there is one other element <code>P</code>
+in the document such that <code>C</code> is in the content of <code>P</code>, but
+is not in the content of any other element that is in the content of <code>P</code>. <code>P</code>
+is referred to as the <b>parent</b> of <code>C</code>, and <code>C</code> as
+a <b>child</b> of <code>P</code>.]</p>
+</div>
+<div class="div2">
+
+<h3><a name="charsets"></a>2.2 Characters</h3>
+<p>[<a name="dt-text" title="Text">Definition</a>: A parsed entity contains <b>text</b>,
+a sequence of <a title="Character" href="#dt-character">characters</a>, which may
+represent markup or character data.] [<a name="dt-character" title="Character">Definition</a>: A <b>character</b>
+is an atomic unit of text as specified by ISO/IEC 10646 <a href="#ISO10646">[ISO/IEC 10646]</a> (see
+also <a href="#ISO10646-2000">[ISO/IEC 10646-2000]</a>). Legal characters are tab, carriage
+return, line feed, and the legal characters
+of Unicode and ISO/IEC 10646. The
+versions of these standards cited in <a href="#sec-existing-stds"><b>A.1 Normative References</b></a> were
+current at the time this document was prepared. New characters may be added
+to these standards by amendments or new editions. Consequently, XML processors
+must accept any character in the range specified for <a href="#NT-Char">Char</a>.
+The use of "compatibility characters", as defined in section
+6.8 of <a href="#Unicode">[Unicode]</a> (see
+also D21 in section 3.6 of <a href="#Unicode3">[Unicode3]</a>), is discouraged.]</p>
+
+<h5>Character Range</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-Char"></a>[2]   </td><td><code>Char</code></td><td>   ::=   </td><td><code>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]</code></td><xsltdebug></xsltdebug><td><i>/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */</i></td></tr>
+</tbody></table>
+<p>The mechanism for encoding character code points into bit patterns may
+vary from entity to entity. All XML processors must accept the UTF-8 and UTF-16
+encodings of 10646; the mechanisms for signaling which of the two is in use,
+or for bringing other encodings into play, are discussed later, in <a href="#charencoding"><b>4.3.3 Character Encoding in Entities</b></a>.</p>
+
+</div>
+<div class="div2">
+
+<h3><a name="sec-common-syn"></a>2.3 Common Syntactic Constructs</h3>
+<p>This section defines some symbols used widely in the grammar.</p>
+<p><a href="#NT-S">S</a> (white space) consists of one or more space (#x20)
+characters, carriage returns, line feeds, or tabs.</p>
+
+<h5>White Space</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-S"></a>[3]   </td><td><code>S</code></td><td>   ::=   </td><td><code>(#x20 | #x9 | #xD | #xA)+</code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>Characters are classified for convenience as letters, digits, or other
+characters. A
+letter consists of an alphabetic or syllabic base character or an ideographic
+character. Full definitions of the specific characters in each class
+are given in <a href="#CharClasses"><b>B Character Classes</b></a>.</p>
+<p>[<a name="dt-name" title="Name">Definition</a>: A <b>Name</b> is a token beginning
+with a letter or one of a few punctuation characters, and continuing with
+letters, digits, hyphens, underscores, colons, or full stops, together known
+as name characters.] Names beginning with the string "<code>xml</code>",
+or any string which would match <code>(('X'|'x') ('M'|'m') ('L'|'l'))</code>,
+are reserved for standardization in this or future versions of this specification.</p>
+<div class="note"><p class="prefix"><b>Note:</b></p>
+<p>The
+Namespaces in XML Recommendation <a href="#xml-names">[XML Names]</a> assigns a meaning
+to names containing colon characters. Therefore, authors should not use the
+colon in XML names except for namespace purposes, but XML processors must
+accept the colon as a name character.</p>
+</div>
+<p>An <a href="#NT-Nmtoken">Nmtoken</a> (name token) is any mixture of name
+characters.</p>
+
+<h5>Names and Tokens</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-NameChar"></a>[4]   </td><td><code>NameChar</code></td><td>   ::=   </td><td><code><a href="#NT-Letter">Letter</a> | <a href="#NT-Digit">Digit</a>
+| '.' | '-' | '_' | ':' | <a href="#NT-CombiningChar">CombiningChar</a> | <a href="#NT-Extender">Extender</a></code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Name"></a>[5]   </td><td><code>Name</code></td><td>   ::=   </td><td><code>(<a href="#NT-Letter">Letter</a> | '_' | ':') (<a href="#NT-NameChar">NameChar</a>)*</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Names"></a>[6]   </td><td><code>Names</code></td><td>   ::=   </td><td><code><a href="#NT-Name">Name</a> (<a href="#NT-S">S</a> <a href="#NT-Name">Name</a>)*</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Nmtoken"></a>[7]   </td><td><code>Nmtoken</code></td><td>   ::=   </td><td><code>(<a href="#NT-NameChar">NameChar</a>)+</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Nmtokens"></a>[8]   </td><td><code>Nmtokens</code></td><td>   ::=   </td><td><code><a href="#NT-Nmtoken">Nmtoken</a> (<a href="#NT-S">S</a> <a href="#NT-Nmtoken">Nmtoken</a>)*</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>Literal data is any quoted string not containing the quotation mark used
+as a delimiter for that string. Literals are used for specifying the content
+of internal entities (<a href="#NT-EntityValue">EntityValue</a>), the values
+of attributes (<a href="#NT-AttValue">AttValue</a>), and external identifiers
+(<a href="#NT-SystemLiteral">SystemLiteral</a>). Note that a <a href="#NT-SystemLiteral">SystemLiteral</a>
+can be parsed without scanning for markup.</p>
+
+<h5>Literals</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-EntityValue"></a>[9]   </td><td><code>EntityValue</code></td><td>   ::=   </td><td><code>'"' ([^%&amp;"] | <a href="#NT-PEReference">PEReference</a>
+| <a href="#NT-Reference">Reference</a>)* '"' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>|  "'" ([^%&amp;'] | <a href="#NT-PEReference">PEReference</a> | <a href="#NT-Reference">Reference</a>)* "'"</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-AttValue"></a>[10]   </td><td><code>AttValue</code></td><td>   ::=   </td><td><code>'"' ([^&lt;&amp;"] | <a href="#NT-Reference">Reference</a>)*
+'"' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>|  "'" ([^&lt;&amp;'] | <a href="#NT-Reference">Reference</a>)*
+"'"</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-SystemLiteral"></a>[11]   </td><td><code>SystemLiteral</code></td><td>   ::=   </td><td><code>('"' [^"]* '"') | ("'" [^']* "'") </code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PubidLiteral"></a>[12]   </td><td><code>PubidLiteral</code></td><td>   ::=   </td><td><code>'"' <a href="#NT-PubidChar">PubidChar</a>* '"'
+| "'" (<a href="#NT-PubidChar">PubidChar</a> - "'")* "'"</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PubidChar"></a>[13]   </td><td><code>PubidChar</code></td><td>   ::=   </td><td><code>#x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<div class="note"><p class="prefix"><b>Note:</b></p>
+<p>Although
+the <a href="#NT-EntityValue">EntityValue</a> production allows the definition
+of an entity consisting of a single explicit <code>&lt;</code> in the literal
+(e.g., <code>&lt;!ENTITY mylt "&lt;"&gt;</code>), it is strongly advised to avoid
+this practice since any reference to that entity will cause a well-formedness
+error.</p>
+</div>
+</div>
+<div class="div2">
+
+<h3><a name="syntax"></a>2.4 Character Data and Markup</h3>
+<p><a title="Text" href="#dt-text">Text</a> consists of intermingled <a title="Character Data" href="#dt-chardata">character data</a> and markup. [<a name="dt-markup" title="Markup">Definition</a>: <b>Markup</b> takes the form of <a title="Start-Tag" href="#dt-stag">start-tags</a>, <a title="End Tag" href="#dt-etag">end-tags</a>, <a title="Empty" href="#dt-empty">empty-element tags</a>, <a title="Entity Reference" href="#dt-entref">entity references</a>, <a title="Character Reference" href="#dt-charref">character
+references</a>, <a title="Comment" href="#dt-comment">comments</a>, <a title="CDATA Section" href="#dt-cdsection">CDATA section</a> delimiters, <a title="Document Type Declaration" href="#dt-doctype">document
+type declarations</a>, <a title="Processing instruction" href="#dt-pi">processing instructions</a>, <a href="#NT-XMLDecl">XML declarations</a>, <a href="#NT-TextDecl">text declarations</a>,
+and any white space that is at the top level of the document entity (that
+is, outside the document element and not inside any other markup).]</p>
+<p>[<a name="dt-chardata" title="Character Data">Definition</a>: All text that is not markup
+constitutes the <b>character data</b> of the document.]</p>
+<p>The ampersand character (&amp;) and the left angle bracket (&lt;) may appear
+in their literal form <em>only</em> when used as markup delimiters, or
+within a <a title="Comment" href="#dt-comment">comment</a>, a <a title="Processing instruction" href="#dt-pi">processing
+instruction</a>, or a <a title="CDATA Section" href="#dt-cdsection">CDATA section</a>.
+If they are needed elsewhere, they must be <a title="escape" href="#dt-escape">escaped</a>
+using either <a title="Character Reference" href="#dt-charref">numeric character references</a>
+or the strings "<code>&amp;amp;</code>" and "<code>&amp;lt;</code>"
+respectively. The right angle bracket (&gt;) may be represented using the string "<code>&amp;gt;</code>",
+and must, <a title="For Compatibility" href="#dt-compat">for compatibility</a>, be escaped
+using "<code>&amp;gt;</code>" or a character reference when it
+appears in the string "<code>]]&gt;</code>" in content, when
+that string is not marking the end of a <a title="CDATA Section" href="#dt-cdsection">CDATA
+section</a>.</p>
+<p>In the content of elements, character data is any string of characters
+which does not contain the start-delimiter of any markup. In a CDATA section,
+character data is any string of characters not including the CDATA-section-close
+delimiter, "<code>]]&gt;</code>".</p>
+<p>To allow attribute values to contain both single and double quotes, the
+apostrophe or single-quote character (') may be represented as "<code>&amp;apos;</code>",
+and the double-quote character (") as "<code>&amp;quot;</code>".</p>
+
+<h5>Character Data</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-CharData"></a>[14]   </td><td><code>CharData</code></td><td>   ::=   </td><td><code>[^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;' [^&lt;&amp;]*)</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+</div>
+<div class="div2">
+
+<h3><a name="sec-comments"></a>2.5 Comments</h3>
+<p>[<a name="dt-comment" title="Comment">Definition</a>: <b>Comments</b> may appear
+anywhere in a document outside other <a title="Markup" href="#dt-markup">markup</a>;
+in addition, they may appear within the document type declaration at places
+allowed by the grammar. They are not part of the document's <a title="Character Data" href="#dt-chardata">character
+data</a>; an XML processor may, but need not, make it possible for an
+application to retrieve the text of comments. <a title="For Compatibility" href="#dt-compat">For
+compatibility</a>, the string "<code>--</code>" (double-hyphen)
+must not occur within comments.] Parameter
+entity references are not recognized within comments.</p>
+
+<h5>Comments</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-Comment"></a>[15]   </td><td><code>Comment</code></td><td>   ::=   </td><td><code>'&lt;!--' ((<a href="#NT-Char">Char</a> - '-') | ('-'
+(<a href="#NT-Char">Char</a> - '-')))* '--&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>An example of a comment:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!-- declarations for &lt;head&gt; &amp; &lt;body&gt; --&gt;</pre></td></tr></table>
+<p>Note
+that the grammar does not allow a comment ending in <code>---&gt;</code>. The
+following example is <em>not</em> well-formed.</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!-- B+, B, or B---&gt;</pre></td></tr></table>
+</div>
+<div class="div2">
+
+<h3><a name="sec-pi"></a>2.6 Processing Instructions</h3>
+<p>[<a name="dt-pi" title="Processing instruction">Definition</a>: <b>Processing instructions</b>
+(PIs) allow documents to contain instructions for applications.]</p>
+
+<h5>Processing Instructions</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-PI"></a>[16]   </td><td><code>PI</code></td><td>   ::=   </td><td><code>'&lt;?' <a href="#NT-PITarget">PITarget</a> (<a href="#NT-S">S</a>
+(<a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a>* '?&gt;' <a href="#NT-Char">Char</a>*)))? '?&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PITarget"></a>[17]   </td><td><code>PITarget</code></td><td>   ::=   </td><td><code><a href="#NT-Name">Name</a> - (('X' | 'x') ('M' |
+'m') ('L' | 'l'))</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>PIs are not part of the document's <a title="Character Data" href="#dt-chardata">character
+data</a>, but must be passed through to the application. The PI begins
+with a target (<a href="#NT-PITarget">PITarget</a>) used to identify the application
+to which the instruction is directed. The target names "<code>XML</code>", "<code>xml</code>",
+and so on are reserved for standardization in this or future versions of this
+specification. The XML <a title="Notation" href="#dt-notation">Notation</a> mechanism
+may be used for formal declaration of PI targets. Parameter
+entity references are not recognized within processing instructions.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-cdata-sect"></a>2.7 CDATA Sections</h3>
+<p>[<a name="dt-cdsection" title="CDATA Section">Definition</a>: <b>CDATA sections</b>
+may occur anywhere character data may occur; they are used to escape blocks
+of text containing characters which would otherwise be recognized as markup.
+CDATA sections begin with the string "<code>&lt;![CDATA[</code>"
+and end with the string "<code>]]&gt;</code>":]</p>
+
+<h5>CDATA Sections</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-CDSect"></a>[18]   </td><td><code>CDSect</code></td><td>   ::=   </td><td><code><a href="#NT-CDStart">CDStart</a> <a href="#NT-CData">CData</a> <a href="#NT-CDEnd">CDEnd</a></code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-CDStart"></a>[19]   </td><td><code>CDStart</code></td><td>   ::=   </td><td><code>'&lt;![CDATA['</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-CData"></a>[20]   </td><td><code>CData</code></td><td>   ::=   </td><td><code>(<a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a>*
+']]&gt;' <a href="#NT-Char">Char</a>*)) </code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-CDEnd"></a>[21]   </td><td><code>CDEnd</code></td><td>   ::=   </td><td><code>']]&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>Within a CDATA section, only the <a href="#NT-CDEnd">CDEnd</a> string is
+recognized as markup, so that left angle brackets and ampersands may occur
+in their literal form; they need not (and cannot) be escaped using "<code>&amp;lt;</code>"
+and "<code>&amp;amp;</code>". CDATA sections cannot nest.</p>
+<p>An example of a CDATA section, in which "<code>&lt;greeting&gt;</code>"
+and "<code>&lt;/greeting&gt;</code>" are recognized as <a title="Character Data" href="#dt-chardata">character data</a>, not <a title="Markup" href="#dt-markup">markup</a>:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;![CDATA[&lt;greeting&gt;Hello, world!&lt;/greeting&gt;]]&gt; </pre></td></tr></table>
+</div>
+<div class="div2">
+
+<h3><a name="sec-prolog-dtd"></a>2.8 Prolog and Document Type Declaration</h3>
+<p>[<a name="dt-xmldecl" title="XML Declaration">Definition</a>: XML documents should
+begin with an <b>XML declaration</b> which specifies the version of
+XML being used.] For example, the following is a complete XML document, <a title="Well-Formed" href="#dt-wellformed">well-formed</a> but not <a title="Validity" href="#dt-valid">valid</a>:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml version="1.0"?&gt; &lt;greeting&gt;Hello, world!&lt;/greeting&gt; </pre></td></tr></table>
+<p>and so is this:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;greeting&gt;Hello, world!&lt;/greeting&gt;</pre></td></tr></table>
+<p>The version number "<code>1.0</code>" should be used to indicate
+conformance to this version of this specification; it is an error for a document
+to use the value "<code>1.0</code>" if it does not conform to
+this version of this specification. It is the intent of the XML working group
+to give later versions of this specification numbers other than "<code>1.0</code>",
+but this intent does not indicate a commitment to produce any future versions
+of XML, nor if any are produced, to use any particular numbering scheme. Since
+future versions are not ruled out, this construct is provided as a means to
+allow the possibility of automatic version recognition, should it become necessary.
+Processors may signal an error if they receive documents labeled with versions
+they do not support.</p>
+<p>The function of the markup in an XML document is to describe its storage
+and logical structure and to associate attribute-value pairs with its logical
+structures. XML provides a mechanism, the <a title="Document Type Declaration" href="#dt-doctype">document
+type declaration</a>, to define constraints on the logical structure
+and to support the use of predefined storage units. [<a name="dt-valid" title="Validity">Definition</a>: An XML document is <b>valid</b> if it has an associated
+document type declaration and if the document complies with the constraints
+expressed in it.]</p>
+<p>The document type declaration must appear before the first <a title="Element" href="#dt-element">element</a>
+in the document.</p>
+
+<h5>Prolog</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-prolog"></a>[22]   </td><td><code>prolog</code></td><td>   ::=   </td><td><code><a href="#NT-XMLDecl">XMLDecl</a>? <a href="#NT-Misc">Misc</a>*
+(<a href="#NT-doctypedecl">doctypedecl</a> <a href="#NT-Misc">Misc</a>*)?</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-XMLDecl"></a>[23]   </td><td><code>XMLDecl</code></td><td>   ::=   </td><td><code>'&lt;?xml' <a href="#NT-VersionInfo">VersionInfo</a> <a href="#NT-EncodingDecl">EncodingDecl</a>? <a href="#NT-SDDecl">SDDecl</a>? <a href="#NT-S">S</a>? '?&gt;'</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-VersionInfo"></a>[24]   </td><td><code>VersionInfo</code></td><td>   ::=   </td><td><code><a href="#NT-S">S</a> 'version' <a href="#NT-Eq">Eq</a>
+("'" <a href="#NT-VersionNum">VersionNum</a> "'" | '"' <a href="#NT-VersionNum">VersionNum</a>
+'"')<i>/* */</i></code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Eq"></a>[25]   </td><td><code>Eq</code></td><td>   ::=   </td><td><code><a href="#NT-S">S</a>? '=' <a href="#NT-S">S</a>?</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-VersionNum"></a>[26]   </td><td><code>VersionNum</code></td><td>   ::=   </td><td><code>([a-zA-Z0-9_.:] | '-')+</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Misc"></a>[27]   </td><td><code>Misc</code></td><td>   ::=   </td><td><code><a href="#NT-Comment">Comment</a> | <a href="#NT-PI">PI</a>
+| <a href="#NT-S">S</a></code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>[<a name="dt-doctype" title="Document Type Declaration">Definition</a>: The XML <b>document
+type declaration</b> contains or points to <a title="markup declaration" href="#dt-markupdecl">markup
+declarations</a> that provide a grammar for a class of documents. This
+grammar is known as a document type definition, or <b>DTD</b>. The document
+type declaration can point to an external subset (a special kind of <a title="External Entity" href="#dt-extent">external entity</a>) containing markup declarations,
+or can contain the markup declarations directly in an internal subset, or
+can do both. The DTD for a document consists of both subsets taken together.]</p>
+<p>[<a name="dt-markupdecl" title="markup declaration">Definition</a>: A <b>markup declaration</b>
+is an <a title="Element Type declaration" href="#dt-eldecl">element type declaration</a>, an <a title="Attribute-List Declaration" href="#dt-attdecl">attribute-list declaration</a>, an <a title="entity declaration" href="#dt-entdecl">entity
+declaration</a>, or a <a title="Notation Declaration" href="#dt-notdecl">notation declaration</a>.]
+These declarations may be contained in whole or in part within <a title="Parameter entity" href="#dt-PE">parameter
+entities</a>, as described in the well-formedness and validity constraints
+below. For further
+information, see <a href="#sec-physical-struct"><b>4 Physical Structures</b></a>.</p>
+
+<h5>Document Type Definition</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-doctypedecl"></a>[28]   </td><td><code>doctypedecl</code></td><td>   ::=   </td><td><code>'&lt;!DOCTYPE' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a>
+(<a href="#NT-S">S</a> <a href="#NT-ExternalID">ExternalID</a>)? <a href="#NT-S">S</a>?
+('[' (<a href="#NT-markupdecl">markupdecl</a> | <a href="#NT-DeclSep">DeclSep</a>)*
+']' <a href="#NT-S">S</a>?)? '&gt;'</code></td><xsltdebug></xsltdebug><td><a href="#vc-roottype">[VC: Root Element Type]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#ExtSubset">[WFC: External
+Subset]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><i>/* */</i></td></tr>
+<tr valign="baseline"><td><a name="NT-DeclSep"></a>[28a]   </td><td><code>DeclSep</code></td><td>   ::=   </td><td><code><a href="#NT-PEReference">PEReference</a> | <a href="#NT-S">S</a></code></td><xsltdebug></xsltdebug><td><a href="#PE-between-Decls">[WFC: PE
+Between Declarations]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><i>/* */</i></td></tr>
+<tr valign="baseline"><td><a name="NT-markupdecl"></a>[29]   </td><td><code>markupdecl</code></td><td>   ::=   </td><td><code><a href="#NT-elementdecl">elementdecl</a> | <a href="#NT-AttlistDecl">AttlistDecl</a> | <a href="#NT-EntityDecl">EntityDecl</a>
+| <a href="#NT-NotationDecl">NotationDecl</a> | <a href="#NT-PI">PI</a> | <a href="#NT-Comment">Comment</a> </code></td><xsltdebug></xsltdebug><td><a href="#vc-PEinMarkupDecl">[VC: Proper Declaration/PE Nesting]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#wfc-PEinInternalSubset">[WFC: PEs in Internal Subset]</a></td></tr>
+</tbody></table>
+<p>Note
+that it is possible to construct a well-formed document containing a <a href="#NT-doctypedecl">doctypedecl</a>
+that neither points to an external subset nor contains an internal subset.</p>
+<p>The markup declarations may be made up in whole or in part of the <a title="Replacement Text" href="#dt-repltext">replacement text</a> of <a title="Parameter entity" href="#dt-PE">parameter
+entities</a>. The productions later in this specification for individual
+nonterminals (<a href="#NT-elementdecl">elementdecl</a>, <a href="#NT-AttlistDecl">AttlistDecl</a>,
+and so on) describe the declarations <em>after</em> all the parameter
+entities have been <a title="Include" href="#dt-include">included</a>.</p>
+<p>Parameter
+entity references are recognized anywhere in the DTD (internal and external
+subsets and external parameter entities), except in literals, processing instructions,
+comments, and the contents of ignored conditional sections (see <a href="#sec-condition-sect"><b>3.4 Conditional Sections</b></a>).
+They are also recognized in entity value literals. The use of parameter entities
+in the internal subset is restricted as described below.</p>
+<div class="constraint"><p class="prefix"><a name="vc-roottype"></a><b>Validity constraint: Root Element Type</b></p><p>The <a href="#NT-Name">Name</a>
+in the document type declaration must match the element type of the <a title="Root Element" href="#dt-root">root element</a>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="vc-PEinMarkupDecl"></a><b>Validity constraint: Proper Declaration/PE Nesting</b></p>
+<p>Parameter-entity <a title="Replacement Text" href="#dt-repltext">replacement text</a>
+must be properly nested with markup declarations. That is to say, if either
+the first character or the last character of a markup declaration (<a href="#NT-markupdecl">markupdecl</a>
+above) is contained in the replacement text for a <a title="Parameter-entity reference" href="#dt-PERef">parameter-entity
+reference</a>, both must be contained in the same replacement text.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="wfc-PEinInternalSubset"></a><b>Well-formedness constraint: PEs in Internal Subset</b></p><p>In
+the internal DTD subset, <a title="Parameter-entity reference" href="#dt-PERef">parameter-entity references</a>
+can occur only where markup declarations can occur, not within markup declarations.
+(This does not apply to references that occur in external parameter entities
+or to the external subset.)</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="ExtSubset"></a><b>Well-formedness constraint: External
+Subset</b></p><p>The external subset, if any, must match the production for <a href="#NT-extSubset">extSubset</a>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="PE-between-Decls"></a><b>Well-formedness constraint: PE
+Between Declarations</b></p><p>The replacement text of a parameter entity reference
+in a <a href="#NT-DeclSep">DeclSep</a> must match the production <a href="#NT-extSubsetDecl">extSubsetDecl</a>.</p>
+</div>
+<p>Like the internal subset, the external subset and any external parameter
+entities referenced
+in a <a href="#NT-DeclSep">DeclSep</a> must consist of a series of
+complete markup declarations of the types allowed by the non-terminal symbol <a href="#NT-markupdecl">markupdecl</a>, interspersed with white space or <a title="Parameter-entity reference" href="#dt-PERef">parameter-entity references</a>. However, portions of
+the contents of the external subset or of these
+external parameter entities may conditionally be ignored by using the <a title="conditional section" href="#dt-cond-section">conditional section</a> construct; this is not
+allowed in the internal subset.</p>
+
+<h5>External Subset</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-extSubset"></a>[30]   </td><td><code>extSubset</code></td><td>   ::=   </td><td><code><a href="#NT-TextDecl">TextDecl</a>? <a href="#NT-extSubsetDecl">extSubsetDecl</a></code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-extSubsetDecl"></a>[31]   </td><td><code>extSubsetDecl</code></td><td>   ::=   </td><td><code>( <a href="#NT-markupdecl">markupdecl</a> | <a href="#NT-conditionalSect">conditionalSect</a> | <a href="#NT-DeclSep">DeclSep</a>)*</code></td><xsltdebug></xsltdebug><td><i>/* */</i></td></tr>
+</tbody></table>
+<p>The external subset and external parameter entities also differ from the
+internal subset in that in them, <a title="Parameter-entity reference" href="#dt-PERef">parameter-entity
+references</a> are permitted <em>within</em> markup declarations,
+not only <em>between</em> markup declarations.</p>
+<p>An example of an XML document with a document type declaration:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml version="1.0"?&gt; &lt;!DOCTYPE greeting SYSTEM "hello.dtd"&gt; &lt;greeting&gt;Hello, world!&lt;/greeting&gt; </pre></td></tr></table>
+<p>The <a title="System Identifier" href="#dt-sysid">system identifier</a> "<code>hello.dtd</code>"
+gives the address
+(a URI reference) of a DTD for the document.</p>
+<p>The declarations can also be given locally, as in this example:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
+&lt;!DOCTYPE greeting [
+ &lt;!ELEMENT greeting (#PCDATA)&gt;
+]&gt;
+&lt;greeting&gt;Hello, world!&lt;/greeting&gt;</pre></td></tr></table>
+<p>If both the external and internal subsets are used, the internal subset
+is considered to occur before the external subset.
+This has the effect that entity and attribute-list declarations in the internal
+subset take precedence over those in the external subset.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-rmd"></a>2.9 Standalone Document Declaration</h3>
+<p>Markup declarations can affect the content of the document, as passed from
+an <a title="XML Processor" href="#dt-xml-proc">XML processor</a> to an application; examples
+are attribute defaults and entity declarations. The standalone document declaration,
+which may appear as a component of the XML declaration, signals whether or
+not there are such declarations which appear external to the <a title="Document Entity" href="#dt-docent">document
+entity</a>
+or in parameter entities. [<a name="dt-extmkpdecl" title="External Markup Declaration">Definition</a>: An <b>external
+markup declaration</b> is defined as a markup declaration occurring in
+the external subset or in a parameter entity (external or internal, the latter
+being included because non-validating processors are not required to read
+them).]</p>
+
+<h5>Standalone Document Declaration</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-SDDecl"></a>[32]   </td><td><code>SDDecl</code></td><td>   ::=   </td><td><code> <a href="#NT-S">S</a> 'standalone' <a href="#NT-Eq">Eq</a>
+(("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"')) </code></td><xsltdebug></xsltdebug><td><a href="#vc-check-rmd">[VC: Standalone Document Declaration]</a></td></tr>
+</tbody></table>
+<p>In a standalone document declaration, the value "yes" indicates
+that there are no <a title="External Markup Declaration" href="#dt-extmkpdecl">external markup declarations</a> which
+affect the information passed from the XML processor to the application. The
+value "no" indicates that there are or may be such external
+markup declarations. Note that the standalone document declaration only denotes
+the presence of external <em>declarations</em>; the presence, in a document,
+of references to external <em>entities</em>, when those entities are internally
+declared, does not change its standalone status.</p>
+<p>If there are no external markup declarations, the standalone document declaration
+has no meaning. If there are external markup declarations but there is no
+standalone document declaration, the value "no" is assumed.</p>
+<p>Any XML document for which <code>standalone="no"</code> holds can be converted
+algorithmically to a standalone document, which may be desirable for some
+network delivery applications.</p>
+<div class="constraint"><p class="prefix"><a name="vc-check-rmd"></a><b>Validity constraint: Standalone Document Declaration</b></p><p>The
+standalone document declaration must have the value "no" if
+any external markup declarations contain declarations of:</p>
+<ul>
+<li><p>attributes with <a title="Attribute Default" href="#dt-default">default</a> values,
+if elements to which these attributes apply appear in the document without
+specifications of values for these attributes, or</p></li>
+<li><p>entities (other than <code>amp</code>,
+<code>lt</code>,
+<code>gt</code>,
+<code>apos</code>,
+<code>quot</code>), if <a title="Entity Reference" href="#dt-entref">references</a>
+to those entities appear in the document, or</p></li>
+<li><p>attributes with values subject to <a href="#AVNormalize"><cite>normalization</cite></a>,
+where the attribute appears in the document with a value which will change
+as a result of normalization, or</p></li>
+<li><p>element types with <a title="Element content" href="#dt-elemcontent">element content</a>,
+if white space occurs directly within any instance of those types.</p></li>
+</ul>
+</div>
+<p>An example XML declaration with a standalone document declaration:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml version="1.0" standalone='yes'?&gt;</pre></td></tr></table>
+</div>
+<div class="div2">
+
+<h3><a name="sec-white-space"></a>2.10 White Space Handling</h3>
+<p>In editing XML documents, it is often convenient to use "white space"
+(spaces, tabs, and blank lines)
+to set apart the markup for greater readability. Such white space is typically
+not intended for inclusion in the delivered version of the document. On the
+other hand, "significant" white space that should be preserved
+in the delivered version is common, for example in poetry and source code.</p>
+<p>An <a title="XML Processor" href="#dt-xml-proc">XML processor</a> must always pass
+all characters in a document that are not markup through to the application.
+A <a title="Validating Processor" href="#dt-validating"> validating XML processor</a> must also
+inform the application which of these characters constitute white space appearing
+in <a title="Element content" href="#dt-elemcontent">element content</a>.</p>
+<p>A special <a title="Attribute" href="#dt-attr">attribute</a> named <code>xml:space</code>
+may be attached to an element to signal an intention that in that element,
+white space should be preserved by applications. In valid documents, this
+attribute, like any other, must be <a title="Attribute-List Declaration" href="#dt-attdecl">declared</a>
+if it is used. When declared, it must be given as an <a title="Enumerated Attribute Values" href="#dt-enumerated">enumerated
+type</a> whose values
+are one or both of "default" and "preserve".
+For example:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ATTLIST poem xml:space (default|preserve) 'preserve'&gt;
+
+&lt;!-- --&gt;
+&lt;!ATTLIST pre xml:space (preserve) #FIXED 'preserve'&gt;</pre></td></tr></table>
+<p>The value "default" signals that applications' default white-space
+processing modes are acceptable for this element; the value "preserve"
+indicates the intent that applications preserve all the white space. This
+declared intent is considered to apply to all elements within the content
+of the element where it is specified, unless overriden with another instance
+of the <code>xml:space</code> attribute.</p>
+<p>The <a title="Root Element" href="#dt-root">root element</a> of any document is considered
+to have signaled no intentions as regards application space handling, unless
+it provides a value for this attribute or the attribute is declared with a
+default value.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-line-ends"></a>2.11 End-of-Line Handling</h3>
+<p>XML <a title="Text Entity" href="#dt-parsedent">parsed entities</a> are often stored
+in computer files which, for editing convenience, are organized into lines.
+These lines are typically separated by some combination of the characters
+carriage-return (#xD) and line-feed (#xA).</p>
+
+<p>To
+simplify the tasks of <a title="Application" href="#dt-app">applications</a>, the characters
+passed to an application by the <a title="XML Processor" href="#dt-xml-proc">XML processor</a>
+must be as if the XML processor normalized all line breaks in external parsed
+entities (including the document entity) on input, before parsing, by translating
+both the two-character sequence #xD #xA and any #xD that is not followed by
+#xA to a single #xA character.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-lang-tag"></a>2.12 Language Identification</h3>
+<p>In document processing, it is often useful to identify the natural or formal
+language in which the content is written. A special <a title="Attribute" href="#dt-attr">attribute</a>
+named <code>xml:lang</code> may be inserted in documents to specify the language
+used in the contents and attribute values of any element in an XML document.
+In valid documents, this attribute, like any other, must be <a title="Attribute-List Declaration" href="#dt-attdecl">declared</a>
+if it is used. The
+values of the attribute are language identifiers as defined by <a href="#RFC1766">[IETF RFC 1766]</a>, <cite>Tags
+for the Identification of Languages</cite>, or its successor on the IETF
+Standards Track.</p>
+<div class="note"><p class="prefix"><b>Note:</b></p>
+<p><a href="#RFC1766">[IETF RFC 1766]</a> tags are constructed from two-letter language codes as defined
+by <a href="#ISO639">[ISO 639]</a>, from two-letter country codes as defined by <a href="#ISO3166">[ISO 3166]</a>, or from language identifiers registered with the Internet
+Assigned Numbers Authority <a href="#IANA-LANGCODES">[IANA-LANGCODES]</a>. It is expected that the successor
+to <a href="#RFC1766">[IETF RFC 1766]</a> will introduce three-letter language codes for
+languages not presently covered by <a href="#ISO639">[ISO 639]</a>.</p>
+</div>
+<p>(Productions
+33 through 38 have been removed.)</p>
+
+
+
+
+
+<p>For example:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;p xml:lang="en"&gt;The quick brown fox jumps over the lazy dog.&lt;/p&gt;
+&lt;p xml:lang="en-GB"&gt;What colour is it?&lt;/p&gt;
+&lt;p xml:lang="en-US"&gt;What color is it?&lt;/p&gt;
+&lt;sp who="Faust" desc='leise' xml:lang="de"&gt;
+ &lt;l&gt;Habe nun, ach! Philosophie,&lt;/l&gt;
+ &lt;l&gt;Juristerei, und Medizin&lt;/l&gt;
+ &lt;l&gt;und leider auch Theologie&lt;/l&gt;
+ &lt;l&gt;durchaus studiert mit heißem Bemüh'n.&lt;/l&gt;
+&lt;/sp&gt;</pre></td></tr></table>
+
+<p>The intent declared with <code>xml:lang</code> is considered to apply to
+all attributes and content of the element where it is specified, unless overridden
+with an instance of <code>xml:lang</code> on another element within that content.</p>
+
+<p>A simple declaration for <code>xml:lang</code> might take the form</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>xml:lang NMTOKEN #IMPLIED</pre></td></tr></table>
+<p>but specific default values may also be given, if appropriate. In a collection
+of French poems for English students, with glosses and notes in English, the <code>xml:lang</code>
+attribute might be declared this way:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ATTLIST poem xml:lang NMTOKEN 'fr'&gt;
+&lt;!ATTLIST gloss xml:lang NMTOKEN 'en'&gt;
+&lt;!ATTLIST note xml:lang NMTOKEN 'en'&gt;</pre></td></tr></table>
+</div>
+</div>
+
+<div class="div1">
+
+<h2><a name="sec-logical-struct"></a>3 Logical Structures</h2>
+<p>[<a name="dt-element" title="Element">Definition</a>: Each <a title="XML Document" href="#dt-xml-doc">XML
+document</a> contains one or more <b>elements</b>, the boundaries
+of which are either delimited by <a title="Start-Tag" href="#dt-stag">start-tags</a>
+and <a title="End Tag" href="#dt-etag">end-tags</a>, or, for <a title="Empty" href="#dt-empty">empty</a>
+elements, by an <a title="empty-element tag" href="#dt-eetag">empty-element tag</a>. Each
+element has a type, identified by name, sometimes called its "generic
+identifier" (GI), and may have a set of attribute specifications.]
+Each attribute specification has a <a title="Attribute Name" href="#dt-attrname">name</a>
+and a <a title="Attribute Value" href="#dt-attrval">value</a>.</p>
+
+<h5>Element</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-element"></a>[39]   </td><td><code>element</code></td><td>   ::=   </td><td><code><a href="#NT-EmptyElemTag">EmptyElemTag</a></code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-STag">STag</a> <a href="#NT-content">content</a> <a href="#NT-ETag">ETag</a></code></td><td><a href="#GIMatch">[WFC: Element Type Match]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#elementvalid">[VC: Element Valid]</a></td></tr></tbody></table>
+<p>This specification does not constrain the semantics, use, or (beyond syntax)
+names of the element types and attributes, except that names beginning with
+a match to <code>(('X'|'x')('M'|'m')('L'|'l'))</code> are reserved for standardization
+in this or future versions of this specification.</p>
+<div class="constraint"><p class="prefix"><a name="GIMatch"></a><b>Well-formedness constraint: Element Type Match</b></p><p>The <a href="#NT-Name">Name</a>
+in an element's end-tag must match the element type in the start-tag.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="elementvalid"></a><b>Validity constraint: Element Valid</b></p><p>An element is valid
+if there is a declaration matching <a href="#NT-elementdecl">elementdecl</a>
+where the <a href="#NT-Name">Name</a> matches the element type, and one of
+the following holds:</p>
+<ol>
+<li><p>The declaration matches <b>EMPTY</b> and the element has no <a title="Content" href="#dt-content">content</a>.</p></li>
+<li><p>The declaration matches <a href="#NT-children">children</a> and the
+sequence of <a title="Parent/Child" href="#dt-parentchild">child elements</a> belongs
+to the language generated by the regular expression in the content model,
+with optional white space (characters matching the nonterminal <a href="#NT-S">S</a>)
+between the
+start-tag and the first child element, between child elements, or between
+the last child element and the end-tag. Note that a CDATA section containing
+only white space does not match the nonterminal <a href="#NT-S">S</a>, and
+hence cannot appear in these positions.</p></li>
+<li><p>The declaration matches <a href="#NT-Mixed">Mixed</a> and the content
+consists of <a title="Character Data" href="#dt-chardata">character data</a> and <a title="Parent/Child" href="#dt-parentchild">child elements</a> whose types match names in the
+content model.</p></li>
+<li><p>The declaration matches <b>ANY</b>, and the types of any <a title="Parent/Child" href="#dt-parentchild">child elements</a> have been declared.</p></li>
+</ol>
+</div>
+<div class="div2">
+
+<h3><a name="sec-starttags"></a>3.1 Start-Tags, End-Tags, and Empty-Element Tags</h3>
+<p>[<a name="dt-stag" title="Start-Tag">Definition</a>: The beginning of every non-empty
+XML element is marked by a <b>start-tag</b>.]</p>
+
+<h5>Start-tag</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-STag"></a>[40]   </td><td><code>STag</code></td><td>   ::=   </td><td><code>'&lt;' <a href="#NT-Name">Name</a> (<a href="#NT-S">S</a> <a href="#NT-Attribute">Attribute</a>)* <a href="#NT-S">S</a>? '&gt;'</code></td><xsltdebug></xsltdebug><td><a href="#uniqattspec">[WFC: Unique Att Spec]</a></td></tr>
+<tr valign="baseline"><td><a name="NT-Attribute"></a>[41]   </td><td><code>Attribute</code></td><td>   ::=   </td><td><code><a href="#NT-Name">Name</a> <a href="#NT-Eq">Eq</a> <a href="#NT-AttValue">AttValue</a></code></td><xsltdebug></xsltdebug><td><a href="#ValueType">[VC: Attribute Value Type]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#NoExternalRefs">[WFC: No External Entity References]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#CleanAttrVals">[WFC: No &lt; in Attribute Values]</a></td></tr>
+</tbody></table>
+<p>The <a href="#NT-Name">Name</a> in the start- and end-tags gives the element's <b>type</b>. [<a name="dt-attr" title="Attribute">Definition</a>: The <a href="#NT-Name">Name</a>-<a href="#NT-AttValue">AttValue</a>
+pairs are referred to as the <b>attribute specifications</b> of the
+element], [<a name="dt-attrname" title="Attribute Name">Definition</a>: with the <a href="#NT-Name">Name</a> in each pair referred to as the <b>attribute name</b>]
+and [<a name="dt-attrval" title="Attribute Value">Definition</a>: the content of the <a href="#NT-AttValue">AttValue</a> (the text between the <code>'</code> or <code>"</code>
+delimiters) as the <b>attribute value</b>.]Note
+that the order of attribute specifications in a start-tag or empty-element
+tag is not significant.</p>
+<div class="constraint"><p class="prefix"><a name="uniqattspec"></a><b>Well-formedness constraint: Unique Att Spec</b></p><p>No attribute name
+may appear more than once in the same start-tag or empty-element tag.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="ValueType"></a><b>Validity constraint: Attribute Value Type</b></p><p>The attribute must
+have been declared; the value must be of the type declared for it. (For attribute
+types, see <a href="#attdecls"><b>3.3 Attribute-List Declarations</b></a>.)</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="NoExternalRefs"></a><b>Well-formedness constraint: No External Entity References</b></p><p>Attribute
+values cannot contain direct or indirect entity references to external entities.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="CleanAttrVals"></a><b>Well-formedness constraint: No <code>&lt;</code> in Attribute Values</b></p>
+<p>The <a title="Replacement Text" href="#dt-repltext">replacement text</a> of any entity
+referred to directly or indirectly in an attribute value must not contain a <code>&lt;</code>.</p>
+</div>
+<p>An example of a start-tag:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;termdef id="dt-dog" term="dog"&gt;</pre></td></tr></table>
+<p>[<a name="dt-etag" title="End Tag">Definition</a>: The end of every element that begins
+with a start-tag must be marked by an <b>end-tag</b> containing a name
+that echoes the element's type as given in the start-tag:]</p>
+
+<h5>End-tag</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-ETag"></a>[42]   </td><td><code>ETag</code></td><td>   ::=   </td><td><code>'&lt;/' <a href="#NT-Name">Name</a> <a href="#NT-S">S</a>?
+'&gt;'</code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>An example of an end-tag:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;/termdef&gt;</pre></td></tr></table>
+<p>[<a name="dt-content" title="Content">Definition</a>: The <a title="Text" href="#dt-text">text</a>
+between the start-tag and end-tag is called the element's <b>content</b>:]</p>
+
+<h5>Content of Elements</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-content"></a>[43]   </td><td><code>content</code></td><td>   ::=   </td><td><code><a href="#NT-CharData">CharData</a>? ((<a href="#NT-element">element</a>
+| <a href="#NT-Reference">Reference</a> | <a href="#NT-CDSect">CDSect</a>
+| <a href="#NT-PI">PI</a> | <a href="#NT-Comment">Comment</a>) <a href="#NT-CharData">CharData</a>?)*</code></td><xsltdebug></xsltdebug><td><i>/* */</i></td></tr>
+</tbody></table>
+<p>[<a name="dt-empty" title="Empty">Definition</a>: An element
+with no content is said to be <b>empty</b>.] The representation
+of an empty element is either a start-tag immediately followed by an end-tag,
+or an empty-element tag. [<a name="dt-eetag" title="empty-element tag">Definition</a>: An <b>empty-element
+tag</b> takes a special form:]</p>
+
+<h5>Tags for Empty Elements</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-EmptyElemTag"></a>[44]   </td><td><code>EmptyElemTag</code></td><td>   ::=   </td><td><code>'&lt;' <a href="#NT-Name">Name</a> (<a href="#NT-S">S</a> <a href="#NT-Attribute">Attribute</a>)* <a href="#NT-S">S</a>? '/&gt;'</code></td><xsltdebug></xsltdebug><td><a href="#uniqattspec">[WFC: Unique Att Spec]</a></td></tr>
+</tbody></table>
+<p>Empty-element tags may be used for any element which has no content, whether
+or not it is declared using the keyword <b>EMPTY</b>. <a title="For interoperability" href="#dt-interop">For
+interoperability</a>, the empty-element tag should
+be used, and should only be used, for elements which are declared
+EMPTY.</p>
+<p>Examples of empty elements:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;IMG align="left"
+ src="http://www.w3.org/Icons/WWW/w3c_home" /&gt;
+&lt;br&gt;&lt;/br&gt;
+&lt;br/&gt;</pre></td></tr></table>
+</div>
+<div class="div2">
+
+<h3><a name="elemdecls"></a>3.2 Element Type Declarations</h3>
+<p>The <a title="Element" href="#dt-element">element</a> structure of an <a title="XML Document" href="#dt-xml-doc">XML document</a> may, for <a title="Validity" href="#dt-valid">validation</a>
+purposes, be constrained using element type and attribute-list declarations.
+An element type declaration constrains the element's <a title="Content" href="#dt-content">content</a>.</p>
+<p>Element type declarations often constrain which element types can appear
+as <a title="Parent/Child" href="#dt-parentchild">children</a> of the element. At user
+option, an XML processor may issue a warning when a declaration mentions an
+element type for which no declaration is provided, but this is not an error.</p>
+<p>[<a name="dt-eldecl" title="Element Type declaration">Definition</a>: An <b>element
+type declaration</b> takes the form:]</p>
+
+<h5>Element Type Declaration</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-elementdecl"></a>[45]   </td><td><code>elementdecl</code></td><td>   ::=   </td><td><code>'&lt;!ELEMENT' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-S">S</a> <a href="#NT-contentspec">contentspec</a> <a href="#NT-S">S</a>?
+'&gt;'</code></td><xsltdebug></xsltdebug><td><a href="#EDUnique">[VC: Unique Element Type Declaration]</a></td></tr>
+<tr valign="baseline"><td><a name="NT-contentspec"></a>[46]   </td><td><code>contentspec</code></td><td>   ::=   </td><td><code>'EMPTY' | 'ANY' | <a href="#NT-Mixed">Mixed</a>
+| <a href="#NT-children">children</a> </code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>where the <a href="#NT-Name">Name</a> gives the element type being declared.</p>
+<div class="constraint"><p class="prefix"><a name="EDUnique"></a><b>Validity constraint: Unique Element Type Declaration</b></p><p>No element
+type may be declared more than once.</p>
+</div>
+<p>Examples of element type declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ELEMENT br EMPTY&gt;
+&lt;!ELEMENT p (#PCDATA|emph)* &gt;
+&lt;!ELEMENT %name.para; %content.para; &gt;
+&lt;!ELEMENT container ANY&gt;</pre></td></tr></table>
+<div class="div3">
+
+<h4><a name="sec-element-content"></a>3.2.1 Element Content</h4>
+<p>[<a name="dt-elemcontent" title="Element content">Definition</a>: An element <a title="Start-Tag" href="#dt-stag">type</a> has <b>element content</b> when elements
+of that type must contain only <a title="Parent/Child" href="#dt-parentchild">child</a>
+elements (no character data), optionally separated by white space (characters
+matching the nonterminal <a href="#NT-S">S</a>).][<a name="dt-content-model" title="Content model">Definition</a>: In this case, the constraint includes a <b>content
+model</b>, a simple grammar governing the allowed types of the
+child elements and the order in which they are allowed to appear.]
+The grammar is built on content particles (<a href="#NT-cp">cp</a>s), which
+consist of names, choice lists of content particles, or sequence lists of
+content particles:</p>
+
+<h5>Element-content Models</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-children"></a>[47]   </td><td><code>children</code></td><td>   ::=   </td><td><code>(<a href="#NT-choice">choice</a> | <a href="#NT-seq">seq</a>)
+('?' | '*' | '+')?</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-cp"></a>[48]   </td><td><code>cp</code></td><td>   ::=   </td><td><code>(<a href="#NT-Name">Name</a> | <a href="#NT-choice">choice</a>
+| <a href="#NT-seq">seq</a>) ('?' | '*' | '+')?</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-choice"></a>[49]   </td><td><code>choice</code></td><td>   ::=   </td><td><code>'(' <a href="#NT-S">S</a>? <a href="#NT-cp">cp</a> ( <a href="#NT-S">S</a>? '|' <a href="#NT-S">S</a>? <a href="#NT-cp">cp</a> )+ <a href="#NT-S">S</a>? ')'</code></td><xsltdebug></xsltdebug><td><i>/* */</i></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><i>/* */</i></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#vc-PEinGroup">[VC: Proper Group/PE Nesting]</a></td></tr>
+<tr valign="baseline"><td><a name="NT-seq"></a>[50]   </td><td><code>seq</code></td><td>   ::=   </td><td><code>'(' <a href="#NT-S">S</a>? <a href="#NT-cp">cp</a> ( <a href="#NT-S">S</a>? ',' <a href="#NT-S">S</a>? <a href="#NT-cp">cp</a> )* <a href="#NT-S">S</a>? ')'</code></td><xsltdebug></xsltdebug><td><i>/* */</i></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#vc-PEinGroup">[VC: Proper Group/PE Nesting]</a></td></tr>
+</tbody></table>
+<p>where each <a href="#NT-Name">Name</a> is the type of an element which
+may appear as a <a title="Parent/Child" href="#dt-parentchild">child</a>. Any content
+particle in a choice list may appear in the <a title="Element content" href="#dt-elemcontent">element
+content</a> at the location where the choice list appears in the grammar;
+content particles occurring in a sequence list must each appear in the <a title="Element content" href="#dt-elemcontent">element content</a> in the order given in the list.
+The optional character following a name or list governs whether the element
+or the content particles in the list may occur one or more (<code>+</code>),
+zero or more (<code>*</code>), or zero or one times (<code>?</code>). The
+absence of such an operator means that the element or content particle must
+appear exactly once. This syntax and meaning are identical to those used in
+the productions in this specification.</p>
+<p>The content of an element matches a content model if and only if it is
+possible to trace out a path through the content model, obeying the sequence,
+choice, and repetition operators and matching each element in the content
+against an element type in the content model. <a title="For Compatibility" href="#dt-compat">For
+compatibility</a>, it is an error if an element in the document can
+match more than one occurrence of an element type in the content model. For
+more information, see <a href="#determinism"><b>E Deterministic Content Models</b></a>.</p>
+
+
+<div class="constraint"><p class="prefix"><a name="vc-PEinGroup"></a><b>Validity constraint: Proper Group/PE Nesting</b></p><p>Parameter-entity <a title="Replacement Text" href="#dt-repltext">replacement text</a> must be properly nested with parenthesized
+groups. That is to say, if either of the opening or closing parentheses in
+a <a href="#NT-choice">choice</a>, <a href="#NT-seq">seq</a>, or <a href="#NT-Mixed">Mixed</a>
+construct is contained in the replacement text for a <a title="Parameter-entity reference" href="#dt-PERef">parameter
+entity</a>, both must be contained in the same replacement text.</p>
+<p><a title="For interoperability" href="#dt-interop">For interoperability</a>, if a parameter-entity reference
+appears in a <a href="#NT-choice">choice</a>, <a href="#NT-seq">seq</a>, or <a href="#NT-Mixed">Mixed</a> construct, its replacement text should contain at
+least one non-blank character, and neither the first nor last non-blank character
+of the replacement text should be a connector (<code>|</code> or <code>,</code>).</p>
+</div>
+<p>Examples of element-content models:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ELEMENT spec (front, body, back?)&gt;
+&lt;!ELEMENT div1 (head, (p | list | note)*, div2*)&gt;
+&lt;!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*&gt;</pre></td></tr></table>
+</div>
+<div class="div3">
+
+<h4><a name="sec-mixed-content"></a>3.2.2 Mixed Content</h4>
+<p>[<a name="dt-mixed" title="Mixed Content">Definition</a>: An element <a title="Start-Tag" href="#dt-stag">type</a>
+has <b>mixed content</b> when elements of that type may contain character
+data, optionally interspersed with <a title="Parent/Child" href="#dt-parentchild">child</a>
+elements.] In this case, the types of the child elements may be constrained,
+but not their order or their number of occurrences:</p>
+
+<h5>Mixed-content Declaration</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-Mixed"></a>[51]   </td><td><code>Mixed</code></td><td>   ::=   </td><td><code>'(' <a href="#NT-S">S</a>? '#PCDATA' (<a href="#NT-S">S</a>?
+'|' <a href="#NT-S">S</a>? <a href="#NT-Name">Name</a>)* <a href="#NT-S">S</a>?
+')*' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| '(' <a href="#NT-S">S</a>? '#PCDATA' <a href="#NT-S">S</a>? ')' </code></td><td><a href="#vc-PEinGroup">[VC: Proper Group/PE Nesting]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#vc-MixedChildrenUnique">[VC: No Duplicate Types]</a></td></tr>
+</tbody></table>
+<p>where the <a href="#NT-Name">Name</a>s give the types of elements that
+may appear as children. The
+keyword <b>#PCDATA</b> derives historically from the term "parsed
+character data."</p>
+<div class="constraint"><p class="prefix"><a name="vc-MixedChildrenUnique"></a><b>Validity constraint: No Duplicate Types</b></p><p>The
+same name must not appear more than once in a single mixed-content declaration.</p>
+</div>
+<p>Examples of mixed content declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ELEMENT p (#PCDATA|a|ul|b|i|em)*&gt;
+&lt;!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* &gt;
+&lt;!ELEMENT b (#PCDATA)&gt;</pre></td></tr></table>
+</div>
+</div>
+<div class="div2">
+
+<h3><a name="attdecls"></a>3.3 Attribute-List Declarations</h3>
+<p><a title="Attribute" href="#dt-attr">Attributes</a> are used to associate name-value
+pairs with <a title="Element" href="#dt-element">elements</a>. Attribute specifications
+may appear only within <a title="Start-Tag" href="#dt-stag">start-tags</a> and <a title="empty-element tag" href="#dt-eetag">empty-element tags</a>; thus, the productions used to
+recognize them appear in <a href="#sec-starttags"><b>3.1 Start-Tags, End-Tags, and Empty-Element Tags</b></a>. Attribute-list declarations
+may be used:</p>
+<ul>
+<li><p>To define the set of attributes pertaining to a given element type.</p>
+</li>
+<li><p>To establish type constraints for these attributes.</p></li>
+<li><p>To provide <a title="Attribute Default" href="#dt-default">default values</a> for
+attributes.</p></li>
+</ul>
+<p>[<a name="dt-attdecl" title="Attribute-List Declaration">Definition</a>: <b>Attribute-list
+declarations</b> specify the name, data type, and default value (if any)
+of each attribute associated with a given element type:]</p>
+
+<h5>Attribute-list Declaration</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-AttlistDecl"></a>[52]   </td><td><code>AttlistDecl</code></td><td>   ::=   </td><td><code>'&lt;!ATTLIST' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-AttDef">AttDef</a>* <a href="#NT-S">S</a>? '&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-AttDef"></a>[53]   </td><td><code>AttDef</code></td><td>   ::=   </td><td><code><a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-S">S</a> <a href="#NT-AttType">AttType</a> <a href="#NT-S">S</a> <a href="#NT-DefaultDecl">DefaultDecl</a></code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>The <a href="#NT-Name">Name</a> in the <a href="#NT-AttlistDecl">AttlistDecl</a>
+rule is the type of an element. At user option, an XML processor may issue
+a warning if attributes are declared for an element type not itself declared,
+but this is not an error. The <a href="#NT-Name">Name</a> in the <a href="#NT-AttDef">AttDef</a>
+rule is the name of the attribute.</p>
+<p>When more than one <a href="#NT-AttlistDecl">AttlistDecl</a> is provided
+for a given element type, the contents of all those provided are merged. When
+more than one definition is provided for the same attribute of a given element
+type, the first declaration is binding and later declarations are ignored. <a title="For interoperability" href="#dt-interop">For interoperability,</a> writers of DTDs may choose
+to provide at most one attribute-list declaration for a given element type,
+at most one attribute definition for a given attribute name in an attribute-list
+declaration, and at least one attribute definition in each attribute-list
+declaration. For interoperability, an XML processor may at user option
+issue a warning when more than one attribute-list declaration is provided
+for a given element type, or more than one attribute definition is provided
+for a given attribute, but this is not an error.</p>
+<div class="div3">
+
+<h4><a name="sec-attribute-types"></a>3.3.1 Attribute Types</h4>
+<p>XML attribute types are of three kinds: a string type, a set of tokenized
+types, and enumerated types. The string type may take any literal string as
+a value; the tokenized types have varying lexical and semantic constraints.
+The validity constraints noted in the grammar are applied after the attribute
+value has been normalized as described in <a href="#attdecls"><b>3.3 Attribute-List Declarations</b></a>.</p>
+
+<h5>Attribute Types</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-AttType"></a>[54]   </td><td><code>AttType</code></td><td>   ::=   </td><td><code><a href="#NT-StringType">StringType</a> | <a href="#NT-TokenizedType">TokenizedType</a>
+| <a href="#NT-EnumeratedType">EnumeratedType</a> </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-StringType"></a>[55]   </td><td><code>StringType</code></td><td>   ::=   </td><td><code>'CDATA'</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-TokenizedType"></a>[56]   </td><td><code>TokenizedType</code></td><td>   ::=   </td><td><code>'ID'</code></td><xsltdebug></xsltdebug><td><a href="#id">[VC: ID]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#one-id-per-el">[VC: One ID per Element Type]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#id-default">[VC: ID Attribute Default]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'IDREF'</code></td><td><a href="#idref">[VC: IDREF]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'IDREFS'</code></td><td><a href="#idref">[VC: IDREF]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'ENTITY'</code></td><td><a href="#entname">[VC: Entity Name]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'ENTITIES'</code></td><td><a href="#entname">[VC: Entity Name]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'NMTOKEN'</code></td><td><a href="#nmtok">[VC: Name Token]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'NMTOKENS'</code></td><td><a href="#nmtok">[VC: Name Token]</a></td></tr>
+</tbody></table>
+<div class="constraint"><p class="prefix"><a name="id"></a><b>Validity constraint: ID</b></p><p>Values of type <b>ID</b> must match the <a href="#NT-Name">Name</a> production. A name must not appear more than once
+in an XML document as a value of this type; i.e., ID values must uniquely
+identify the elements which bear them.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="one-id-per-el"></a><b>Validity constraint: One ID per Element Type</b></p><p>No element
+type may have more than one ID attribute specified.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="id-default"></a><b>Validity constraint: ID Attribute Default</b></p><p>An ID attribute
+must have a declared default of <b>#IMPLIED</b> or <b>#REQUIRED</b>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="idref"></a><b>Validity constraint: IDREF</b></p><p>Values of type <b>IDREF</b> must
+match the <a href="#NT-Name">Name</a> production, and values of type <b>IDREFS</b>
+must match <a href="#NT-Names">Names</a>; each <a href="#NT-Name">Name</a>
+must match the value of an ID attribute on some element in the XML document;
+i.e. <b>IDREF</b> values must match the value of some ID attribute.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="entname"></a><b>Validity constraint: Entity Name</b></p><p>Values of type <b>ENTITY</b>
+must match the <a href="#NT-Name">Name</a> production, values of type <b>ENTITIES</b>
+must match <a href="#NT-Names">Names</a>; each <a href="#NT-Name">Name</a>
+must match the name of an <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a>
+declared in the <a title="Document Type Declaration" href="#dt-doctype">DTD</a>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="nmtok"></a><b>Validity constraint: Name Token</b></p><p>Values of type <b>NMTOKEN</b>
+must match the <a href="#NT-Nmtoken">Nmtoken</a> production; values of type <b>NMTOKENS</b>
+must match <a title="" href="#NT-Nmtokens">Nmtokens</a>.</p>
+</div>
+
+<p>[<a name="dt-enumerated" title="Enumerated Attribute Values">Definition</a>: <b>Enumerated attributes</b> can take one of a list of values
+provided in the declaration]. There are two kinds of enumerated types:</p>
+
+<h5>Enumerated Attribute Types</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-EnumeratedType"></a>[57]   </td><td><code>EnumeratedType</code></td><td>   ::=   </td><td><code><a href="#NT-NotationType">NotationType</a>
+| <a href="#NT-Enumeration">Enumeration</a> </code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-NotationType"></a>[58]   </td><td><code>NotationType</code></td><td>   ::=   </td><td><code>'NOTATION' <a href="#NT-S">S</a> '(' <a href="#NT-S">S</a>? <a href="#NT-Name">Name</a> (<a href="#NT-S">S</a>? '|' <a href="#NT-S">S</a>? <a href="#NT-Name">Name</a>)* <a href="#NT-S">S</a>? ')' </code></td><xsltdebug></xsltdebug><td><a href="#notatn">[VC: Notation Attributes]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#OneNotationPer">[VC: One
+Notation Per Element Type]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#NoNotationEmpty">[VC: No
+Notation on Empty Element]</a></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Enumeration"></a>[59]   </td><td><code>Enumeration</code></td><td>   ::=   </td><td><code>'(' <a href="#NT-S">S</a>? <a href="#NT-Nmtoken">Nmtoken</a>
+(<a href="#NT-S">S</a>? '|' <a href="#NT-S">S</a>? <a href="#NT-Nmtoken">Nmtoken</a>)* <a href="#NT-S">S</a>? ')'</code></td><xsltdebug></xsltdebug><td><a href="#enum">[VC: Enumeration]</a></td></tr></tbody></table>
+<p>A <b>NOTATION</b> attribute identifies a <a title="Notation" href="#dt-notation">notation</a>,
+declared in the DTD with associated system and/or public identifiers, to be
+used in interpreting the element to which the attribute is attached.</p>
+<div class="constraint"><p class="prefix"><a name="notatn"></a><b>Validity constraint: Notation Attributes</b></p><p>Values of this type
+must match one of the <a href="#Notations"><cite>notation</cite></a> names
+included in the declaration; all notation names in the declaration must be
+declared.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="OneNotationPer"></a><b>Validity constraint: One
+Notation Per Element Type</b></p><p>No element type may have more than one <b>NOTATION</b>
+attribute specified.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="NoNotationEmpty"></a><b>Validity constraint: No
+Notation on Empty Element</b></p><p><a title="For Compatibility" href="#dt-compat">For compatibility</a>,
+an attribute of type <b>NOTATION</b> must not be declared on an element
+declared <b>EMPTY</b>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="enum"></a><b>Validity constraint: Enumeration</b></p><p>Values of this type must match
+one of the <a href="#NT-Nmtoken">Nmtoken</a> tokens in the declaration.</p>
+</div>
+<p><a title="For interoperability" href="#dt-interop">For interoperability,</a> the same <a href="#NT-Nmtoken">Nmtoken</a> should not occur more than once in the enumerated
+attribute types of a single element type.</p>
+</div>
+<div class="div3">
+
+<h4><a name="sec-attr-defaults"></a>3.3.2 Attribute Defaults</h4>
+<p>An <a title="Attribute-List Declaration" href="#dt-attdecl">attribute declaration</a> provides information
+on whether the attribute's presence is required, and if not, how an XML processor
+should react if a declared attribute is absent in a document.</p>
+
+<h5>Attribute Defaults</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-DefaultDecl"></a>[60]   </td><td><code>DefaultDecl</code></td><td>   ::=   </td><td><code>'#REQUIRED' | '#IMPLIED' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| (('#FIXED' S)? <a href="#NT-AttValue">AttValue</a>)</code></td><td><a href="#RequiredAttr">[VC: Required Attribute]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#defattrvalid">[VC: Attribute Default Legal]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#CleanAttrVals">[WFC: No &lt; in Attribute Values]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#FixedAttr">[VC: Fixed Attribute Default]</a></td></tr>
+</tbody></table>
+<p>In an attribute declaration, <b>#REQUIRED</b> means that the attribute
+must always be provided, <b>#IMPLIED</b> that no default value is provided. [<a name="dt-default" title="Attribute Default">Definition</a>: If
+the declaration is neither <b>#REQUIRED</b> nor <b>#IMPLIED</b>, then
+the <a href="#NT-AttValue">AttValue</a> value contains the declared <b>default</b>
+value; the <b>#FIXED</b> keyword states that the attribute must always have
+the default value. If a default value is declared, when an XML processor encounters
+an omitted attribute, it is to behave as though the attribute were present
+with the declared default value.]</p>
+<div class="constraint"><p class="prefix"><a name="RequiredAttr"></a><b>Validity constraint: Required Attribute</b></p><p>If the default
+declaration is the keyword <b>#REQUIRED</b>, then the attribute must be
+specified for all elements of the type in the attribute-list declaration.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="defattrvalid"></a><b>Validity constraint: Attribute Default Legal</b></p><p>The declared
+default value must meet the lexical constraints of the declared attribute
+type.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="FixedAttr"></a><b>Validity constraint: Fixed Attribute Default</b></p><p>If an attribute
+has a default value declared with the <b>#FIXED</b> keyword, instances of
+that attribute must match the default value.</p>
+</div>
+<p>Examples of attribute-list declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ATTLIST termdef
+ id ID #REQUIRED
+ name CDATA #IMPLIED&gt;
+&lt;!ATTLIST list
+ type (bullets|ordered|glossary) "ordered"&gt;
+&lt;!ATTLIST form
+ method CDATA #FIXED "POST"&gt;</pre></td></tr></table>
+</div>
+<div class="div3">
+
+<h4><a name="AVNormalize"></a>3.3.3 Attribute-Value
+Normalization</h4>
+<p>Before the value of an attribute is passed to the application or checked
+for validity, the XML processor must normalize the attribute value by applying
+the algorithm below, or by using some other method such that the value passed
+to the application is the same as that produced by the algorithm.</p>
+<ol>
+<li><p>All line breaks must have been normalized on input to #xA as described
+in <a href="#sec-line-ends"><b>2.11 End-of-Line Handling</b></a>, so the rest of this algorithm operates
+on text normalized in this way.</p></li>
+<li><p>Begin with a normalized value consisting of the empty string.</p>
+</li>
+<li><p>For each character, entity reference, or character reference in the
+unnormalized attribute value, beginning with the first and continuing to the
+last, do the following:</p>
+<ul>
+<li><p>For a character reference, append the referenced character to the
+normalized value.</p></li>
+<li><p>For an entity reference, recursively apply step 3 of this algorithm
+to the replacement text of the entity.</p></li>
+<li><p>For a white space character (#x20, #xD, #xA, #x9), append a space
+character (#x20) to the normalized value.</p></li>
+<li><p>For another character, append the character to the normalized value.</p>
+</li>
+</ul>
+</li>
+</ol>
+<p>If the attribute type is not CDATA, then the XML processor must further
+process the normalized attribute value by discarding any leading and trailing
+space (#x20) characters, and by replacing sequences of space (#x20) characters
+by a single space (#x20) character.</p>
+<p>Note that if the unnormalized attribute value contains a character reference
+to a white space character other than space (#x20), the normalized value contains
+the referenced character itself (#xD, #xA or #x9). This contrasts with the
+case where the unnormalized value contains a white space character (not a
+reference), which is replaced with a space character (#x20) in the normalized
+value and also contrasts with the case where the unnormalized value contains
+an entity reference whose replacement text contains a white space character;
+being recursively processed, the white space character is replaced with a
+space character (#x20) in the normalized value.</p>
+<p>All attributes for which no declaration has been read should be treated
+by a non-validating processor
+as if declared <b>CDATA</b>.</p>
+<p>Following are examples of attribute normalization. Given the following
+declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY d "&amp;#xD;"&gt;
+&lt;!ENTITY a "&amp;#xA;"&gt;
+&lt;!ENTITY da "&amp;#xD;&amp;#xA;"&gt;</pre></td></tr></table>
+<p>the attribute specifications in the left column below would be normalized
+to the character sequences of the middle column if the attribute <code>a</code>
+is declared <b>NMTOKENS</b> and to those of the right columns if <code>a</code>
+is declared <b>CDATA</b>.</p>
+<table border="1" frame="border"><thead><tr><th rowspan="1" colspan="1">Attribute specification</th>
+<th rowspan="1" colspan="1">a is NMTOKENS</th><th rowspan="1" colspan="1">a is CDATA</th></tr></thead><tbody><tr><td rowspan="1" colspan="1"><table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>a="
+
+xyz"</pre></td></tr></table></td><td rowspan="1" colspan="1"><code>x y z</code></td><td rowspan="1" colspan="1"><code>#x20 #x20 x y z</code></td>
+</tr><tr><td rowspan="1" colspan="1"><table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>a="&amp;d;&amp;d;A&amp;a;&amp;a;B&amp;da;"</pre></td></tr></table></td><td rowspan="1" colspan="1"><code>A
+#x20 B</code></td><td rowspan="1" colspan="1"><code>#x20 #x20 A #x20 #x20 B #x20 #x20</code></td>
+</tr><tr><td rowspan="1" colspan="1"><table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>a=
+"&amp;#xd;&amp;#xd;A&amp;#xa;&amp;#xa;B&amp;#xd;&amp;#xa;"</pre></td></tr></table></td><td rowspan="1" colspan="1"><code>#xD
+#xD A #xA #xA B #xD #xA</code></td><td rowspan="1" colspan="1"><code>#xD #xD A #xA #xA B #xD #xD</code></td>
+</tr></tbody></table>
+<p>Note that the last example is invalid (but well-formed) if <code>a</code>
+is declared to be of type <b>NMTOKENS</b>.</p>
+</div>
+</div>
+<div class="div2">
+
+<h3><a name="sec-condition-sect"></a>3.4 Conditional Sections</h3>
+<p>[<a name="dt-cond-section" title="conditional section">Definition</a>: <b>Conditional
+sections</b> are portions of the <a title="Document Type Declaration" href="#dt-doctype">document type
+declaration external subset</a> which are included in, or excluded from,
+the logical structure of the DTD based on the keyword which governs them.]</p>
+
+<h5>Conditional Section</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-conditionalSect"></a>[61]   </td><td><code>conditionalSect</code></td><td>   ::=   </td><td><code><a href="#NT-includeSect">includeSect</a> | <a href="#NT-ignoreSect">ignoreSect</a> </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-includeSect"></a>[62]   </td><td><code>includeSect</code></td><td>   ::=   </td><td><code>'&lt;![' S? 'INCLUDE' S? '[' <a href="#NT-extSubsetDecl">extSubsetDecl</a>
+']]&gt;' </code></td><xsltdebug></xsltdebug><td><i>/* */</i></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#condsec-nesting">[VC: Proper
+Conditional Section/PE Nesting]</a></td></tr>
+<tr valign="baseline"><td><a name="NT-ignoreSect"></a>[63]   </td><td><code>ignoreSect</code></td><td>   ::=   </td><td><code>'&lt;![' S? 'IGNORE' S? '[' <a href="#NT-ignoreSectContents">ignoreSectContents</a>*
+']]&gt;'</code></td><xsltdebug></xsltdebug><td><i>/* */</i></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#condsec-nesting">[VC: Proper
+Conditional Section/PE Nesting]</a></td></tr>
+<tr valign="baseline"><td><a name="NT-ignoreSectContents"></a>[64]   </td><td><code>ignoreSectContents</code></td><td>   ::=   </td><td><code><a href="#NT-Ignore">Ignore</a> ('&lt;![' <a href="#NT-ignoreSectContents">ignoreSectContents</a> ']]&gt;' <a href="#NT-Ignore">Ignore</a>)*</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Ignore"></a>[65]   </td><td><code>Ignore</code></td><td>   ::=   </td><td><code><a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a>*
+('&lt;![' | ']]&gt;') <a href="#NT-Char">Char</a>*) </code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<div class="constraint"><p class="prefix"><a name="condsec-nesting"></a><b>Validity constraint: Proper
+Conditional Section/PE Nesting</b></p><p>If any of the "<code>&lt;![</code>",
+"<code>[</code>", or "<code>]]&gt;</code>" of a conditional section is contained
+in the replacement text for a parameter-entity reference, all of them must
+be contained in the same replacement text.</p>
+</div>
+<p>Like the internal and external DTD subsets, a conditional section may contain
+one or more complete declarations, comments, processing instructions, or nested
+conditional sections, intermingled with white space.</p>
+<p>If the keyword of the conditional section is <b>INCLUDE</b>, then the
+contents of the conditional section are part of the DTD. If the keyword of
+the conditional section is <b>IGNORE</b>, then the contents of the conditional
+section are not logically part of the DTD.
+If a conditional section with a keyword of <b>INCLUDE</b> occurs within
+a larger conditional section with a keyword of <b>IGNORE</b>, both the outer
+and the inner conditional sections are ignored. The contents
+of an ignored conditional section are parsed by ignoring all characters after
+the "<code>[</code>" following the keyword, except conditional section starts
+"<code>&lt;![</code>" and ends "<code>]]&gt;</code>", until the matching conditional
+section end is found. Parameter entity references are not recognized in this
+process.</p>
+<p>If the keyword of the conditional section is a parameter-entity reference,
+the parameter entity must be replaced by its content before the processor
+decides whether to include or ignore the conditional section.</p>
+<p>An example:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY % draft 'INCLUDE' &gt;
+&lt;!ENTITY % final 'IGNORE' &gt;
+
+&lt;![%draft;[
+&lt;!ELEMENT book (comments*, title, body, supplements?)&gt;
+]]&gt;
+&lt;![%final;[
+&lt;!ELEMENT book (title, body, supplements?)&gt;
+]]&gt;</pre></td></tr></table>
+</div>
+
+</div>
+
+<div class="div1">
+
+<h2><a name="sec-physical-struct"></a>4 Physical Structures</h2>
+<p>[<a name="dt-entity" title="Entity">Definition</a>: An XML document may consist of one
+or many storage units. These
+are called <b>entities</b>; they all have <b>content</b> and are
+all (except for the <a title="Document Entity" href="#dt-docent">document entity</a> and
+the <a title="Document Type Declaration" href="#dt-doctype">external DTD subset</a>) identified by
+entity <b>name</b>.] Each XML document has one entity
+called the <a title="Document Entity" href="#dt-docent">document entity</a>, which serves
+as the starting point for the <a title="XML Processor" href="#dt-xml-proc">XML processor</a>
+and may contain the whole document.</p>
+<p>Entities may be either parsed or unparsed. [<a name="dt-parsedent" title="Text Entity">Definition</a>: A <b>parsed
+entity's</b> contents are referred to as its <a title="Replacement Text" href="#dt-repltext">replacement
+text</a>; this <a title="Text" href="#dt-text">text</a> is considered an
+integral part of the document.]</p>
+<p>[<a name="dt-unparsed" title="Unparsed Entity">Definition</a>: An <b>unparsed entity</b>
+is a resource whose contents may or may not be <a title="Text" href="#dt-text">text</a>,
+and if text, may
+be other than XML. Each unparsed entity has an associated <a title="Notation" href="#dt-notation">notation</a>, identified by name. Beyond a requirement
+that an XML processor make the identifiers for the entity and notation available
+to the application, XML places no constraints on the contents of unparsed
+entities.]</p>
+<p>Parsed entities are invoked by name using entity references; unparsed entities
+by name, given in the value of <b>ENTITY</b> or <b>ENTITIES</b> attributes.</p>
+<p>[<a name="gen-entity" title="general entity">Definition</a>: <b>General entities</b>
+are entities for use within the document content. In this specification, general
+entities are sometimes referred to with the unqualified term <em>entity</em>
+when this leads to no ambiguity.] [<a name="dt-PE" title="Parameter entity">Definition</a>: <b>Parameter
+entities</b> are parsed entities for use within the DTD.]
+These two types of entities use different forms of reference and are recognized
+in different contexts. Furthermore, they occupy different namespaces; a parameter
+entity and a general entity with the same name are two distinct entities.</p>
+<div class="div2">
+
+<h3><a name="sec-references"></a>4.1 Character and Entity References</h3>
+<p>[<a name="dt-charref" title="Character Reference">Definition</a>: A <b>character
+reference</b> refers to a specific character in the ISO/IEC 10646 character
+set, for example one not directly accessible from available input devices.]</p>
+
+<h5>Character Reference</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-CharRef"></a>[66]   </td><td><code>CharRef</code></td><td>   ::=   </td><td><code>'&amp;#' [0-9]+ ';' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| '&amp;#x' [0-9a-fA-F]+ ';'</code></td><td><a href="#wf-Legalchar">[WFC: Legal Character]</a></td></tr></tbody></table>
+<div class="constraint"><p class="prefix"><a name="wf-Legalchar"></a><b>Well-formedness constraint: Legal Character</b></p><p>Characters referred
+to using character references must match the production for <a title="" href="#NT-Char">Char</a>.</p>
+</div>
+<p>If the character reference begins with "<code>&amp;#x</code>",
+the digits and letters up to the terminating <code>;</code> provide a hexadecimal
+representation of the character's code point in ISO/IEC 10646. If it begins
+just with "<code>&amp;#</code>", the digits up to the terminating <code>;</code>
+provide a decimal representation of the character's code point.</p>
+<p>[<a name="dt-entref" title="Entity Reference">Definition</a>: An <b>entity reference</b>
+refers to the content of a named entity.] [<a name="dt-GERef" title="General Entity Reference">Definition</a>: References to parsed general entities use
+ampersand (<code>&amp;</code>) and semicolon (<code>;</code>) as delimiters.] [<a name="dt-PERef" title="Parameter-entity reference">Definition</a>: <b>Parameter-entity references</b>
+use percent-sign (<code>%</code>) and semicolon (<code>;</code>) as delimiters.]</p>
+
+<h5>Entity Reference</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-Reference"></a>[67]   </td><td><code>Reference</code></td><td>   ::=   </td><td><code><a href="#NT-EntityRef">EntityRef</a> | <a href="#NT-CharRef">CharRef</a></code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-EntityRef"></a>[68]   </td><td><code>EntityRef</code></td><td>   ::=   </td><td><code>'&amp;' <a href="#NT-Name">Name</a> ';'</code></td><xsltdebug></xsltdebug><td><a href="#wf-entdeclared">[WFC: Entity Declared]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#vc-entdeclared">[VC: Entity Declared]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#textent">[WFC: Parsed Entity]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#norecursion">[WFC: No Recursion]</a></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PEReference"></a>[69]   </td><td><code>PEReference</code></td><td>   ::=   </td><td><code>'%' <a href="#NT-Name">Name</a> ';'</code></td><xsltdebug></xsltdebug><td><a href="#vc-entdeclared">[VC: Entity Declared]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#norecursion">[WFC: No Recursion]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#indtd">[WFC: In DTD]</a></td></tr></tbody></table>
+<div class="constraint"><p class="prefix"><a name="wf-entdeclared"></a><b>Well-formedness constraint: Entity Declared</b></p><p>In a document
+without any DTD, a document with only an internal DTD subset which contains
+no parameter entity references, or a document with "<code>standalone='yes'</code>", for
+an entity reference that does not occur within the external subset or a parameter
+entity, the <a href="#NT-Name">Name</a> given in the entity reference must <a title="match" href="#dt-match">match</a> that in an <a href="#sec-entity-decl"><cite>entity
+declaration</cite></a> that does not occur within the external subset or a
+parameter entity, except that well-formed documents need not declare
+any of the following entities: <code>amp</code>,
+<code>lt</code>,
+<code>gt</code>,
+<code>apos</code>,
+<code>quot</code>. The
+declaration of a general entity must precede any reference to it which appears
+in a default value in an attribute-list declaration.</p>
+<p>Note that if entities are declared in the external subset or in external
+parameter entities, a non-validating processor is <a href="#include-if-valid"><cite>not
+obligated to</cite></a> read and process their declarations; for such documents,
+the rule that an entity must be declared is a well-formedness constraint only
+if <a href="#sec-rmd"><cite>standalone='yes'</cite></a>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="vc-entdeclared"></a><b>Validity constraint: Entity Declared</b></p><p>In a document with
+an external subset or external parameter entities with "<code>standalone='no'</code>",
+the <a href="#NT-Name">Name</a> given in the entity reference must <a title="match" href="#dt-match">match</a> that in an <a href="#sec-entity-decl"><cite>entity
+declaration</cite></a>. For interoperability, valid documents should declare
+the entities <code>amp</code>,
+<code>lt</code>,
+<code>gt</code>,
+<code>apos</code>,
+<code>quot</code>, in the form specified in <a href="#sec-predefined-ent"><b>4.6 Predefined Entities</b></a>.
+The declaration of a parameter entity must precede any reference to it. Similarly,
+the declaration of a general entity must precede any attribute-list
+declaration containing a default value with a direct or indirect reference
+to that general entity.</p>
+</div>
+
+<div class="constraint"><p class="prefix"><a name="textent"></a><b>Well-formedness constraint: Parsed Entity</b></p><p>An entity reference must
+not contain the name of an <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a>.
+Unparsed entities may be referred to only in <a title="Attribute Value" href="#dt-attrval">attribute
+values</a> declared to be of type <b>ENTITY</b> or <b>ENTITIES</b>.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="norecursion"></a><b>Well-formedness constraint: No Recursion</b></p><p>A parsed entity must
+not contain a recursive reference to itself, either directly or indirectly.</p>
+</div>
+<div class="constraint"><p class="prefix"><a name="indtd"></a><b>Well-formedness constraint: In DTD</b></p><p>Parameter-entity references may
+only appear in the <a title="Document Type Declaration" href="#dt-doctype">DTD</a>.</p>
+</div>
+<p>Examples of character and entity references:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>Type &lt;key&gt;less-than&lt;/key&gt; (&amp;#x3C;) to save options.
+This document was prepared on &amp;docdate; and
+is classified &amp;security-level;.</pre></td></tr></table>
+<p>Example of a parameter-entity reference:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!-- declare the parameter entity "ISOLat2"... --&gt;
+&lt;!ENTITY % ISOLat2
+ SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" &gt;
+&lt;!-- ... now reference it. --&gt;
+%ISOLat2;</pre></td></tr></table>
+</div>
+<div class="div2">
+
+<h3><a name="sec-entity-decl"></a>4.2 Entity Declarations</h3>
+<p>[<a name="dt-entdecl" title="entity declaration">Definition</a>: Entities are declared
+thus:]</p>
+
+<h5>Entity Declaration</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-EntityDecl"></a>[70]   </td><td><code>EntityDecl</code></td><td>   ::=   </td><td><code><a href="#NT-GEDecl">GEDecl</a> | <a href="#NT-PEDecl">PEDecl</a></code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-GEDecl"></a>[71]   </td><td><code>GEDecl</code></td><td>   ::=   </td><td><code>'&lt;!ENTITY' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-S">S</a> <a href="#NT-EntityDef">EntityDef</a> <a href="#NT-S">S</a>?
+'&gt;'</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-PEDecl"></a>[72]   </td><td><code>PEDecl</code></td><td>   ::=   </td><td><code>'&lt;!ENTITY' <a href="#NT-S">S</a> '%' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-S">S</a> <a href="#NT-PEDef">PEDef</a> <a href="#NT-S">S</a>? '&gt;'</code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-EntityDef"></a>[73]   </td><td><code>EntityDef</code></td><td>   ::=   </td><td><code><a href="#NT-EntityValue">EntityValue</a> | (<a href="#NT-ExternalID">ExternalID</a> <a href="#NT-NDataDecl">NDataDecl</a>?)</code></td><xsltdebug></xsltdebug></tr>
+
+<tr valign="baseline"><td><a name="NT-PEDef"></a>[74]   </td><td><code>PEDef</code></td><td>   ::=   </td><td><code><a href="#NT-EntityValue">EntityValue</a> | <a href="#NT-ExternalID">ExternalID</a></code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>The <a href="#NT-Name">Name</a> identifies the entity in an <a title="Entity Reference" href="#dt-entref">entity
+reference</a> or, in the case of an unparsed entity, in the value of
+an <b>ENTITY</b> or <b>ENTITIES</b> attribute. If the same entity is declared
+more than once, the first declaration encountered is binding; at user option,
+an XML processor may issue a warning if entities are declared multiple times.</p>
+<div class="div3">
+
+<h4><a name="sec-internal-ent"></a>4.2.1 Internal Entities</h4>
+<p>[<a name="dt-internent" title="Internal Entity Replacement Text">Definition</a>: If the
+entity definition is an <a href="#NT-EntityValue">EntityValue</a>, the defined
+entity is called an <b>internal entity</b>. There is no separate physical
+storage object, and the content of the entity is given in the declaration.]
+Note that some processing of entity and character references in the <a title="Literal Entity Value" href="#dt-litentval">literal entity value</a> may be required to produce
+the correct <a title="Replacement Text" href="#dt-repltext">replacement text</a>: see <a href="#intern-replacement"><b>4.5 Construction of Internal Entity Replacement Text</b></a>.</p>
+<p>An internal entity is a <a title="Text Entity" href="#dt-parsedent">parsed entity</a>.</p>
+<p>Example of an internal entity declaration:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY Pub-Status "This is a pre-release of the
+ specification."&gt;</pre></td></tr></table>
+</div>
+<div class="div3">
+
+<h4><a name="sec-external-ent"></a>4.2.2 External Entities</h4>
+<p>[<a name="dt-extent" title="External Entity">Definition</a>: If the entity is not internal,
+it is an <b>external entity</b>, declared as follows:]</p>
+
+<h5>External Entity Declaration</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-ExternalID"></a>[75]   </td><td><code>ExternalID</code></td><td>   ::=   </td><td><code>'SYSTEM' <a href="#NT-S">S</a> <a href="#NT-SystemLiteral">SystemLiteral</a></code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'PUBLIC' <a href="#NT-S">S</a> <a href="#NT-PubidLiteral">PubidLiteral</a> <a href="#NT-S">S</a> <a href="#NT-SystemLiteral">SystemLiteral</a> </code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-NDataDecl"></a>[76]   </td><td><code>NDataDecl</code></td><td>   ::=   </td><td><code><a href="#NT-S">S</a> 'NDATA' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a></code></td><xsltdebug></xsltdebug><td><a href="#not-declared">[VC: Notation Declared]</a></td></tr></tbody></table>
+<p>If the <a href="#NT-NDataDecl">NDataDecl</a> is present, this is a general <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a>; otherwise it is a parsed entity.</p>
+<div class="constraint"><p class="prefix"><a name="not-declared"></a><b>Validity constraint: Notation Declared</b></p><p>The <a href="#NT-Name">Name</a>
+must match the declared name of a <a title="Notation" href="#dt-notation">notation</a>.</p>
+</div>
+<p>[<a name="dt-sysid" title="System Identifier">Definition</a>: The <a href="#NT-SystemLiteral">SystemLiteral</a> is called the entity's <b>system
+identifier</b>. It is a URI
+reference
+(as defined in <a href="#rfc2396">[IETF RFC 2396]</a>, updated by <a href="#rfc2732">[IETF RFC 2732]</a>), meant
+to be dereferenced to obtain input for the XML processor to construct the
+entity's replacement text.] It is an error for a fragment identifier
+(beginning with a <code>#</code> character) to be part of a system identifier.
+Unless otherwise provided by information outside the scope of this specification
+(e.g. a special XML element type defined by a particular DTD, or a processing
+instruction defined by a particular application specification), relative URIs
+are relative to the location of the resource within which the entity declaration
+occurs. A URI might thus be relative to the <a title="Document Entity" href="#dt-docent">document
+entity</a>, to the entity containing the <a title="Document Type Declaration" href="#dt-doctype">external
+DTD subset</a>, or to some other <a title="External Entity" href="#dt-extent">external parameter
+entity</a>.</p>
+<p>URI
+references require encoding and escaping of certain characters. The disallowed
+characters include all non-ASCII characters, plus the excluded characters
+listed in Section 2.4 of <a href="#rfc2396">[IETF RFC 2396]</a>, except for the number sign
+(<code>#</code>) and percent sign (<code>%</code>) characters and the square
+bracket characters re-allowed in <a href="#rfc2732">[IETF RFC 2732]</a>. Disallowed characters
+must be escaped as follows:</p>
+<ol>
+<li><p>Each disallowed character is converted to UTF-8 <a href="#rfc2279">[IETF RFC 2279]</a>
+as one or more bytes.</p></li>
+<li><p>Any octets corresponding to a disallowed character are escaped with
+the URI escaping mechanism (that is, converted to <code>%</code><var>HH</var>,
+where HH is the hexadecimal notation of the byte value).</p></li>
+<li><p>The original character is replaced by the resulting character sequence.</p>
+</li>
+</ol>
+<p>[<a name="dt-pubid" title="Public identifier">Definition</a>: In addition to a system
+identifier, an external identifier may include a <b>public identifier</b>.]
+An XML processor attempting to retrieve the entity's content may use the public
+identifier to try to generate an alternative URI reference.
+If the processor is unable to do so, it must use the URI
+reference specified in the system literal. Before a match is attempted,
+all strings of white space in the public identifier must be normalized to
+single space characters (#x20), and leading and trailing white space must
+be removed.</p>
+<p>Examples of external entity declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY open-hatch
+ SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml"&gt;
+&lt;!ENTITY open-hatch
+ PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
+ "http://www.textuality.com/boilerplate/OpenHatch.xml"&gt;
+&lt;!ENTITY hatch-pic
+ SYSTEM "../grafix/OpenHatch.gif"
+ NDATA gif &gt;</pre></td></tr></table>
+</div>
+</div>
+<div class="div2">
+
+<h3><a name="TextEntities"></a>4.3 Parsed Entities</h3>
+<div class="div3">
+
+<h4><a name="sec-TextDecl"></a>4.3.1 The Text Declaration</h4>
+<p>External parsed entities should each begin with a <b>text declaration</b>.</p>
+
+<h5>Text Declaration</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-TextDecl"></a>[77]   </td><td><code>TextDecl</code></td><td>   ::=   </td><td><code>'&lt;?xml' <a href="#NT-VersionInfo">VersionInfo</a>? <a href="#NT-EncodingDecl">EncodingDecl</a> <a href="#NT-S">S</a>? '?&gt;'</code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>The text declaration must be provided literally, not by reference to a
+parsed entity. No text declaration may appear at any position other than the
+beginning of an external parsed entity. The text declaration
+in an external parsed entity is not considered part of its <a title="Replacement Text" href="#dt-repltext">replacement
+text</a>.</p>
+</div>
+<div class="div3">
+
+<h4><a name="wf-entities"></a>4.3.2 Well-Formed Parsed Entities</h4>
+<p>The document entity is well-formed if it matches the production labeled <a href="#NT-document">document</a>. An external general parsed entity is well-formed
+if it matches the production labeled <a href="#NT-extParsedEnt">extParsedEnt</a>. All
+external parameter entities are well-formed by definition.</p>
+
+<h5>Well-Formed External Parsed Entity</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-extParsedEnt"></a>[78]   </td><td><code>extParsedEnt</code></td><td>   ::=   </td><td><code><a href="#NT-TextDecl">TextDecl</a>? <a href="#NT-content">content</a></code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<p>An internal general parsed entity is well-formed if its replacement text
+matches the production labeled <a href="#NT-content">content</a>. All internal
+parameter entities are well-formed by definition.</p>
+<p>A consequence of well-formedness in entities is that the logical and physical
+structures in an XML document are properly nested; no <a title="Start-Tag" href="#dt-stag">start-tag</a>, <a title="End Tag" href="#dt-etag">end-tag</a>, <a title="Empty" href="#dt-empty">empty-element tag</a>, <a title="Element" href="#dt-element">element</a>, <a title="Comment" href="#dt-comment">comment</a>, <a title="Processing instruction" href="#dt-pi">processing instruction</a>, <a title="Character Reference" href="#dt-charref">character
+reference</a>, or <a title="Entity Reference" href="#dt-entref">entity reference</a>
+can begin in one entity and end in another.</p>
+</div>
+<div class="div3">
+
+<h4><a name="charencoding"></a>4.3.3 Character Encoding in Entities</h4>
+<p>Each external parsed entity in an XML document may use a different encoding
+for its characters. All XML processors must be able to read entities in both
+the UTF-8 and UTF-16 encodings. The terms "UTF-8"
+and "UTF-16" in this specification do not apply to character
+encodings with any other labels, even if the encodings or labels are very
+similar to UTF-8 or UTF-16.</p>
+<p>Entities encoded in UTF-16 must begin with the Byte Order Mark described
+by Annex
+F of <a href="#ISO10646">[ISO/IEC 10646]</a>, Annex H of <a href="#ISO10646-2000">[ISO/IEC 10646-2000]</a>, section
+2.4 of <a href="#Unicode">[Unicode]</a>, and section 2.7 of <a href="#Unicode3">[Unicode3]</a>
+(the ZERO WIDTH NO-BREAK SPACE character, #xFEFF). This is an encoding signature,
+not part of either the markup or the character data of the XML document. XML
+processors must be able to use this character to differentiate between UTF-8
+and UTF-16 encoded documents.</p>
+<p>Although an XML processor is required to read only entities in the UTF-8
+and UTF-16 encodings, it is recognized that other encodings are used around
+the world, and it may be desired for XML processors to read entities that
+use them. In
+the absence of external character encoding information (such as MIME headers),
+parsed entities which are stored in an encoding other than UTF-8 or UTF-16
+must begin with a text declaration (see <a href="#sec-TextDecl"><b>4.3.1 The Text Declaration</b></a>) containing
+an encoding declaration:</p>
+
+<h5>Encoding Declaration</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-EncodingDecl"></a>[80]   </td><td><code>EncodingDecl</code></td><td>   ::=   </td><td><code><a href="#NT-S">S</a> 'encoding' <a href="#NT-Eq">Eq</a>
+('"' <a href="#NT-EncName">EncName</a> '"' | "'" <a href="#NT-EncName">EncName</a>
+"'" ) </code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-EncName"></a>[81]   </td><td><code>EncName</code></td><td>   ::=   </td><td><code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code></td><xsltdebug></xsltdebug><td><i>/* Encoding
+name contains only Latin characters */</i></td></tr></tbody></table>
+<p>In the <a title="Document Entity" href="#dt-docent">document entity</a>, the encoding
+declaration is part of the <a title="XML Declaration" href="#dt-xmldecl">XML declaration</a>.
+The <a href="#NT-EncName">EncName</a> is the name of the encoding used.</p>
+
+<p>In an encoding declaration, the values "<code>UTF-8</code>", "<code>UTF-16</code>", "<code>ISO-10646-UCS-2</code>", and "<code>ISO-10646-UCS-4</code>" should be used
+for the various encodings and transformations of Unicode / ISO/IEC 10646,
+the values "<code>ISO-8859-1</code>", "<code>ISO-8859-2</code>",
+... "<code>ISO-8859-</code><var>n</var>" (where <var>n</var>
+is the part number) should be used for the parts of ISO 8859, and
+the values "<code>ISO-2022-JP</code>", "<code>Shift_JIS</code>",
+and "<code>EUC-JP</code>" should be used for the various encoded
+forms of JIS X-0208-1997. It
+is recommended that character encodings registered (as <em>charset</em>s)
+with the Internet Assigned Numbers Authority <a href="#IANA">[IANA-CHARSETS]</a>,
+other than those just listed, be referred to using their registered names;
+other encodings should use names starting with an "x-" prefix.
+XML processors should match character encoding names in a case-insensitive
+way and should either interpret an IANA-registered name as the encoding registered
+at IANA for that name or treat it as unknown (processors are, of course, not
+required to support all IANA-registered encodings).</p>
+<p>In the absence of information provided by an external transport protocol
+(e.g. HTTP or MIME), it is an <a title="Error" href="#dt-error">error</a> for
+an entity including an encoding declaration to be presented to the XML processor
+in an encoding other than that named in the declaration, or for an entity which begins with neither a Byte Order Mark
+nor an encoding declaration to use an encoding other than UTF-8. Note that
+since ASCII is a subset of UTF-8, ordinary ASCII entities do not strictly
+need an encoding declaration.</p>
+<p>It
+is a
+fatal error for a <a href="#NT-TextDecl">TextDecl</a> to occur other
+than at the beginning of an external entity.</p>
+<p>It is a <a title="Fatal Error" href="#dt-fatal">fatal error</a> when an XML processor
+encounters an entity with an encoding that it is unable to process. It
+is a fatal error if an XML entity is determined (via default, encoding declaration,
+or higher-level protocol) to be in a certain encoding but contains octet sequences
+that are not legal in that encoding. It is also a fatal error if an XML entity
+contains no encoding declaration and its content is not legal UTF-8 or UTF-16.</p>
+<p>Examples of text
+declarations containing encoding declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml encoding='UTF-8'?&gt;
+&lt;?xml encoding='EUC-JP'?&gt;</pre></td></tr></table>
+</div>
+</div>
+<div class="div2">
+
+<h3><a name="entproc"></a>4.4 XML Processor Treatment of Entities and References</h3>
+<p>The table below summarizes the contexts in which character references,
+entity references, and invocations of unparsed entities might appear and the
+required behavior of an <a title="XML Processor" href="#dt-xml-proc">XML processor</a>
+in each case. The labels in the leftmost column describe the recognition context: </p><dl>
+<dt class="label">Reference in Content</dt>
+<dd>
+<p>as a reference anywhere after the <a title="Start-Tag" href="#dt-stag">start-tag</a>
+and before the <a title="End Tag" href="#dt-etag">end-tag</a> of an element; corresponds
+to the nonterminal <a href="#NT-content">content</a>.</p>
+</dd>
+<dt class="label">Reference in Attribute Value</dt>
+<dd>
+<p>as a reference within either the value of an attribute in a <a title="Start-Tag" href="#dt-stag">start-tag</a>,
+or a default value in an <a title="Attribute-List Declaration" href="#dt-attdecl">attribute declaration</a>;
+corresponds to the nonterminal <a href="#NT-AttValue">AttValue</a>.</p>
+</dd>
+<dt class="label">Occurs as Attribute Value</dt>
+<dd>
+<p>as a <a href="#NT-Name">Name</a>, not a reference, appearing either as
+the value of an attribute which has been declared as type <b>ENTITY</b>,
+or as one of the space-separated tokens in the value of an attribute which
+has been declared as type <b>ENTITIES</b>.</p>
+</dd>
+<dt class="label">Reference in Entity Value</dt>
+<dd>
+<p>as a reference within a parameter or internal entity's <a title="Literal Entity Value" href="#dt-litentval">literal
+entity value</a> in the entity's declaration; corresponds to the nonterminal <a href="#NT-EntityValue">EntityValue</a>.</p>
+</dd>
+<dt class="label">Reference in DTD</dt>
+<dd>
+<p>as
+a reference within either the internal or external subsets of the <a title="Document Type Declaration" href="#dt-doctype">DTD</a>, but outside of an <a href="#NT-EntityValue">EntityValue</a>, <a href="#NT-AttValue">AttValue</a>, <a href="#NT-PI">PI</a>, <a href="#NT-Comment">Comment</a>, <a href="#NT-SystemLiteral">SystemLiteral</a>, <a href="#NT-PubidLiteral">PubidLiteral</a>,
+or the contents of an ignored conditional section (see <a href="#sec-condition-sect"><b>3.4 Conditional Sections</b></a>).</p>
+<p>.</p>
+</dd>
+</dl><p></p>
+<table border="1" frame="border" cellpadding="7"><tbody align="center"><tr>
+<td rowspan="2" colspan="1"></td><td colspan="4" align="center" valign="bottom" rowspan="1">Entity
+Type</td><td rowspan="2" align="center" colspan="1">Character</td></tr><tr align="center" valign="bottom"><td rowspan="1" colspan="1">Parameter</td><td rowspan="1" colspan="1">Internal General</td><td rowspan="1" colspan="1">External Parsed
+General</td><td rowspan="1" colspan="1">Unparsed</td></tr><tr align="center" valign="middle"><td align="right" rowspan="1" colspan="1">Reference
+in Content</td><td rowspan="1" colspan="1"><a href="#not-recognized"><cite>Not recognized</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#included"><cite>Included</cite></a></td><td rowspan="1" colspan="1"><a href="#include-if-valid"><cite>Included
+if validating</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#included"><cite>Included</cite></a></td></tr><tr align="center" valign="middle"><td align="right" rowspan="1" colspan="1">Reference in Attribute Value</td><td rowspan="1" colspan="1"><a href="#not-recognized"><cite>Not recognized</cite></a></td><td rowspan="1" colspan="1"><a href="#inliteral"><cite>Included
+in literal</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td><td rowspan="1" colspan="1"><a href="#included"><cite>Included</cite></a></td>
+</tr><tr align="center" valign="middle"><td align="right" rowspan="1" colspan="1">Occurs as Attribute
+Value</td><td rowspan="1" colspan="1"><a href="#not-recognized"><cite>Not recognized</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td><td rowspan="1" colspan="1"><a href="#notify"><cite>Notify</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#not-recognized"><cite>Not recognized</cite></a></td></tr><tr align="center" valign="middle"><td align="right" rowspan="1" colspan="1">Reference in EntityValue</td><td rowspan="1" colspan="1"><a href="#inliteral"><cite>Included in literal</cite></a></td><td rowspan="1" colspan="1"><a href="#bypass"><cite>Bypassed</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#bypass"><cite>Bypassed</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#included"><cite>Included</cite></a></td></tr><tr align="center" valign="middle"><td align="right" rowspan="1" colspan="1">Reference in DTD</td><td rowspan="1" colspan="1"><a href="#as-PE"><cite>Included
+as PE</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td><td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td>
+<td rowspan="1" colspan="1"><a href="#forbidden"><cite>Forbidden</cite></a></td></tr></tbody></table>
+<div class="div3">
+
+<h4><a name="not-recognized"></a>4.4.1 Not Recognized</h4>
+<p>Outside the DTD, the <code>%</code> character has no special significance;
+thus, what would be parameter entity references in the DTD are not recognized
+as markup in <a href="#NT-content">content</a>. Similarly, the names of unparsed
+entities are not recognized except when they appear in the value of an appropriately
+declared attribute.</p>
+</div>
+<div class="div3">
+
+<h4><a name="included"></a>4.4.2 Included</h4>
+<p>[<a name="dt-include" title="Include">Definition</a>: An entity is <b>included</b>
+when its <a title="Replacement Text" href="#dt-repltext">replacement text</a> is retrieved
+and processed, in place of the reference itself, as though it were part of
+the document at the location the reference was recognized.] The replacement
+text may contain both <a title="Character Data" href="#dt-chardata">character data</a>
+and (except for parameter entities) <a title="Markup" href="#dt-markup">markup</a>,
+which must be recognized in the usual way. (The string "<code>AT&amp;amp;T;</code>"
+expands to "<code>AT&amp;T;</code>" and the remaining ampersand
+is not recognized as an entity-reference delimiter.) A character reference
+is <b>included</b> when the indicated character is processed in place
+of the reference itself. </p>
+</div>
+<div class="div3">
+
+<h4><a name="include-if-valid"></a>4.4.3 Included If Validating</h4>
+<p>When an XML processor recognizes a reference to a parsed entity, in order
+to <a title="Validity" href="#dt-valid">validate</a> the document, the processor
+must <a title="Include" href="#dt-include">include</a> its replacement text. If
+the entity is external, and the processor is not attempting to validate the
+XML document, the processor <a title="May" href="#dt-may">may</a>, but need
+not, include the entity's replacement text. If a non-validating processor
+does not include the replacement text, it must inform the application that
+it recognized, but did not read, the entity.</p>
+<p>This rule is based on the recognition that the automatic inclusion provided
+by the SGML and XML entity mechanism, primarily designed to support modularity
+in authoring, is not necessarily appropriate for other applications, in particular
+document browsing. Browsers, for example, when encountering an external parsed
+entity reference, might choose to provide a visual indication of the entity's
+presence and retrieve it for display only on demand.</p>
+</div>
+<div class="div3">
+
+<h4><a name="forbidden"></a>4.4.4 Forbidden</h4>
+<p>The following are forbidden, and constitute <a title="Fatal Error" href="#dt-fatal">fatal</a>
+errors:</p>
+<ul>
+<li><p>the appearance of a reference to an <a title="Unparsed Entity" href="#dt-unparsed">unparsed
+entity</a>.</p></li>
+<li><p>the appearance of any character or general-entity reference in the
+DTD except within an <a href="#NT-EntityValue">EntityValue</a> or <a href="#NT-AttValue">AttValue</a>.</p>
+</li>
+<li><p>a reference to an external entity in an attribute value.</p></li>
+</ul>
+</div>
+<div class="div3">
+
+<h4><a name="inliteral"></a>4.4.5 Included in Literal</h4>
+<p>When an <a title="Entity Reference" href="#dt-entref">entity reference</a> appears in
+an attribute value, or a parameter entity reference appears in a literal entity
+value, its <a title="Replacement Text" href="#dt-repltext">replacement text</a> is processed
+in place of the reference itself as though it were part of the document at
+the location the reference was recognized, except that a single or double
+quote character in the replacement text is always treated as a normal data
+character and will not terminate the literal. For example, this is well-formed:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!-- --&gt;
+&lt;!ENTITY % YN '"Yes"' &gt;
+&lt;!ENTITY WhatHeSaid "He said %YN;" &gt;</pre></td></tr></table>
+<p>while this is not:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY EndAttr "27'" &gt;
+&lt;element attribute='a-&amp;EndAttr;&gt;</pre></td></tr></table>
+</div>
+<div class="div3">
+
+<h4><a name="notify"></a>4.4.6 Notify</h4>
+<p>When the name of an <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a>
+appears as a token in the value of an attribute of declared type <b>ENTITY</b>
+or <b>ENTITIES</b>, a validating processor must inform the application of
+the <a title="System Identifier" href="#dt-sysid">system</a> and <a title="Public identifier" href="#dt-pubid">public</a>
+(if any) identifiers for both the entity and its associated <a title="Notation" href="#dt-notation">notation</a>.</p>
+</div>
+<div class="div3">
+
+<h4><a name="bypass"></a>4.4.7 Bypassed</h4>
+<p>When a general entity reference appears in the <a href="#NT-EntityValue">EntityValue</a>
+in an entity declaration, it is bypassed and left as is.</p>
+</div>
+<div class="div3">
+
+<h4><a name="as-PE"></a>4.4.8 Included as PE</h4>
+<p>Just as with external parsed entities, parameter entities need only be <a href="#include-if-valid"><cite>included if validating</cite></a>. When a parameter-entity
+reference is recognized in the DTD and included, its <a title="Replacement Text" href="#dt-repltext">replacement
+text</a> is enlarged by the attachment of one leading and one following
+space (#x20) character; the intent is to constrain the replacement text of
+parameter entities to contain an integral number of grammatical tokens in
+the DTD. This
+behavior does not apply to parameter entity references within entity values;
+these are described in <a href="#inliteral"><b>4.4.5 Included in Literal</b></a>.</p>
+</div>
+</div>
+<div class="div2">
+
+<h3><a name="intern-replacement"></a>4.5 Construction of Internal Entity Replacement Text</h3>
+<p>In discussing the treatment of internal entities, it is useful to distinguish
+two forms of the entity's value. [<a name="dt-litentval" title="Literal Entity Value">Definition</a>: The <b>literal
+entity value</b> is the quoted string actually present in the entity declaration,
+corresponding to the non-terminal <a href="#NT-EntityValue">EntityValue</a>.] [<a name="dt-repltext" title="Replacement Text">Definition</a>: The <b>replacement text</b>
+is the content of the entity, after replacement of character references and
+parameter-entity references.]</p>
+<p>The literal entity value as given in an internal entity declaration (<a href="#NT-EntityValue">EntityValue</a>) may contain character, parameter-entity,
+and general-entity references. Such references must be contained entirely
+within the literal entity value. The actual replacement text that is <a title="Include" href="#dt-include">included</a> as described above must contain the <em>replacement
+text</em> of any parameter entities referred to, and must contain the character
+referred to, in place of any character references in the literal entity value;
+however, general-entity references must be left as-is, unexpanded. For example,
+given the following declarations:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY % pub "&amp;#xc9;ditions Gallimard" &gt;
+&lt;!ENTITY rights "All rights reserved" &gt;
+&lt;!ENTITY book "La Peste: Albert Camus,
+&amp;#xA9; 1947 %pub;. &amp;rights;" &gt;</pre></td></tr></table>
+<p>then the replacement text for the entity "<code>book</code>"
+is:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>La Peste: Albert Camus,
+© 1947 Éditions Gallimard. &amp;rights;</pre></td></tr></table>
+<p>The general-entity reference "<code>&amp;rights;</code>" would
+be expanded should the reference "<code>&amp;book;</code>" appear
+in the document's content or an attribute value.</p>
+<p>These simple rules may have complex interactions; for a detailed discussion
+of a difficult example, see <a href="#sec-entexpand"><b>D Expansion of Entity and Character References</b></a>.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-predefined-ent"></a>4.6 Predefined Entities</h3>
+<p>[<a name="dt-escape" title="escape">Definition</a>: Entity and character references can
+both be used to <b>escape</b> the left angle bracket, ampersand, and
+other delimiters. A set of general entities (<code>amp</code>,
+<code>lt</code>,
+<code>gt</code>,
+<code>apos</code>,
+<code>quot</code>) is specified for
+this purpose. Numeric character references may also be used; they are expanded
+immediately when recognized and must be treated as character data, so the
+numeric character references "<code>&amp;#60;</code>" and "<code>&amp;#38;</code>"
+may be used to escape <code>&lt;</code> and <code>&amp;</code> when they occur
+in character data.]</p>
+<p>All XML processors must recognize these entities whether they are declared
+or not. <a title="For interoperability" href="#dt-interop">For interoperability</a>, valid XML
+documents should declare these entities, like any others, before using them. If
+the entities <code>lt</code> or <code>amp</code> are declared, they must be
+declared as internal entities whose replacement text is a character reference
+to the respective
+character (less-than sign or ampersand) being escaped; the double
+escaping is required for these entities so that references to them produce
+a well-formed result. If the entities <code>gt</code>, <code>apos</code>,
+or <code>quot</code> are declared, they must be declared as internal entities
+whose replacement text is the single character being escaped (or a character
+reference to that character; the double escaping here is unnecessary but harmless).
+For example:</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY lt "&amp;#38;#60;"&gt;
+&lt;!ENTITY gt "&amp;#62;"&gt;
+&lt;!ENTITY amp "&amp;#38;#38;"&gt;
+&lt;!ENTITY apos "&amp;#39;"&gt;
+&lt;!ENTITY quot "&amp;#34;"&gt;</pre></td></tr></table>
+
+</div>
+<div class="div2">
+
+<h3><a name="Notations"></a>4.7 Notation Declarations</h3>
+<p>[<a name="dt-notation" title="Notation">Definition</a>: <b>Notations</b> identify
+by name the format of <a title="External Entity" href="#dt-extent">unparsed entities</a>,
+the format of elements which bear a notation attribute, or the application
+to which a <a title="Processing instruction" href="#dt-pi">processing instruction</a> is addressed.]</p>
+<p>[<a name="dt-notdecl" title="Notation Declaration">Definition</a>: <b>Notation declarations</b>
+provide a name for the notation, for use in entity and attribute-list declarations
+and in attribute specifications, and an external identifier for the notation
+which may allow an XML processor or its client application to locate a helper
+application capable of processing data in the given notation.]</p>
+
+<h5>Notation Declarations</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-NotationDecl"></a>[82]   </td><td><code>NotationDecl</code></td><td>   ::=   </td><td><code>'&lt;!NOTATION' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> <a href="#NT-S">S</a> (<a href="#NT-ExternalID">ExternalID</a> | <a href="#NT-PublicID">PublicID</a>) <a href="#NT-S">S</a>? '&gt;'</code></td><xsltdebug></xsltdebug><td><a href="#UniqueNotationName">[VC: Unique
+Notation Name]</a></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PublicID"></a>[83]   </td><td><code>PublicID</code></td><td>   ::=   </td><td><code>'PUBLIC' <a href="#NT-S">S</a> <a href="#NT-PubidLiteral">PubidLiteral</a> </code></td><xsltdebug></xsltdebug></tr></tbody></table>
+<div class="constraint"><p class="prefix"><a name="UniqueNotationName"></a><b>Validity constraint: Unique
+Notation Name</b></p><p>Only one notation declaration can declare a given <a href="#NT-Name">Name</a>.</p>
+</div>
+<p>XML processors must provide applications with the name and external identifier(s)
+of any notation declared and referred to in an attribute value, attribute
+definition, or entity declaration. They may additionally resolve the external
+identifier into the <a title="System Identifier" href="#dt-sysid">system identifier</a>, file
+name, or other information needed to allow the application to call a processor
+for data in the notation described. (It is not an error, however, for XML
+documents to declare and refer to notations for which notation-specific applications
+are not available on the system where the XML processor or application is
+running.)</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-doc-entity"></a>4.8 Document Entity</h3>
+<p>[<a name="dt-docent" title="Document Entity">Definition</a>: The <b>document entity</b>
+serves as the root of the entity tree and a starting-point for an <a title="XML Processor" href="#dt-xml-proc">XML processor</a>.] This specification does
+not specify how the document entity is to be located by an XML processor;
+unlike other entities, the document entity has no name and might well appear
+on a processor input stream without any identification at all.</p>
+</div>
+</div>
+
+<div class="div1">
+
+<h2><a name="sec-conformance"></a>5 Conformance</h2>
+<div class="div2">
+
+<h3><a name="proc-types"></a>5.1 Validating and Non-Validating Processors</h3>
+<p>Conforming <a title="XML Processor" href="#dt-xml-proc">XML processors</a> fall into
+two classes: validating and non-validating.</p>
+<p>Validating and non-validating processors alike must report violations of
+this specification's well-formedness constraints in the content of the <a title="Document Entity" href="#dt-docent">document entity</a> and any other <a title="Text Entity" href="#dt-parsedent">parsed
+entities</a> that they read.</p>
+<p>[<a name="dt-validating" title="Validating Processor">Definition</a>: <b>Validating
+processors</b> must,
+at user option, report violations of the constraints expressed by
+the declarations in the <a title="Document Type Declaration" href="#dt-doctype">DTD</a>, and failures
+to fulfill the validity constraints given in this specification.]
+To accomplish this, validating XML processors must read and process the entire
+DTD and all external parsed entities referenced in the document.</p>
+<p>Non-validating processors are required to check only the <a title="Document Entity" href="#dt-docent">document
+entity</a>, including the entire internal DTD subset, for well-formedness. [<a name="dt-use-mdecl" title="Process Declarations">Definition</a>: While they are not required
+to check the document for validity, they are required to <b>process</b>
+all the declarations they read in the internal DTD subset and in any parameter
+entity that they read, up to the first reference to a parameter entity that
+they do <em>not</em> read; that is to say, they must use the information
+in those declarations to <a href="#AVNormalize"><cite>normalize</cite></a>
+attribute values, <a href="#included"><cite>include</cite></a> the replacement
+text of internal entities, and supply <a href="#sec-attr-defaults"><cite>default
+attribute values</cite></a>.] Except when <code>standalone="yes"</code>, they
+must not <a title="Process Declarations" href="#dt-use-mdecl">process</a> <a title="entity declaration" href="#dt-entdecl">entity
+declarations</a> or <a title="Attribute-List Declaration" href="#dt-attdecl">attribute-list declarations</a>
+encountered after a reference to a parameter entity that is not read, since
+the entity may have contained overriding declarations.</p>
+</div>
+<div class="div2">
+
+<h3><a name="safe-behavior"></a>5.2 Using XML Processors</h3>
+<p>The behavior of a validating XML processor is highly predictable; it must
+read every piece of a document and report all well-formedness and validity
+violations. Less is required of a non-validating processor; it need not read
+any part of the document other than the document entity. This has two effects
+that may be important to users of XML processors:</p>
+<ul>
+<li><p>Certain well-formedness errors, specifically those that require reading
+external entities, may not be detected by a non-validating processor. Examples
+include the constraints entitled <a href="#wf-entdeclared"><cite>Entity Declared</cite></a>, <a href="#textent"><cite>Parsed Entity</cite></a>, and <a href="#norecursion"><cite>No
+Recursion</cite></a>, as well as some of the cases described as <a href="#forbidden"><cite>forbidden</cite></a> in <a href="#entproc"><b>4.4 XML Processor Treatment of Entities and References</b></a>.</p></li>
+<li><p>The information passed from the processor to the application may
+vary, depending on whether the processor reads parameter and external entities.
+For example, a non-validating processor may not <a href="#AVNormalize"><cite>normalize</cite></a>
+attribute values, <a href="#included"><cite>include</cite></a> the replacement
+text of internal entities, or supply <a href="#sec-attr-defaults"><cite>default
+attribute values</cite></a>, where doing so depends on having read declarations
+in external or parameter entities.</p></li>
+</ul>
+<p>For maximum reliability in interoperating between different XML processors,
+applications which use non-validating processors should not rely on any behaviors
+not required of such processors. Applications which require facilities such
+as the use of default attributes or internal entities which are declared in
+external entities should use validating XML processors.</p>
+</div>
+</div>
+<div class="div1">
+
+<h2><a name="sec-notation"></a>6 Notation</h2>
+<p>The formal grammar of XML is given in this specification using a simple
+Extended Backus-Naur Form (EBNF) notation. Each rule in the grammar defines
+one symbol, in the form</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>symbol ::= expression</pre></td></tr></table>
+<p>Symbols are written with an initial capital letter if they are the
+start symbol of a regular language, otherwise with an initial lower
+case letter. Literal strings are quoted.</p>
+<p>Within the expression on the right-hand side of a rule, the following expressions
+are used to match strings of one or more characters: </p><dl>
+<dt class="label"><code>#xN</code></dt>
+<dd>
+<p>where <code>N</code> is a hexadecimal integer, the expression matches the
+character in ISO/IEC 10646 whose canonical (UCS-4) code value, when interpreted
+as an unsigned binary number, has the value indicated. The number of leading
+zeros in the <code>#xN</code> form is insignificant; the number of leading
+zeros in the corresponding code value is governed by the character encoding
+in use and is not significant for XML.</p>
+</dd>
+<dt class="label"><code>[a-zA-Z]</code>, <code>[#xN-#xN]</code></dt>
+<dd>
+<p>matches any <a href="#NT-Char">Char</a> with a value in the range(s) indicated (inclusive).</p>
+</dd>
+<dt class="label"><code>[abc]</code>, <code>[#xN#xN#xN]</code></dt>
+<dd>
+<p>matches any <a href="#NT-Char">Char</a> with a value among the characters
+enumerated. Enumerations and ranges can be mixed in one set of brackets.</p>
+</dd>
+<dt class="label"><code>[^a-z]</code>, <code>[^#xN-#xN]</code></dt>
+<dd>
+<p>matches any <a href="#NT-Char">Char</a> with a value <em>outside</em> the range
+indicated.</p>
+</dd>
+<dt class="label"><code>[^abc]</code>, <code>[^#xN#xN#xN]</code></dt>
+<dd>
+<p>matches any <a href="#NT-Char">Char</a> with a value not among the characters given. Enumerations
+and ranges of forbidden values can be mixed in one set of brackets.</p>
+</dd>
+<dt class="label"><code>"string"</code></dt>
+<dd>
+<p>matches a literal string <a title="match" href="#dt-match">matching</a> that
+given inside the double quotes.</p>
+</dd>
+<dt class="label"><code>'string'</code></dt>
+<dd>
+<p>matches a literal string <a title="match" href="#dt-match">matching</a> that
+given inside the single quotes.</p>
+</dd>
+</dl><p> These symbols may be combined to match more complex patterns as follows,
+where <code>A</code> and <code>B</code> represent simple expressions: </p><dl>
+<dt class="label">(<code>expression</code>)</dt>
+<dd>
+<p><code>expression</code> is treated as a unit and may be combined as described
+in this list.</p>
+</dd>
+<dt class="label"><code>A?</code></dt>
+<dd>
+<p>matches <code>A</code> or nothing; optional <code>A</code>.</p>
+</dd>
+<dt class="label"><code>A B</code></dt>
+<dd>
+<p>matches <code>A</code> followed by <code>B</code>. This
+operator has higher precedence than alternation; thus <code>A B | C D</code>
+is identical to <code>(A B) | (C D)</code>.</p>
+</dd>
+<dt class="label"><code>A | B</code></dt>
+<dd>
+<p>matches <code>A</code> or <code>B</code> but not both.</p>
+</dd>
+<dt class="label"><code>A - B</code></dt>
+<dd>
+<p>matches any string that matches <code>A</code> but does not match <code>B</code>.</p>
+</dd>
+<dt class="label"><code>A+</code></dt>
+<dd>
+<p>matches one or more occurrences of <code>A</code>.Concatenation
+has higher precedence than alternation; thus <code>A+ | B+</code> is identical
+to <code>(A+) | (B+)</code>.</p>
+</dd>
+<dt class="label"><code>A*</code></dt>
+<dd>
+<p>matches zero or more occurrences of <code>A</code>. Concatenation
+has higher precedence than alternation; thus <code>A* | B*</code> is identical
+to <code>(A*) | (B*)</code>.</p>
+</dd>
+</dl><p> Other notations used in the productions are: </p><dl>
+<dt class="label"><code>/* ... */</code></dt>
+<dd>
+<p>comment.</p>
+</dd>
+<dt class="label"><code>[ wfc: ... ]</code></dt>
+<dd>
+<p>well-formedness constraint; this identifies by name a constraint on <a title="Well-Formed" href="#dt-wellformed">well-formed</a> documents associated with a production.</p>
+</dd>
+<dt class="label"><code>[ vc: ... ]</code></dt>
+<dd>
+<p>validity constraint; this identifies by name a constraint on <a title="Validity" href="#dt-valid">valid</a>
+documents associated with a production.</p>
+</dd>
+</dl><p></p>
+</div>
+</div><div class="back">
+
+
+<div class="div1">
+
+<h2><a name="sec-bibliography"></a>A References</h2>
+<div class="div2">
+
+<h3><a name="sec-existing-stds"></a>A.1 Normative References</h3>
+<dl>
+<dt class="label"><a name="IANA"></a>IANA-CHARSETS</dt><dd>(Internet
+Assigned Numbers Authority) <cite>Official Names for Character Sets</cite>,
+ed. Keld Simonsen et al. See <a href="ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets">ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets</a>. </dd>
+<dt class="label"><a name="RFC1766"></a>IETF RFC 1766</dt><dd>IETF
+(Internet Engineering Task Force). <cite>RFC 1766: Tags for the Identification
+of Languages</cite>, ed. H. Alvestrand. 1995. (See <a href="http://www.ietf.org/rfc/rfc1766.txt">http://www.ietf.org/rfc/rfc1766.txt</a>.)</dd>
+
+
+<dt class="label"><a name="ISO10646"></a>ISO/IEC 10646</dt><dd>ISO (International Organization for
+Standardization). <cite>ISO/IEC 10646-1993 (E). Information technology --
+Universal Multiple-Octet Coded Character Set (UCS) -- Part 1: Architecture
+and Basic Multilingual Plane.</cite> [Geneva]: International Organization
+for Standardization, 1993 (plus amendments AM 1 through AM 7).</dd>
+<dt class="label"><a name="ISO10646-2000"></a>ISO/IEC 10646-2000</dt><dd> ISO (International
+Organization for Standardization). <cite>ISO/IEC 10646-1:2000. Information
+technology -- Universal Multiple-Octet Coded Character Set (UCS) --
+Part 1: Architecture and Basic Multilingual Plane.</cite> [Geneva]: International
+Organization for Standardization, 2000.</dd>
+<dt class="label"><a name="Unicode"></a>Unicode</dt><dd>The Unicode Consortium. <em>The Unicode
+Standard, Version 2.0.</em> Reading, Mass.: Addison-Wesley Developers Press,
+1996.</dd>
+<dt class="label"><a name="Unicode3"></a>Unicode3</dt><dd>
+The Unicode Consortium. <em>The Unicode Standard, Version 3.0.</em> Reading,
+Mass.: Addison-Wesley Developers Press, 2000. ISBN 0-201-61633-5.</dd>
+</dl></div>
+<div class="div2">
+
+
+<h3><a name="null"></a>A.2 Other References</h3>
+<dl>
+<dt class="label"><a name="Aho"></a>Aho/Ullman</dt><dd>Aho, Alfred V., Ravi Sethi, and Jeffrey D.
+Ullman. <cite>Compilers: Principles, Techniques, and Tools</cite>.
+Reading: Addison-Wesley, 1986, rpt. corr. 1988.</dd>
+<dt class="label"><a name="Berners-Lee"></a>Berners-Lee et al.</dt><dd> Berners-Lee, T., R. Fielding,
+and L. Masinter. <cite>Uniform Resource Identifiers (URI): Generic Syntax
+and Semantics</cite>. 1997. (Work in progress; see updates to RFC1738.)</dd>
+<dt class="label"><a name="ABK"></a>Brüggemann-Klein</dt><dd>Brüggemann-Klein,
+Anne. Formal Models in Document Processing. Habilitationsschrift. Faculty
+of Mathematics at the University of Freiburg, 1993. (See <a href="ftp://ftp.informatik.uni-freiburg.de/documents/papers/brueggem/habil.ps">ftp://ftp.informatik.uni-freiburg.de/documents/papers/brueggem/habil.ps</a>.)</dd>
+<dt class="label"><a name="ABKDW"></a>Brüggemann-Klein and Wood</dt><dd>Brüggemann-Klein,
+Anne, and Derick Wood. <cite>Deterministic Regular Languages</cite>.
+Universität Freiburg, Institut für Informatik, Bericht 38, Oktober 1991. Extended
+abstract in A. Finkel, M. Jantzen, Hrsg., STACS 1992, S. 173-184. Springer-Verlag,
+Berlin 1992. Lecture Notes in Computer Science 577. Full version titled <cite>One-Unambiguous
+Regular Languages</cite> in Information and Computation 140 (2): 229-253,
+February 1998.</dd>
+<dt class="label"><a name="Clark"></a>Clark</dt><dd>James Clark. Comparison of SGML and XML. See <a href="http://www.w3.org/TR/NOTE-sgml-xml-971215">http://www.w3.org/TR/NOTE-sgml-xml-971215</a>. </dd>
+<dt class="label"><a name="IANA-LANGCODES"></a>IANA-LANGCODES</dt><dd>(Internet
+Assigned Numbers Authority) <cite>Registry of Language Tags</cite>,
+ed. Keld Simonsen et al. (See <a href="http://www.isi.edu/in-notes/iana/assignments/languages/">http://www.isi.edu/in-notes/iana/assignments/languages/</a>.)</dd>
+
+
+<dt class="label"><a name="RFC2141"></a>IETF RFC2141</dt><dd>IETF
+(Internet Engineering Task Force). <em>RFC 2141: URN Syntax</em>, ed.
+R. Moats. 1997. (See <a href="http://www.ietf.org/rfc/rfc2141.txt">http://www.ietf.org/rfc/rfc2141.txt</a>.)</dd>
+<dt class="label"><a name="rfc2279"></a>IETF RFC 2279</dt><dd>IETF
+(Internet Engineering Task Force). <cite>RFC 2279: UTF-8, a transformation
+format of ISO 10646</cite>, ed. F. Yergeau, 1998. (See <a href="http://www.ietf.org/rfc/rfc2279.txt">http://www.ietf.org/rfc/rfc2279.txt</a>.)</dd>
+<dt class="label"><a name="rfc2376"></a>IETF RFC 2376</dt><dd>IETF
+(Internet Engineering Task Force). <cite>RFC 2376: XML Media Types</cite>.
+ed. E. Whitehead, M. Murata. 1998. (See <a href="http://www.ietf.org/rfc/rfc2376.txt">http://www.ietf.org/rfc/rfc2376.txt</a>.)</dd>
+<dt class="label"><a name="rfc2396"></a>IETF RFC 2396</dt><dd>IETF
+(Internet Engineering Task Force). <cite>RFC 2396: Uniform Resource Identifiers
+(URI): Generic Syntax</cite>. T. Berners-Lee, R. Fielding, L. Masinter.
+1998. (See <a href="http://www.ietf.org/rfc/rfc2396.txt">http://www.ietf.org/rfc/rfc2396.txt</a>.)</dd>
+<dt class="label"><a name="rfc2732"></a>IETF RFC 2732</dt><dd>IETF
+(Internet Engineering Task Force). <cite>RFC 2732: Format for Literal
+IPv6 Addresses in URL's</cite>. R. Hinden, B. Carpenter, L. Masinter.
+1999. (See <a href="http://www.ietf.org/rfc/rfc2732.txt">http://www.ietf.org/rfc/rfc2732.txt</a>.)</dd>
+<dt class="label"><a name="rfc2781"></a>IETF RFC 2781</dt><dd>
+IETF (Internet Engineering Task Force). <em>RFC 2781: UTF-16, an encoding
+of ISO 10646</em>, ed. P. Hoffman, F. Yergeau. 2000. (See <a href="http://www.ietf.org/rfc/rfc2781.txt">http://www.ietf.org/rfc/rfc2781.txt</a>.)</dd>
+<dt class="label"><a name="ISO639"></a>ISO 639</dt><dd>
+(International Organization for Standardization). <cite>ISO 639:1988 (E).
+Code for the representation of names of languages.</cite> [Geneva]: International
+Organization for Standardization, 1988.</dd>
+<dt class="label"><a name="ISO3166"></a>ISO 3166</dt><dd>
+(International Organization for Standardization). <cite>ISO 3166-1:1997
+(E). Codes for the representation of names of countries and their subdivisions --
+Part 1: Country codes</cite> [Geneva]: International Organization for
+Standardization, 1997.</dd>
+<dt class="label"><a name="ISO8879"></a>ISO 8879</dt><dd>ISO (International Organization for Standardization). <cite>ISO
+8879:1986(E). Information processing -- Text and Office Systems --
+Standard Generalized Markup Language (SGML).</cite> First edition --
+1986-10-15. [Geneva]: International Organization for Standardization, 1986. </dd>
+<dt class="label"><a name="ISO10744"></a>ISO/IEC 10744</dt><dd>ISO (International Organization for
+Standardization). <cite>ISO/IEC 10744-1992 (E). Information technology --
+Hypermedia/Time-based Structuring Language (HyTime). </cite> [Geneva]:
+International Organization for Standardization, 1992. <em>Extended Facilities
+Annexe.</em> [Geneva]: International Organization for Standardization, 1996. </dd>
+<dt class="label"><a name="websgml"></a>WEBSGML</dt><dd>ISO
+(International Organization for Standardization). <cite>ISO 8879:1986
+TC2. Information technology -- Document Description and Processing Languages. </cite>
+[Geneva]: International Organization for Standardization, 1998. (See <a href="http://www.sgmlsource.com/8879rev/n0029.htm">http://www.sgmlsource.com/8879rev/n0029.htm</a>.)</dd>
+<dt class="label"><a name="xml-names"></a>XML Names</dt><dd>Tim Bray,
+Dave Hollander, and Andrew Layman, editors. <cite>Namespaces in XML</cite>.
+Textuality, Hewlett-Packard, and Microsoft. World Wide Web Consortium, 1999. (See <a href="http://www.w3.org/TR/REC-xml-names/">http://www.w3.org/TR/REC-xml-names/</a>.)</dd>
+</dl></div>
+</div>
+<div class="div1">
+
+<h2><a name="CharClasses"></a>B Character Classes</h2>
+<p>Following the characteristics defined in the Unicode standard, characters
+are classed as base characters (among others, these contain the alphabetic
+characters of the Latin alphabet), ideographic characters, and combining characters (among
+others, this class contains most diacritics) Digits and extenders are also
+distinguished.</p>
+
+<h5>Characters</h5><table class="scrap" summary="Scrap"><tbody>
+<tr valign="baseline"><td><a name="NT-Letter"></a>[84]   </td><td><code>Letter</code></td><td>   ::=   </td><td><code><a href="#NT-BaseChar">BaseChar</a> | <a href="#NT-Ideographic">Ideographic</a></code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-BaseChar"></a>[85]   </td><td><code>BaseChar</code></td><td>   ::=   </td><td><code>[#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6]
+| [#x00D8-#x00F6] | [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E]
+| [#x0141-#x0148] | [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0]
+| [#x01F4-#x01F5] | [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1]
+| #x0386 | [#x0388-#x038A] | #x038C | [#x038E-#x03A1]
+| [#x03A3-#x03CE] | [#x03D0-#x03D6] | #x03DA | #x03DC
+| #x03DE | #x03E0 | [#x03E2-#x03F3] | [#x0401-#x040C]
+| [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] | [#x0490-#x04C4]
+| [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] | [#x04EE-#x04F5]
+| [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 | [#x0561-#x0586]
+| [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] | [#x0641-#x064A]
+| [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] | [#x06D0-#x06D3]
+| #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D
+| [#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8]
+| [#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD]
+| [#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10]
+| [#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36]
+| [#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74]
+| [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8]
+| [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD
+| #x0AE0 | [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28]
+| [#x0B2A-#x0B30] | [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D
+| [#x0B5C-#x0B5D] | [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90]
+| [#x0B92-#x0B95] | [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F]
+| [#x0BA3-#x0BA4] | [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9]
+| [#x0C05-#x0C0C] | [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33]
+| [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90]
+| [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE
+| [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28]
+| [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30
+| [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84
+| [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97]
+| [#x0E99-#x0E9F] | [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7
+| [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] | #x0EB0 | [#x0EB2-#x0EB3]
+| #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] | [#x0F49-#x0F69]
+| [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 | [#x1102-#x1103]
+| [#x1105-#x1107] | #x1109 | [#x110B-#x110C] | [#x110E-#x1112]
+| #x113C | #x113E | #x1140 | #x114C | #x114E | #x1150
+| [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163
+| #x1165 | #x1167 | #x1169 | [#x116D-#x116E] | [#x1172-#x1173]
+| #x1175 | #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF]
+| [#x11B7-#x11B8] | #x11BA | [#x11BC-#x11C2] | #x11EB
+| #x11F0 | #x11F9 | [#x1E00-#x1E9B] | [#x1EA0-#x1EF9]
+| [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] | [#x1F48-#x1F4D]
+| [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D | [#x1F5F-#x1F7D]
+| [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE | [#x1FC2-#x1FC4]
+| [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] | [#x1FE0-#x1FEC]
+| [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 | [#x212A-#x212B]
+| #x212E | [#x2180-#x2182] | [#x3041-#x3094] | [#x30A1-#x30FA]
+| [#x3105-#x312C] | [#xAC00-#xD7A3] </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Ideographic"></a>[86]   </td><td><code>Ideographic</code></td><td>   ::=   </td><td><code>[#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-CombiningChar"></a>[87]   </td><td><code>CombiningChar</code></td><td>   ::=   </td><td><code>[#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486]
+| [#x0591-#x05A1] | [#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF
+| [#x05C1-#x05C2] | #x05C4 | [#x064B-#x0652] | #x0670
+| [#x06D6-#x06DC] | [#x06DD-#x06DF] | [#x06E0-#x06E4] | [#x06E7-#x06E8]
+| [#x06EA-#x06ED] | [#x0901-#x0903] | #x093C | [#x093E-#x094C]
+| #x094D | [#x0951-#x0954] | [#x0962-#x0963] | [#x0981-#x0983]
+| #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] | [#x09C7-#x09C8]
+| [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] | #x0A02
+| #x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48]
+| [#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC
+| [#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03]
+| #x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D]
+| [#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8]
+| [#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44]
+| [#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83]
+| [#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6]
+| [#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D]
+| #x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E]
+| #x0EB1 | [#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD]
+| [#x0F18-#x0F19] | #x0F35 | #x0F37 | #x0F39 | #x0F3E
+| #x0F3F | [#x0F71-#x0F84] | [#x0F86-#x0F8B] | [#x0F90-#x0F95]
+| #x0F97 | [#x0F99-#x0FAD] | [#x0FB1-#x0FB7] | #x0FB9
+| [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] | #x3099
+| #x309A </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Digit"></a>[88]   </td><td><code>Digit</code></td><td>   ::=   </td><td><code>[#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9]
+| [#x0966-#x096F] | [#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF]
+| [#x0B66-#x0B6F] | [#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF]
+| [#x0D66-#x0D6F] | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29] </code></td><xsltdebug></xsltdebug></tr>
+<tr valign="baseline"><td><a name="NT-Extender"></a>[89]   </td><td><code>Extender</code></td><td>   ::=   </td><td><code>#x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640
+| #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | [#x309D-#x309E]
+| [#x30FC-#x30FE] </code></td><xsltdebug></xsltdebug></tr>
+</tbody></table>
+<p>The character classes defined here can be derived from the Unicode 2.0
+character database as follows:</p>
+<ul>
+<li><p>Name start characters must have one of the categories Ll, Lu, Lo,
+Lt, Nl.</p></li>
+<li><p>Name characters other than Name-start characters must have one of
+the categories Mc, Me, Mn, Lm, or Nd.</p></li>
+<li><p>Characters in the compatibility area (i.e. with character code greater
+than #xF900 and less than #xFFFE) are not allowed in XML names.</p></li>
+<li><p>Characters which have a font or compatibility decomposition (i.e.
+those with a "compatibility formatting tag" in field 5 of the
+database -- marked by field 5 beginning with a "&lt;") are not
+allowed.</p></li>
+<li><p>The following characters are treated as name-start characters rather
+than name characters, because the property file classifies them as Alphabetic:
+[#x02BB-#x02C1], #x0559, #x06E5, #x06E6.</p></li>
+<li><p>Characters #x20DD-#x20E0 are excluded (in accordance with Unicode 2.0,
+section 5.14).</p></li>
+<li><p>Character #x00B7 is classified as an extender, because the property
+list so identifies it.</p></li>
+<li><p>Character #x0387 is added as a name character, because #x00B7 is
+its canonical equivalent.</p></li>
+<li><p>Characters ':' and '_' are allowed as name-start characters.</p>
+</li>
+<li><p>Characters '-' and '.' are allowed as name characters.</p></li>
+</ul>
+</div>
+<div class="div1">
+
+<h2><a name="sec-xml-and-sgml"></a>C XML and SGML (Non-Normative)</h2>
+<p>XML
+is designed to be a subset of SGML, in that every XML document should also
+be a conforming SGML document. For a detailed comparison of the additional
+restrictions that XML places on documents beyond those of SGML, see <a href="#Clark">[Clark]</a>.</p>
+</div>
+<div class="div1">
+
+<h2><a name="sec-entexpand"></a>D Expansion of Entity and Character References (Non-Normative)</h2>
+<p>This appendix contains some examples illustrating the sequence of entity-
+and character-reference recognition and expansion, as specified in <a href="#entproc"><b>4.4 XML Processor Treatment of Entities and References</b></a>.</p>
+<p>If the DTD contains the declaration</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!ENTITY example "&lt;p&gt;An ampersand (&amp;#38;#38;) may be escaped
+numerically (&amp;#38;#38;#38;) or with a general entity
+(&amp;amp;amp;).&lt;/p&gt;" &gt;</pre></td></tr></table>
+<p>then the XML processor will recognize the character references when it
+parses the entity declaration, and resolve them before storing the following
+string as the value of the entity "<code>example</code>":</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;p&gt;An ampersand (&amp;#38;) may be escaped
+numerically (&amp;#38;#38;) or with a general entity
+(&amp;amp;amp;).&lt;/p&gt;</pre></td></tr></table>
+<p>A reference in the document to "<code>&amp;example;</code>"
+will cause the text to be reparsed, at which time the start- and end-tags
+of the <code>p</code> element will be recognized and the three references will
+be recognized and expanded, resulting in a <code>p</code> element with the following
+content (all data, no delimiters or markup):</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>An ampersand (&amp;) may be escaped
+numerically (&amp;#38;) or with a general entity
+(&amp;amp;).</pre></td></tr></table>
+<p>A more complex example will illustrate the rules and their effects fully.
+In the following example, the line numbers are solely for reference.</p>
+<table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>1 &lt;?xml version='1.0'?&gt;
+2 &lt;!DOCTYPE test [
+3 &lt;!ELEMENT test (#PCDATA) &gt;
+4 &lt;!ENTITY % xx '&amp;#37;zz;'&gt;
+5 &lt;!ENTITY % zz '&amp;#60;!ENTITY tricky "error-prone" &gt;' &gt;
+6 %xx;
+7 ]&gt;
+8 &lt;test&gt;This sample shows a &amp;tricky; method.&lt;/test&gt;</pre></td></tr></table>
+<p>This produces the following:</p>
+<ul>
+<li><p>in line 4, the reference to character 37 is expanded immediately,
+and the parameter entity "<code>xx</code>" is stored in the symbol
+table with the value "<code>%zz;</code>". Since the replacement
+text is not rescanned, the reference to parameter entity "<code>zz</code>"
+is not recognized. (And it would be an error if it were, since "<code>zz</code>"
+is not yet declared.)</p></li>
+<li><p>in line 5, the character reference "<code>&amp;#60;</code>"
+is expanded immediately and the parameter entity "<code>zz</code>"
+is stored with the replacement text "<code>&lt;!ENTITY tricky "error-prone"
+&gt;</code>", which is a well-formed entity declaration.</p></li>
+<li><p>in line 6, the reference to "<code>xx</code>" is recognized,
+and the replacement text of "<code>xx</code>" (namely "<code>%zz;</code>")
+is parsed. The reference to "<code>zz</code>" is recognized in
+its turn, and its replacement text ("<code>&lt;!ENTITY tricky "error-prone"
+&gt;</code>") is parsed. The general entity "<code>tricky</code>"
+has now been declared, with the replacement text "<code>error-prone</code>".</p>
+</li>
+<li><p>in line 8, the reference to the general entity "<code>tricky</code>"
+is recognized, and it is expanded, so the full content of the <code>test</code>
+element is the self-describing (and ungrammatical) string <em>This sample
+shows a error-prone method.</em></p></li>
+</ul>
+</div>
+<div class="div1">
+
+<h2><a name="determinism"></a>E Deterministic Content Models (Non-Normative)</h2>
+<p>As
+noted in <a href="#sec-element-content"><b>3.2.1 Element Content</b></a>, it is required that content
+models in element type declarations be deterministic. This requirement is <a title="For Compatibility" href="#dt-compat">for compatibility</a> with SGML (which calls deterministic
+content models "unambiguous"); XML processors built
+using SGML systems may flag non-deterministic content models as errors.</p>
+<p>For example, the content model <code>((b, c) | (b, d))</code> is non-deterministic,
+because given an initial <code>b</code> the XML processor
+cannot know which <code>b</code> in the model is being matched without looking
+ahead to see which element follows the <code>b</code>. In this case, the two references
+to <code>b</code> can be collapsed into a single reference, making the model read <code>(b,
+(c | d))</code>. An initial <code>b</code> now clearly matches only a single name
+in the content model. The processor doesn't need to look ahead to see what follows; either <code>c</code> or <code>d</code>
+would be accepted.</p>
+<p>More formally: a finite state automaton may be constructed from the content
+model using the standard algorithms, e.g. algorithm 3.5 in section 3.9 of
+Aho, Sethi, and Ullman <a href="#Aho">[Aho/Ullman]</a>. In many such algorithms, a follow
+set is constructed for each position in the regular expression (i.e., each
+leaf node in the syntax tree for the regular expression); if any position
+has a follow set in which more than one following position is labeled with
+the same element type name, then the content model is in error and may be
+reported as an error.</p>
+<p>Algorithms exist which allow many but not all non-deterministic content
+models to be reduced automatically to equivalent deterministic models; see
+Brüggemann-Klein 1991 <a href="#ABK">[Brüggemann-Klein]</a>.</p>
+</div>
+<div class="div1">
+
+<h2><a name="sec-guessing"></a>F Autodetection
+of Character Encodings (Non-Normative)</h2>
+<p>The XML encoding declaration functions as an internal label on each entity,
+indicating which character encoding is in use. Before an XML processor can
+read the internal label, however, it apparently has to know what character
+encoding is in use--which is what the internal label is trying to indicate.
+In the general case, this is a hopeless situation. It is not entirely hopeless
+in XML, however, because XML limits the general case in two ways: each implementation
+is assumed to support only a finite set of character encodings, and the XML
+encoding declaration is restricted in position and content in order to make
+it feasible to autodetect the character encoding in use in each entity in
+normal cases. Also, in many cases other sources of information are available
+in addition to the XML data stream itself. Two cases may be distinguished,
+depending on whether the XML entity is presented to the processor without,
+or with, any accompanying (external) information. We consider the first case
+first.</p>
+<div class="div2">
+
+<h3><a name="sec-guessing-no-ext-info"></a>F.1 Detection Without External Encoding Information</h3>
+<p>Because each XML entity not accompanied by external
+encoding information and not in UTF-8 or UTF-16 encoding <em>must</em>
+begin with an XML encoding declaration, in which the first characters must
+be '<code>&lt;?xml</code>', any conforming processor can detect, after two
+to four octets of input, which of the following cases apply. In reading this
+list, it may help to know that in UCS-4, '&lt;' is "<code>#x0000003C</code>"
+and '?' is "<code>#x0000003F</code>", and the Byte Order Mark
+required of UTF-16 data streams is "<code>#xFEFF</code>". The notation <var>##</var> is used to denote any byte value except that two consecutive <var>##</var>s cannot be both 00.</p>
+<p>With a Byte Order Mark:</p>
+<table border="1" frame="border"><tbody><tr><td rowspan="1" colspan="1"><code>00 00 FE
+FF</code></td><td rowspan="1" colspan="1">UCS-4, big-endian machine (1234 order)</td></tr><tr><td rowspan="1" colspan="1"><code>FF
+FE 00 00</code></td><td rowspan="1" colspan="1">UCS-4, little-endian machine (4321 order)</td></tr>
+<tr><td rowspan="1" colspan="1"><code>00 00 FF FE</code></td><td rowspan="1" colspan="1">UCS-4, unusual octet order (2143)</td>
+</tr><tr><td rowspan="1" colspan="1"><code>FE FF 00 00</code></td><td rowspan="1" colspan="1">UCS-4, unusual octet order (3412)</td>
+</tr><tr><td rowspan="1" colspan="1"><code>FE FF ## ##</code></td><td rowspan="1" colspan="1">UTF-16, big-endian</td></tr>
+<tr><td rowspan="1" colspan="1"><code>FF FE ## ##</code></td><td rowspan="1" colspan="1">UTF-16, little-endian</td></tr><tr>
+<td rowspan="1" colspan="1"><code>EF BB BF</code></td><td rowspan="1" colspan="1">UTF-8</td></tr></tbody></table>
+<p>Without a Byte Order Mark:</p>
+<table border="1" frame="border"><tbody><tr><td rowspan="1" colspan="1"><code>00 00 00 3C</code></td>
+<td rowspan="4" colspan="1">UCS-4 or other encoding with a 32-bit code unit and ASCII
+characters encoded as ASCII values, in respectively big-endian (1234), little-endian
+(4321) and two unusual byte orders (2143 and 3412). The encoding declaration
+must be read to determine which of UCS-4 or other supported 32-bit encodings
+applies.</td></tr><tr><td rowspan="1" colspan="1"><code>3C 00 00 00</code></td>
+
+</tr><tr><td rowspan="1" colspan="1"><code>00 00 3C 00</code></td>
+
+</tr><tr><td rowspan="1" colspan="1"><code>00 3C 00 00</code></td>
+
+</tr><tr><td rowspan="1" colspan="1"><code>00 3C 00 3F</code></td><td rowspan="1" colspan="1">UTF-16BE or big-endian ISO-10646-UCS-2
+or other encoding with a 16-bit code unit in big-endian order and ASCII characters
+encoded as ASCII values (the encoding declaration must be read to determine
+which)</td></tr><tr><td rowspan="1" colspan="1"><code>3C 00 3F 00</code></td><td rowspan="1" colspan="1">UTF-16LE or little-endian
+ISO-10646-UCS-2 or other encoding with a 16-bit code unit in little-endian
+order and ASCII characters encoded as ASCII values (the encoding declaration
+must be read to determine which)</td></tr><tr><td rowspan="1" colspan="1"><code>3C 3F 78 6D</code></td>
+<td rowspan="1" colspan="1">UTF-8, ISO 646, ASCII, some part of ISO 8859, Shift-JIS, EUC, or any other
+7-bit, 8-bit, or mixed-width encoding which ensures that the characters of
+ASCII have their normal positions, width, and values; the actual encoding
+declaration must be read to detect which of these applies, but since all of
+these encodings use the same bit patterns for the relevant ASCII characters,
+the encoding declaration itself may be read reliably</td></tr><tr><td rowspan="1" colspan="1"><code>4C
+6F A7 94</code></td><td rowspan="1" colspan="1">EBCDIC (in some flavor; the full encoding declaration
+must be read to tell which code page is in use)</td></tr><tr><td rowspan="1" colspan="1">Other</td>
+<td rowspan="1" colspan="1">UTF-8 without an encoding declaration, or else the data stream is mislabeled
+(lacking a required encoding declaration), corrupt, fragmentary, or enclosed
+in a wrapper of some kind</td></tr></tbody></table>
+<div class="note"><p class="prefix"><b>Note:</b></p>
+<p>In cases above which do not require reading the encoding declaration to
+determine the encoding, section 4.3.3 still requires that the encoding declaration,
+if present, be read and that the encoding name be checked to match the actual
+encoding of the entity. Also, it is possible that new character encodings
+will be invented that will make it necessary to use the encoding declaration
+to determine the encoding, in cases where this is not required at present.</p>
+</div>
+<p>This level of autodetection is enough to read the XML encoding declaration
+and parse the character-encoding identifier, which is still necessary to distinguish
+the individual members of each family of encodings (e.g. to tell UTF-8 from
+8859, and the parts of 8859 from each other, or to distinguish the specific
+EBCDIC code page in use, and so on).</p>
+<p>Because the contents of the encoding declaration are restricted to characters from the ASCII repertoire (however encoded),
+a processor can reliably read the entire encoding declaration as soon as it
+has detected which family of encodings is in use. Since in practice, all widely
+used character encodings fall into one of the categories above, the XML encoding
+declaration allows reasonably reliable in-band labeling of character encodings,
+even when external sources of information at the operating-system or transport-protocol
+level are unreliable. Character encodings such as UTF-7
+that make overloaded usage of ASCII-valued bytes may fail to be reliably detected.</p>
+<p>Once the processor has detected the character encoding in use, it can act
+appropriately, whether by invoking a separate input routine for each case,
+or by calling the proper conversion function on each character of input.</p>
+<p>Like any self-labeling system, the XML encoding declaration will not work
+if any software changes the entity's character set or encoding without updating
+the encoding declaration. Implementors of character-encoding routines should
+be careful to ensure the accuracy of the internal and external information
+used to label the entity.</p>
+</div>
+<div class="div2">
+
+<h3><a name="sec-guessing-with-ext-info"></a>F.2 Priorities in the Presence of External Encoding Information</h3>
+<p>The second possible case occurs when the XML entity is accompanied by encoding
+information, as in some file systems and some network protocols. When multiple
+sources of information are available, their relative priority and the preferred
+method of handling conflict should be specified as part of the higher-level
+protocol used to deliver XML. In particular, please refer
+to <a href="#rfc2376">[IETF RFC 2376]</a> or its successor, which defines the <code>text/xml</code>
+and <code>application/xml</code> MIME types and provides some useful guidance.
+In the interests of interoperability, however, the following rule is recommended.</p>
+<ul>
+<li><p>If an XML entity is in a file, the Byte-Order Mark and encoding declaration are used (if present) to determine the character encoding.</p>
+</li>
+</ul>
+
+
+</div>
+</div>
+<div class="div1">
+
+<h2><a name="sec-xml-wg"></a>G W3C XML Working Group (Non-Normative)</h2>
+<p>This specification was prepared and approved for publication by the W3C
+XML Working Group (WG). WG approval of this specification does not necessarily
+imply that all WG members voted for its approval. The current and former members
+of the XML WG are:</p>
+<ul>
+<li>Jon Bosak, Sun (<i>Chair</i>)
+</li>
+<li>James Clark (<i>Technical Lead</i>) </li>
+<li>Tim Bray, Textuality and Netscape
+ (<i>XML Co-editor</i>) </li>
+<li>Jean Paoli, Microsoft (<i>XML
+Co-editor</i>) </li>
+<li>C. M. Sperberg-McQueen, U. of Ill.
+ (<i>XML Co-editor</i>) </li>
+<li>Dan Connolly, W3C (<i>W3C Liaison</i>)
+</li>
+<li>Paula Angerstein, Texcel</li>
+<li>Steve DeRose, INSO</li>
+<li>Dave Hollander, HP</li>
+<li>Eliot Kimber, ISOGEN</li>
+<li>Eve Maler, ArborText</li>
+<li>Tom Magliery, NCSA</li>
+<li>Murray Maloney, SoftQuad, Grif
+SA, Muzmo and Veo Systems</li>
+<li>MURATA Makoto (FAMILY Given), Fuji
+Xerox Information Systems</li>
+<li>Joel Nava, Adobe</li>
+<li>Conleth O'Connell, Vignette
+</li>
+<li>Peter Sharpe, SoftQuad</li>
+<li>John Tigue, DataChannel</li>
+</ul>
+</div>
+<div class="div1">
+
+<h2><a name="sec-core-wg"></a>H W3C XML Core Group (Non-Normative)</h2>
+<p>The second edition of this specification was prepared by the W3C XML Core
+Working Group (WG). The members of the WG at the time of publication of this
+edition were:</p>
+<ul>
+<li>Paula Angerstein, Vignette</li>
+<li>Daniel Austin, Ask Jeeves</li>
+<li>Tim Boland</li>
+<li>Allen Brown, Microsoft</li>
+<li>Dan Connolly, W3C (<i>Staff
+Contact</i>) </li>
+<li>John Cowan, Reuters Limited
+</li>
+<li>John Evdemon, XMLSolutions Corporation
+</li>
+<li>Paul Grosso, Arbortext (<i>Co-Chair</i>)
+</li>
+<li>Arnaud Le Hors, IBM (<i>Co-Chair</i>)
+</li>
+<li>Eve Maler, Sun Microsystems
+ (<i>Second Edition Editor</i>) </li>
+<li>Jonathan Marsh, Microsoft</li>
+<li>MURATA Makoto (FAMILY Given), IBM
+</li>
+<li>Mark Needleman, Data Research Associates
+</li>
+<li>David Orchard, Jamcracker</li>
+<li>Lew Shannon, NCR</li>
+<li>Richard Tobin, University of Edinburgh
+</li>
+<li>Daniel Veillard, W3C</li>
+<li>Dan Vint, Lexica</li>
+<li>Norman Walsh, Sun Microsystems
+</li>
+<li>François Yergeau, Alis Technologies
+ (<i>Errata List Editor</i>) </li>
+<li>Kongyi Zhou, Oracle</li>
+</ul>
+</div>
+<div class="div1">
+
+<h2><a name="id2683713"></a>I Production Notes (Non-Normative)</h2>
+<p>This Second Edition was encoded in the <a href="http://www.w3.org/XML/1998/06/xmlspec-v21.dtd">XMLspec
+DTD</a> (which has <a href="http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm">documentation</a>
+available). The HTML versions were produced with a combination of the <a href="http://www.w3.org/XML/1998/06/xmlspec.xsl">xmlspec.xsl</a>, <a href="http://www.w3.org/XML/1998/06/diffspec.xsl">diffspec.xsl</a>,
+and <a href="http://www.w3.org/XML/1998/06/REC-xml-2e.xsl">REC-xml-2e.xsl</a>
+XSLT stylesheets. The PDF version was produced with the <a href="http://www.tdb.uu.se/~jan/html2ps.html">html2ps</a>
+facility and a distiller program.</p>
+</div>
+</div></body></html>
diff --git a/libxslt/tests/xmlspec/REC-xml-20001006.xml b/libxslt/tests/xmlspec/REC-xml-20001006.xml
new file mode 100644
index 0000000..96a2ee8
--- /dev/null
+++ b/libxslt/tests/xmlspec/REC-xml-20001006.xml
@@ -0,0 +1,3277 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification V2.1//EN"
+ "xmlspec-v21.dtd" [
+<!--ArborText, Inc., 1988-2000, v.4002-->
+<!ENTITY http-ident "http://www.w3.org/TR/2000/REC-xml">
+<!ENTITY draft.month "October">
+<!ENTITY draft.day "6">
+<!ENTITY iso6.doc.date "20001006">
+<!ENTITY draft.year "2000">
+<!ENTITY versionOfXML "1.0">
+<!ENTITY pio "'&lt;?xml'">
+<!ENTITY doc.date "10 February 1998">
+<!ENTITY w3c.doc.date "02-Feb-1998">
+<!ENTITY WebSGML "WebSGML Adaptations Annex to ISO 8879">
+<!ENTITY pic "'?>'">
+<!ENTITY br "\n">
+<!ENTITY cellback "#c0d9c0">
+<!ENTITY mdash "--">
+<!ENTITY com "--">
+<!ENTITY como "--">
+<!ENTITY comc "--">
+<!ENTITY hcro "&amp;#x">
+<!ENTITY nbsp "&#160;">
+<!ENTITY magicents "<code>amp</code>,
+<code>lt</code>,
+<code>gt</code>,
+<code>apos</code>,
+<code>quot</code>">
+<!ENTITY doc.audience "public review and discussion">
+<!ENTITY doc.distribution "may be distributed freely, as long as
+all text and legal notices remain intact">
+]>
+<spec w3c-doctype="rec">
+<!--
+Notes on preparation of the Second Edition:
+
+- Worked from http://www.w3.org/XML/xml-19980210-errata.
+- Changed DTD reference to point to V2.1 of XMLspec.
+- Moved version number from <title> to <version> element and
+ added "second edition" wording. Mentioned edition information
+ in status.
+- Removed bgcolor="&cellback;" attributes from all <td>
+ elements because that attribute is not in the current table model.
+- Reversed status and abstract, so that abstract is first, according
+ to W3C guidelines.
+- Changed some <emph>s to <titleref>s in bibliography.
+- Changed some <code>s to <at> etc. throughout; where used <attval>,
+ removed existing <quote>s because the stylesheet produces them.
+- Removed some spurious spaces.
+- Added affiliation markup to the original member list.
+- Added commas between individual <thisver> elements, because
+ whitespace is now significant there.
+- Moved <eg>s, <scrap>s, and lists outside of <p>s for cleaner HTML
+ conversion.
+- Revised Status section to reflect new status.
+- Fixed all titleref hrefs so they get transformed properly; at
+ next revision, these all probably need to be changed to some
+ other markup.
+- Incorporated all errata (barring obsoleted and invalid ones);
+ added links to the errata document with <loc role="erratumref">
+ elements; used diff="{add|chg|del}" attribute. This version
+ expects that the official HTML output will have diff="del"
+ elements suppressed.
+-->
+<header>
+<title>Extensible Markup Language (XML)</title>
+<version>1.0 (Second Edition)</version>
+<w3c-designation>REC-xml-&iso6.doc.date;</w3c-designation>
+<w3c-doctype>W3C Recommendation</w3c-doctype>
+<pubdate><day>&draft.day;</day><month>&draft.month;</month><year>&draft.year;</year>
+</pubdate>
+<publoc><loc href="&http-ident;-&iso6.doc.date;">&http-ident;-&iso6.doc.date;</loc>
+(<loc href="&http-ident;-&iso6.doc.date;.html">XHTML</loc>, <loc href="&http-ident;-&iso6.doc.date;.xml">XML</loc>, <loc
+href="&http-ident;-&iso6.doc.date;.pdf">PDF</loc>, <loc href="&http-ident;-&iso6.doc.date;-review.html">XHTML
+review version</loc> with color-coded revision indicators)</publoc>
+<latestloc><loc href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</loc></latestloc>
+<prevlocs><loc href="http://www.w3.org/TR/2000/WD-xml-2e-20000814"> http://www.w3.org/TR/2000/WD-xml-2e-20000814</loc>
+<loc href="http://www.w3.org/TR/1998/REC-xml-19980210"> http://www.w3.org/TR/1998/REC-xml-19980210</loc><!--
+<loc href='http://www.w3.org/TR/PR-xml-971208'>
+http://www.w3.org/TR/PR-xml-971208</loc>
+<loc href='http://www.w3.org/TR/WD-xml-961114'>
+http://www.w3.org/TR/WD-xml-961114</loc>
+<loc href='http://www.w3.org/TR/WD-xml-lang-970331'>
+http://www.w3.org/TR/WD-xml-lang-970331</loc>
+<loc href='http://www.w3.org/TR/WD-xml-lang-970630'>
+http://www.w3.org/TR/WD-xml-lang-970630</loc>
+<loc href='http://www.w3.org/TR/WD-xml-970807'>
+http://www.w3.org/TR/WD-xml-970807</loc>
+<loc href='http://www.w3.org/TR/WD-xml-971117'>
+http://www.w3.org/TR/WD-xml-971117</loc>--> </prevlocs>
+<authlist>
+<author role="1e"><name>Tim Bray</name><affiliation>Textuality and Netscape</affiliation>
+<email href="mailto:tbray@textuality.com">tbray@textuality.com</email></author>
+<author role="1e"><name>Jean Paoli</name><affiliation>Microsoft</affiliation>
+<email href="mailto:jeanpa@microsoft.com">jeanpa@microsoft.com</email></author>
+<author role="1e" diff="chg"><name>C. M. Sperberg-McQueen</name><affiliation>University
+of Illinois at Chicago and Text Encoding Initiative</affiliation><email href="mailto:cmsmcq@uic.edu">cmsmcq@uic.edu</email>
+</author>
+<author role="2e" diff="add"><name>Eve Maler</name><affiliation>Sun Microsystems,
+Inc.</affiliation><email href="mailto:elm@east.sun.com">eve.maler@east.sun.com</email>
+</author>
+</authlist>
+<abstract>
+<p>The Extensible Markup Language (XML) is a subset of SGML that is completely
+described in this document. Its goal is to enable generic SGML to be served,
+received, and processed on the Web in the way that is now possible with HTML.
+XML has been designed for ease of implementation and for interoperability
+with both SGML and HTML.</p>
+</abstract>
+<status>
+<p>This document has been reviewed by W3C Members and other interested parties
+and has been endorsed by the Director as a W3C Recommendation. It is a stable
+document and may be used as reference material or cited as a normative reference
+from another document. W3C's role in making the Recommendation is to draw
+attention to the specification and to promote its widespread deployment. This
+enhances the functionality and interoperability of the Web.</p>
+<p>This document specifies a syntax created by subsetting an existing, widely
+used international text processing standard (Standard Generalized Markup Language,
+ISO 8879:1986(E) as amended and corrected) for use on the World Wide Web.
+It is a product of the W3C XML Activity, details of which can be found at <loc
+href="http://www.w3.org/XML/">http://www.w3.org/XML</loc>. <phrase diff="add"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E100">[E100]</loc>
+The English version of this specification is the only normative version. However,
+for translations of this document, see <loc href="http://www.w3.org/XML/#trans">http://www.w3.org/XML/#trans</loc>. </phrase>A
+list of current W3C Recommendations and other technical documents can be found
+at <loc href="http://www.w3.org/TR/">http://www.w3.org/TR</loc>.</p>
+<p diff="del"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E66">[E66]</loc>This
+specification uses the term URI, which is defined by <bibref ref="Berners-Lee"/>,
+a work in progress expected to update <bibref ref="RFC1738"/> and <bibref
+ref="RFC1808"/>.</p>
+<p diff="add">This second edition is <emph>not</emph> a new version of XML (first published 10 February 1998);
+it merely incorporates the changes dictated by the first-edition errata (available
+at <loc href="http://www.w3.org/XML/xml-19980210-errata">http://www.w3.org/XML/xml-19980210-errata</loc>)
+as a convenience to readers. The errata list for this second edition is available
+at <loc href="http://www.w3.org/XML/xml-V10-2e-errata">http://www.w3.org/XML/xml-V10-2e-errata</loc>.</p>
+<p>Please report errors in this document to <loc href="mailto:xml-editor@w3.org">xml-editor@w3.org</loc><phrase
+diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E101">[E101]</loc>; <loc
+href="http://lists.w3.org/Archives/Public/xml-editor">archives</loc> are available</phrase>.</p>
+<note diff="add">
+<p>C. M. Sperberg-McQueen's affiliation has changed since the publication
+of the first edition. He is now at the World Wide Web Consortium, and can
+be contacted at <loc href="mailto:cmsmcq@w3.org">cmsmcq@w3.org</loc>.</p>
+</note>
+</status>
+<pubstmt>
+<p>Chicago, Vancouver, Mountain View, et al.: World-Wide Web Consortium, XML
+Working Group, 1996, 1997, 2000.</p>
+</pubstmt>
+<sourcedesc>
+<p>Created in electronic form.</p>
+</sourcedesc>
+<langusage>
+<language id="EN">English</language>
+<language id="ebnf">Extended Backus-Naur Form (formal grammar)</language>
+</langusage>
+<revisiondesc>
+<slist>
+<sitem>1997-12-03 : CMSMcQ : yet further changes</sitem>
+<sitem>1997-12-02 : TB : further changes (see TB to XML WG, 2 December 1997)</sitem>
+<sitem>1997-12-02 : CMSMcQ : deal with as many corrections and comments from
+the proofreaders as possible: entify hard-coded document date in pubdate element,
+change expansion of entity WebSGML, update status description as per Dan Connolly
+(am not sure about refernece to Berners-Lee et al.), add 'The' to abstract
+as per WG decision, move Relationship to Existing Standards to back matter
+and combine with References, re-order back matter so normative appendices
+come first, re-tag back matter so informative appendices are tagged informdiv1,
+remove XXX XXX from list of 'normative' specs in prose, move some references
+from Other References to Normative References, add RFC 1738, 1808, and 2141
+to Other References (they are not normative since we do not require the processor
+to enforce any rules based on them), add reference to 'Fielding draft' (Berners-Lee
+et al.), move notation section to end of body, drop URIchar non-terminal and
+use SkipLit instead, lose stray reference to defunct nonterminal 'markupdecls',
+move reference to Aho et al. into appendix (Tim's right), add prose note saying
+that hash marks and fragment identifiers are NOT part of the URI formally
+speaking, and are NOT legal in system identifiers (processor 'may' signal
+an error). Work through: Tim Bray reacting to James Clark, Tim Bray on his
+own, Eve Maler, NOT DONE YET: change binary / text to unparsed / parsed. handle
+James's suggestion about &lt; in attriubte values uppercase hex characters,
+namechar list, </sitem>
+<sitem>1997-12-01 : JB : add some column-width parameters</sitem>
+<sitem>1997-12-01 : CMSMcQ : begin round of changes to incorporate recent
+WG decisions and other corrections: binding sources of character encoding
+info (27 Aug / 3 Sept), correct wording of Faust quotation (restore dropped
+line), drop SDD from EncodingDecl, change text at version number 1.0, drop
+misleading (wrong!) sentence about ignorables and extenders, modify definition
+of PCData to make bar on msc grammatical, change grammar's handling of internal
+subset (drop non-terminal markupdecls), change definition of includeSect to
+allow conditional sections, add integral-declaration constraint on internal
+subset, drop misleading / dangerous sentence about relationship of entities
+with system storage objects, change table body tag to htbody as per EM change
+to DTD, add rule about space normalization in public identifiers, add description
+of how to generate our name-space rules from Unicode character database (needs
+further work!). </sitem>
+<sitem>1997-10-08 : TB : Removed %-constructs again, new rules for PE appearance.</sitem>
+<sitem>1997-10-01 : TB : Case-sensitive markup; cleaned up element-type defs,
+lotsa little edits for style</sitem>
+<sitem>1997-09-25 : TB : Change to elm's new DTD, with substantial detail
+cleanup as a side-effect</sitem>
+<sitem>1997-07-24 : CMSMcQ : correct error (lost *) in definition of ignoreSectContents
+(thanks to Makoto Murata)</sitem>
+<sitem>Allow all empty elements to have end-tags, consistent with SGML TC
+(as per JJC).</sitem>
+<sitem>1997-07-23 : CMSMcQ : pre-emptive strike on pending corrections: introduce
+the term 'empty-element tag', note that all empty elements may use it, and
+elements declared EMPTY must use it. Add WFC requiring encoding decl to come
+first in an entity. Redefine notations to point to PIs as well as binary entities.
+Change autodetection table by removing bytes 3 and 4 from examples with Byte
+Order Mark. Add content model as a term and clarify that it applies to both
+mixed and element content. </sitem>
+<sitem>1997-06-30 : CMSMcQ : change date, some cosmetic changes, changes to
+productions for choice, seq, Mixed, NotationType, Enumeration. Follow James
+Clark's suggestion and prohibit conditional sections in internal subset. TO
+DO: simplify production for ignored sections as a result, since we don't need
+to worry about parsers which don't expand PErefs finding a conditional section.</sitem>
+<sitem>1997-06-29 : TB : various edits</sitem>
+<sitem>1997-06-29 : CMSMcQ : further changes: Suppress old FINAL EDIT comments
+and some dead material. Revise occurrences of % in grammar to exploit Henry
+Thompson's pun, especially markupdecl and attdef. Remove RMD requirement relating
+to element content (?). </sitem>
+<sitem>1997-06-28 : CMSMcQ : Various changes for 1 July draft: Add text for
+draconian error handling (introduce the term Fatal Error). RE deleta est (changing
+wording from original announcement to restrict the requirement to validating
+parsers). Tag definition of validating processor and link to it. Add colon
+as name character. Change def of %operator. Change standard definitions of
+lt, gt, amp. Strip leading zeros from #x00nn forms.</sitem>
+<sitem>1997-04-02 : CMSMcQ : final corrections of editorial errors found in
+last night's proofreading. Reverse course once more on well-formed: Webster's
+Second hyphenates it, and that's enough for me.</sitem>
+<sitem>1997-04-01 : CMSMcQ : corrections from JJC, EM, HT, and self</sitem>
+<sitem>1997-03-31 : Tim Bray : many changes</sitem>
+<sitem>1997-03-29 : CMSMcQ : some Henry Thompson (on entity handling), some
+Charles Goldfarb, some ERB decisions (PE handling in miscellaneous declarations.
+Changed Ident element to accept def attribute. Allow normalization of Unicode
+characters. move def of systemliteral into section on literals.</sitem>
+<sitem>1997-03-28 : CMSMcQ : make as many corrections as possible, from Terry
+Allen, Norbert Mikula, James Clark, Jon Bosak, Henry Thompson, Paul Grosso,
+and self. Among other things: give in on "well formed" (Terry is right), tentatively
+rename QuotedCData as AttValue and Literal as EntityValue to be more informative,
+since attribute values are the <emph>only</emph> place QuotedCData was used,
+and vice versa for entity text and Literal. (I'd call it Entity Text, but
+8879 uses that name for both internal and external entities.)</sitem>
+<sitem>1997-03-26 : CMSMcQ : resynch the two forks of this draft, reapply
+my changes dated 03-20 and 03-21. Normalize old 'may not' to 'must not' except
+in the one case where it meant 'may or may not'.</sitem>
+<sitem>1997-03-21 : TB : massive changes on plane flight from Chicago to Vancouver</sitem>
+<sitem>1997-03-21 : CMSMcQ : correct as many reported errors as possible. </sitem>
+<sitem>1997-03-20 : CMSMcQ : correct typos listed in CMSMcQ hand copy of spec.</sitem>
+<sitem>1997-03-20 : CMSMcQ : cosmetic changes preparatory to revision for
+WWW conference April 1997: restore some of the internal entity references
+(e.g. to docdate, etc.), change character xA0 to &amp;nbsp; and define nbsp
+as &amp;#160;, and refill a lot of paragraphs for legibility.</sitem>
+<sitem>1996-11-12 : CMSMcQ : revise using Tim's edits: Add list type of NUMBERED
+and change most lists either to BULLETS or to NUMBERED. Suppress QuotedNames,
+Names (not used). Correct trivial-grammar doc type decl. Rename 'marked section'
+as 'CDATA section' passim. Also edits from James Clark: Define the set of
+characters from which [^abc] subtracts. Charref should use just [0-9] not
+Digit. Location info needs cleaner treatment: remove? (ERB question). One
+example of a PI has wrong pic. Clarify discussion of encoding names. Encoding
+failure should lead to unspecified results; don't prescribe error recovery.
+Don't require exposure of entity boundaries. Ignore white space in element
+content. Reserve entity names of the form u-NNNN. Clarify relative URLs. And
+some of my own: Correct productions for content model: model cannot consist
+of a name, so "elements ::= cp" is no good. </sitem>
+<sitem>1996-11-11 : CMSMcQ : revise for style. Add new rhs to entity declaration,
+for parameter entities.</sitem>
+<sitem>1996-11-10 : CMSMcQ : revise for style. Fix / complete section on names,
+characters. Add sections on parameter entities, conditional sections. Still
+to do: Add compatibility note on deterministic content models. Finish stylistic
+revision.</sitem>
+<sitem>1996-10-31 : TB : Add Entity Handling section</sitem>
+<sitem>1996-10-30 : TB : Clean up term &amp; termdef. Slip in ERB decision
+re EMPTY.</sitem>
+<sitem>1996-10-28 : TB : Change DTD. Implement some of Michael's suggestions.
+Change comments back to //. Introduce language for XML namespace reservation.
+Add section on white-space handling. Lots more cleanup.</sitem>
+<sitem>1996-10-24 : CMSMcQ : quick tweaks, implement some ERB decisions. Characters
+are not integers. Comments are /* */ not //. Add bibliographic refs to 10646,
+HyTime, Unicode. Rename old Cdata as MsData since it's <emph>only</emph> seen
+in marked sections. Call them attribute-value pairs not name-value pairs,
+except once. Internal subset is optional, needs '?'. Implied attributes should
+be signaled to the app, not have values supplied by processor.</sitem>
+<sitem>1996-10-16 : TB : track down &amp; excise all DSD references; introduce
+some EBNF for entity declarations.</sitem>
+<sitem>1996-10-?? : TB : consistency check, fix up scraps so they all parse,
+get formatter working, correct a few productions.</sitem>
+<sitem>1996-10-10/11 : CMSMcQ : various maintenance, stylistic, and organizational
+changes: Replace a few literals with xmlpio and pic entities, to make them
+consistent and ensure we can change pic reliably when the ERB votes. Drop
+paragraph on recognizers from notation section. Add match, exact match to
+terminology. Move old 2.2 XML Processors and Apps into intro. Mention comments,
+PIs, and marked sections in discussion of delimiter escaping. Streamline discussion
+of doctype decl syntax. Drop old section of 'PI syntax' for doctype decl,
+and add section on partial-DTD summary PIs to end of Logical Structures section.
+Revise DSD syntax section to use Tim's subset-in-a-PI mechanism.</sitem>
+<sitem>1996-10-10 : TB : eliminate name recognizers (and more?)</sitem>
+<sitem>1996-10-09 : CMSMcQ : revise for style, consistency through 2.3 (Characters)</sitem>
+<sitem>1996-10-09 : CMSMcQ : re-unite everything for convenience, at least
+temporarily, and revise quickly</sitem>
+<sitem>1996-10-08 : TB : first major homogenization pass</sitem>
+<sitem>1996-10-08 : TB : turn "current" attribute on div type into CDATA</sitem>
+<sitem>1996-10-02 : TB : remould into skeleton + entities</sitem>
+<sitem>1996-09-30 : CMSMcQ : add a few more sections prior to exchange with
+Tim.</sitem>
+<sitem>1996-09-20 : CMSMcQ : finish transcribing notes.</sitem>
+<sitem>1996-09-19 : CMSMcQ : begin transcribing notes for draft.</sitem>
+<sitem>1996-09-13 : CMSMcQ : made outline from notes of 09-06, do some housekeeping</sitem>
+</slist>
+</revisiondesc>
+</header>
+<body>
+<div1 id="sec-intro">
+<head>Introduction</head>
+<p>Extensible Markup Language, abbreviated XML, describes a class of data
+objects called <termref def="dt-xml-doc">XML documents</termref> and partially
+describes the behavior of computer programs which process them. XML is an
+application profile or restricted form of SGML, the Standard Generalized Markup
+Language <bibref ref="ISO8879"/>. By construction, XML documents are conforming
+SGML documents.</p>
+<p>XML documents are made up of storage units called <termref def="dt-entity">entities</termref>,
+which contain either parsed or unparsed data. Parsed data is made up of <termref
+def="dt-character">characters</termref>, some of which form <termref def="dt-chardata">character
+data</termref>, and some of which form <termref def="dt-markup">markup</termref>.
+Markup encodes a description of the document's storage layout and logical
+structure. XML provides a mechanism to impose constraints on the storage layout
+and logical structure.</p>
+<p><termdef id="dt-xml-proc" term="XML Processor">A software module called
+an <term>XML processor</term> is used to read XML documents and provide access
+to their content and structure.</termdef> <termdef id="dt-app" term="Application">It
+is assumed that an XML processor is doing its work on behalf of another module,
+called the <term>application</term>.</termdef> This specification describes
+the required behavior of an XML processor in terms of how it must read XML
+data and the information it must provide to the application.</p>
+<div2 id="sec-origin-goals">
+<head>Origin and Goals</head>
+<p>XML was developed by an XML Working Group (originally known as the SGML
+Editorial Review Board) formed under the auspices of the World Wide Web Consortium
+(W3C) in 1996. It was chaired by Jon Bosak of Sun Microsystems with the active
+participation of an XML Special Interest Group (previously known as the SGML
+Working Group) also organized by the W3C. The membership of the XML Working
+Group is given in an appendix. Dan Connolly served as the WG's contact with
+the W3C.</p>
+<p>The design goals for XML are:</p>
+<olist>
+<item><p>XML shall be straightforwardly usable over the Internet.</p></item>
+<item><p>XML shall support a wide variety of applications.</p></item>
+<item><p>XML shall be compatible with SGML.</p></item>
+<item><p>It shall be easy to write programs which process XML documents.</p>
+</item>
+<item><p>The number of optional features in XML is to be kept to the absolute
+minimum, ideally zero.</p></item>
+<item><p>XML documents should be human-legible and reasonably clear.</p></item>
+<item><p>The XML design should be prepared quickly.</p></item>
+<item><p>The design of XML shall be formal and concise.</p></item>
+<item><p>XML documents shall be easy to create.</p></item>
+<item><p>Terseness in XML markup is of minimal importance.</p></item>
+</olist>
+<p>This specification, together with associated standards (Unicode and ISO/IEC
+10646 for characters, Internet RFC 1766 for language identification tags,
+ISO 639 for language name codes, and ISO 3166 for country name codes), provides
+all the information necessary to understand XML Version &versionOfXML; and
+construct computer programs to process it.</p>
+<p>This version of the XML specification <!-- is for &doc.audience;.--> &doc.distribution;.</p>
+</div2>
+<div2 id="sec-terminology">
+<head>Terminology</head>
+<p>The terminology used to describe XML documents is defined in the body of
+this specification. The terms defined in the following list are used in building
+those definitions and in describing the actions of an XML processor: <glist>
+<gitem><label>may</label>
+<def>
+<p><termdef id="dt-may" term="May">Conforming documents and XML processors
+are permitted to but need not behave as described.</termdef></p>
+</def></gitem>
+<gitem><label>must</label>
+<def>
+<p><termdef id="dt-must" term="Must">Conforming documents and XML processors
+are required to behave as described; otherwise they are in error. <!-- do NOT change this! this is what defines a violation of
+a 'must' clause as 'an error'. -MSM --></termdef></p>
+</def></gitem>
+<gitem><label>error</label>
+<def>
+<p><termdef id="dt-error" term="Error">A violation of the rules of this specification;
+results are undefined. Conforming software may detect and report an error
+and may recover from it.</termdef></p>
+</def></gitem>
+<gitem><label>fatal error</label>
+<def>
+<p><termdef id="dt-fatal" term="Fatal Error">An error which a conforming <termref
+def="dt-xml-proc">XML processor</termref> must detect and report to the application.
+After encountering a fatal error, the processor may continue processing the
+data to search for further errors and may report such errors to the application.
+In order to support correction of errors, the processor may make unprocessed
+data from the document (with intermingled character data and markup) available
+to the application. Once a fatal error is detected, however, the processor
+must not continue normal processing (i.e., it must not continue to pass character
+data and information about the document's logical structure to the application
+in the normal way).</termdef></p>
+</def></gitem>
+<gitem><label>at user option</label>
+<def>
+<p><termdef id="dt-atuseroption" term="At user option">Conforming software
+may or must (depending on the modal verb in the sentence) behave as described;
+if it does, it must provide users a means to enable or disable the behavior
+described.</termdef></p>
+</def></gitem>
+<gitem><label>validity constraint</label>
+<def>
+<p><termdef id="dt-vc" term="Validity constraint">A rule which applies to
+all <termref def="dt-valid">valid</termref> XML documents. Violations of validity
+constraints are errors; they must, at user option, be reported by <termref
+def="dt-validating">validating XML processors</termref>.</termdef></p>
+</def></gitem>
+<gitem><label>well-formedness constraint</label>
+<def>
+<p><termdef id="dt-wfc" term="Well-formedness constraint">A rule which applies
+to all <termref def="dt-wellformed">well-formed</termref> XML documents. Violations
+of well-formedness constraints are <termref def="dt-fatal">fatal errors</termref>.</termdef></p>
+</def></gitem>
+<gitem><label>match</label>
+<def>
+<p><termdef id="dt-match" term="match">(Of strings or names:) Two strings
+or names being compared must be identical. Characters with multiple possible
+representations in ISO/IEC 10646 (e.g. characters with both precomposed and
+base+diacritic forms) match only if they have the same representation in both
+strings. <phrase diff="del"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E85">[E85]</loc>At
+user option, processors may normalize such characters to some canonical form. </phrase>No
+case folding is performed. (Of strings and rules in the grammar:) A string
+matches a grammatical production if it belongs to the language generated by
+that production. (Of content and content models:) An element matches its declaration
+when it conforms in the fashion described in the constraint <specref ref="elementvalid"/>.</termdef></p>
+</def></gitem>
+<gitem><label>for compatibility</label>
+<def>
+<p><termdef id="dt-compat" term="For Compatibility"><phrase diff="add"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E87">[E87]</loc>Marks
+a sentence describing</phrase> a feature of XML included solely to ensure
+that XML remains compatible with SGML.</termdef></p>
+</def></gitem>
+<gitem><label>for interoperability</label>
+<def>
+<p><termdef id="dt-interop" term="For interoperability"><phrase diff="add"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E87">[E87]</loc>Marks
+a sentence describing</phrase> a non-binding recommendation included to increase
+the chances that XML documents can be processed by the existing installed
+base of SGML processors which predate the &WebSGML;.</termdef></p>
+</def></gitem>
+</glist></p>
+</div2>
+</div1>
+<!-- &Docs; -->
+<div1 id="sec-documents">
+<head>Documents</head>
+<p><termdef id="dt-xml-doc" term="XML Document"> A data object is an <term>XML
+document</term> if it is <termref def="dt-wellformed">well-formed</termref>,
+as defined in this specification. A well-formed XML document may in addition
+be <termref def="dt-valid">valid</termref> if it meets certain further constraints.</termdef></p>
+<p>Each XML document has both a logical and a physical structure. Physically,
+the document is composed of units called <termref def="dt-entity">entities</termref>.
+An entity may <termref def="dt-entref">refer</termref> to other entities to
+cause their inclusion in the document. A document begins in a <quote>root</quote>
+or <termref def="dt-docent">document entity</termref>. Logically, the document
+is composed of declarations, elements, comments, character references, and
+processing instructions, all of which are indicated in the document by explicit
+markup. The logical and physical structures must nest properly, as described
+in <specref ref="wf-entities"/>.</p>
+<div2 id="sec-well-formed">
+<head>Well-Formed XML Documents</head>
+<p><termdef id="dt-wellformed" term="Well-Formed"> A textual object is a <term>well-formed</term>
+XML document if:</termdef></p>
+<olist>
+<item><p>Taken as a whole, it matches the production labeled <nt def="NT-document">document</nt>.</p>
+</item>
+<item><p>It meets all the well-formedness constraints given in this specification.</p>
+</item>
+<item><p>Each of the <termref def="dt-parsedent">parsed entities</termref>
+which is referenced directly or indirectly within the document is <termref
+def="dt-wellformed">well-formed</termref>.</p></item>
+</olist>
+<scrap id="document" lang="ebnf">
+<head>Document</head>
+<prod id="NT-document">
+<lhs>document</lhs><rhs><nt def="NT-prolog">prolog</nt> <nt def="NT-element">element</nt> <nt
+def="NT-Misc">Misc</nt>*</rhs>
+</prod>
+</scrap>
+<p>Matching the <nt def="NT-document">document</nt> production implies that:</p>
+<olist>
+<item><p>It contains one or more <termref def="dt-element">elements</termref>.</p>
+</item>
+<!--* N.B. some readers (notably JC) find the following
+paragraph awkward and redundant. I agree it's logically redundant:
+it *says* it is summarizing the logical implications of
+matching the grammar, and that means by definition it's
+logically redundant. I don't think it's rhetorically
+redundant or unnecessary, though, so I'm keeping it. It
+could however use some recasting when the editors are feeling
+stronger. -MSM *-->
+<item><p><termdef id="dt-root" term="Root Element">There is exactly one element,
+called the <term>root</term>, or document element, no part of which appears
+in the <termref def="dt-content">content</termref> of any other element.</termdef> <phrase
+diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E17">[E17]</loc>For
+all other elements, if the <termref def="dt-stag">start-tag</termref> is in
+the content of another element, the <termref def="dt-etag">end-tag</termref>
+is in the content of the same element.</phrase> More simply stated, the elements,
+delimited by start- and end-tags, nest properly within each other.</p></item>
+</olist>
+<p><termdef id="dt-parentchild" term="Parent/Child">As a consequence of this,
+for each non-root element <el>C</el> in the document, there is one other element <el>P</el>
+in the document such that <el>C</el> is in the content of <el>P</el>, but
+is not in the content of any other element that is in the content of <el>P</el>. <el>P</el>
+is referred to as the <term>parent</term> of <el>C</el>, and <el>C</el> as
+a <term>child</term> of <el>P</el>.</termdef></p>
+</div2>
+<div2 id="charsets">
+<head>Characters</head>
+<p><termdef id="dt-text" term="Text">A parsed entity contains <term>text</term>,
+a sequence of <termref def="dt-character">characters</termref>, which may
+represent markup or character data.</termdef> <termdef id="dt-character" term="Character">A <term>character</term>
+is an atomic unit of text as specified by ISO/IEC 10646 <bibref ref="ISO10646"/> <phrase
+diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</loc>(see
+also <bibref ref="ISO10646-2000"/>)</phrase>. Legal characters are tab, carriage
+return, line feed, and the legal <phrase diff="del"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E35">[E35]</loc>graphic </phrase>characters
+of Unicode and ISO/IEC 10646. <phrase diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E69">[E69]</loc>The
+versions of these standards cited in <specref ref="sec-existing-stds"/> were
+current at the time this document was prepared. New characters may be added
+to these standards by amendments or new editions. Consequently, XML processors
+must accept any character in the range specified for <nt def="NT-Char">Char</nt>.</phrase>
+The use of <quote>compatibility characters</quote>, as defined in section
+6.8 of <bibref ref="Unicode"/> <phrase diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</loc>(see
+also D21 in section 3.6 of <bibref ref="Unicode3"/>)</phrase>, is discouraged.</termdef></p>
+<scrap id="char32" lang="ebnf">
+<head>Character Range</head>
+<prodgroup pcw2="4" pcw4="17.5" pcw5="11">
+<prod id="NT-Char">
+<lhs>Char</lhs><rhs>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]</rhs>
+<com>any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.</com>
+</prod>
+</prodgroup></scrap>
+<p>The mechanism for encoding character code points into bit patterns may
+vary from entity to entity. All XML processors must accept the UTF-8 and UTF-16
+encodings of 10646; the mechanisms for signaling which of the two is in use,
+or for bringing other encodings into play, are discussed later, in <specref
+ref="charencoding"/>.</p>
+<!--
+<p>Regardless of the specific encoding used, any character in
+the ISO/IEC 10646 character set may be referred to by the decimal
+or hexadecimal equivalent of its UCS-4 code value.
+</p>-->
+</div2>
+<div2 id="sec-common-syn">
+<head>Common Syntactic Constructs</head>
+<p>This section defines some symbols used widely in the grammar.</p>
+<p><nt def="NT-S">S</nt> (white space) consists of one or more space (#x20)
+characters, carriage returns, line feeds, or tabs.</p>
+<scrap id="white" lang="ebnf">
+<head>White Space</head>
+<prodgroup pcw2="4" pcw4="17.5" pcw5="11">
+<prod id="NT-S">
+<lhs>S</lhs><rhs>(#x20 | #x9 | #xD | #xA)+</rhs>
+</prod>
+</prodgroup></scrap>
+<p>Characters are classified for convenience as letters, digits, or other
+characters. <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E30">[E30]</loc>A
+letter consists of an alphabetic or syllabic base character or an ideographic
+character.</phrase> Full definitions of the specific characters in each class
+are given in <specref ref="CharClasses"/>.</p>
+<p><termdef id="dt-name" term="Name">A <term>Name</term> is a token beginning
+with a letter or one of a few punctuation characters, and continuing with
+letters, digits, hyphens, underscores, colons, or full stops, together known
+as name characters.</termdef> Names beginning with the string <quote><code>xml</code></quote>,
+or any string which would match <code>(('X'|'x') ('M'|'m') ('L'|'l'))</code>,
+are reserved for standardization in this or future versions of this specification.</p>
+<note>
+<p diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E98">[E98]</loc>The
+Namespaces in XML Recommendation <bibref ref="xml-names"/> assigns a meaning
+to names containing colon characters. Therefore, authors should not use the
+colon in XML names except for namespace purposes, but XML processors must
+accept the colon as a name character.</p>
+</note>
+<p>An <nt def="NT-Nmtoken">Nmtoken</nt> (name token) is any mixture of name
+characters.</p>
+<scrap lang="ebnf">
+<head>Names and Tokens</head>
+<prod id="NT-NameChar">
+<lhs>NameChar</lhs><rhs><nt def="NT-Letter">Letter</nt> | <nt def="NT-Digit">Digit</nt>
+| '.' | '-' | '_' | ':' | <nt def="NT-CombiningChar">CombiningChar</nt> | <nt
+def="NT-Extender">Extender</nt></rhs>
+</prod>
+<prod id="NT-Name">
+<lhs>Name</lhs><rhs>(<nt def="NT-Letter">Letter</nt> | '_' | ':') (<nt def="NT-NameChar">NameChar</nt>)*</rhs>
+</prod>
+<prod id="NT-Names">
+<lhs>Names</lhs><rhs><nt def="NT-Name">Name</nt> (<nt def="NT-S">S</nt> <nt
+def="NT-Name">Name</nt>)*</rhs>
+</prod>
+<prod id="NT-Nmtoken">
+<lhs>Nmtoken</lhs><rhs>(<nt def="NT-NameChar">NameChar</nt>)+</rhs>
+</prod>
+<prod id="NT-Nmtokens">
+<lhs>Nmtokens</lhs><rhs><nt def="NT-Nmtoken">Nmtoken</nt> (<nt def="NT-S">S</nt> <nt
+def="NT-Nmtoken">Nmtoken</nt>)*</rhs>
+</prod>
+</scrap>
+<p>Literal data is any quoted string not containing the quotation mark used
+as a delimiter for that string. Literals are used for specifying the content
+of internal entities (<nt def="NT-EntityValue">EntityValue</nt>), the values
+of attributes (<nt def="NT-AttValue">AttValue</nt>), and external identifiers
+(<nt def="NT-SystemLiteral">SystemLiteral</nt>). Note that a <nt def="NT-SystemLiteral">SystemLiteral</nt>
+can be parsed without scanning for markup.</p>
+<scrap lang="ebnf">
+<head>Literals</head>
+<prod id="NT-EntityValue">
+<lhs>EntityValue</lhs><rhs>'"' ([^%&amp;"] | <nt def="NT-PEReference">PEReference</nt>
+| <nt def="NT-Reference">Reference</nt>)* '"' </rhs>
+<rhs>|&nbsp; "'" ([^%&amp;'] | <nt def="NT-PEReference">PEReference</nt> | <nt
+def="NT-Reference">Reference</nt>)* "'"</rhs>
+</prod>
+<prod id="NT-AttValue">
+<lhs>AttValue</lhs><rhs>'"' ([^&lt;&amp;"] | <nt def="NT-Reference">Reference</nt>)*
+'"' </rhs>
+<rhs>|&nbsp; "'" ([^&lt;&amp;'] | <nt def="NT-Reference">Reference</nt>)*
+"'"</rhs>
+</prod>
+<prod id="NT-SystemLiteral">
+<lhs>SystemLiteral</lhs><rhs>('"' [^"]* '"') |&nbsp;("'" [^']* "'") </rhs>
+</prod>
+<prod id="NT-PubidLiteral">
+<lhs>PubidLiteral</lhs><rhs>'"' <nt def="NT-PubidChar">PubidChar</nt>* '"'
+| "'" (<nt def="NT-PubidChar">PubidChar</nt> - "'")* "'"</rhs>
+</prod>
+<prod id="NT-PubidChar">
+<lhs>PubidChar</lhs><rhs>#x20 | #xD | #xA |&nbsp;[a-zA-Z0-9] |&nbsp;[-'()+,./:=?;!*#@$_%]</rhs>
+</prod>
+</scrap>
+<note diff="add">
+<p><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E72">[E72]</loc>Although
+the <nt def="NT-EntityValue">EntityValue</nt> production allows the definition
+of an entity consisting of a single explicit <code>&lt;</code> in the literal
+(e.g., <code>&lt;!ENTITY mylt "&lt;"></code>), it is strongly advised to avoid
+this practice since any reference to that entity will cause a well-formedness
+error.</p>
+</note>
+</div2>
+<div2 id="syntax">
+<head>Character Data and Markup</head>
+<p><termref def="dt-text">Text</termref> consists of intermingled <termref
+def="dt-chardata">character data</termref> and markup. <termdef id="dt-markup"
+term="Markup"><term>Markup</term> takes the form of <termref def="dt-stag">start-tags</termref>, <termref
+def="dt-etag">end-tags</termref>, <termref def="dt-empty">empty-element tags</termref>, <termref
+def="dt-entref">entity references</termref>, <termref def="dt-charref">character
+references</termref>, <termref def="dt-comment">comments</termref>, <termref
+def="dt-cdsection">CDATA section</termref> delimiters, <termref def="dt-doctype">document
+type declarations</termref>, <termref def="dt-pi">processing instructions</termref>, <phrase
+diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E89">[E89]</loc><nt
+def="NT-XMLDecl">XML declarations</nt>, <nt def="NT-TextDecl">text declarations</nt>,
+and any white space that is at the top level of the document entity (that
+is, outside the document element and not inside any other markup).</phrase></termdef></p>
+<p><termdef id="dt-chardata" term="Character Data">All text that is not markup
+constitutes the <term>character data</term> of the document.</termdef></p>
+<p>The ampersand character (&amp;) and the left angle bracket (&lt;) may appear
+in their literal form <emph>only</emph> when used as markup delimiters, or
+within a <termref def="dt-comment">comment</termref>, a <termref def="dt-pi">processing
+instruction</termref>, or a <termref def="dt-cdsection">CDATA section</termref>.<phrase
+diff="del"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E18">[E18]</loc>They
+are also legal within the <termref def="dt-litentval">literal entity value</termref>
+of an internal entity declaration; see <specref ref="wf-entities"/>.</phrase> <!-- FINAL EDIT: restore internal entity decl or leave it out. -->
+If they are needed elsewhere, they must be <termref def="dt-escape">escaped</termref>
+using either <termref def="dt-charref">numeric character references</termref>
+or the strings <quote><code>&amp;amp;</code></quote> and <quote><code>&amp;lt;</code></quote>
+respectively. The right angle bracket (>) may be represented using the string <quote><code>&amp;gt;</code></quote>,
+and must, <termref def="dt-compat">for compatibility</termref>, be escaped
+using <quote><code>&amp;gt;</code></quote> or a character reference when it
+appears in the string <quote><code>]]&gt;</code></quote> in content, when
+that string is not marking the end of a <termref def="dt-cdsection">CDATA
+section</termref>.</p>
+<p>In the content of elements, character data is any string of characters
+which does not contain the start-delimiter of any markup. In a CDATA section,
+character data is any string of characters not including the CDATA-section-close
+delimiter, <quote><code>]]&gt;</code></quote>.</p>
+<p>To allow attribute values to contain both single and double quotes, the
+apostrophe or single-quote character (') may be represented as <quote><code>&amp;apos;</code></quote>,
+and the double-quote character (") as <quote><code>&amp;quot;</code></quote>.</p>
+<scrap lang="ebnf">
+<head>Character Data</head>
+<prod id="NT-CharData">
+<lhs>CharData</lhs><rhs>[^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;' [^&lt;&amp;]*)</rhs>
+</prod>
+</scrap>
+</div2>
+<div2 id="sec-comments">
+<head>Comments</head>
+<p><termdef id="dt-comment" term="Comment"><term>Comments</term> may appear
+anywhere in a document outside other <termref def="dt-markup">markup</termref>;
+in addition, they may appear within the document type declaration at places
+allowed by the grammar. They are not part of the document's <termref def="dt-chardata">character
+data</termref>; an XML processor may, but need not, make it possible for an
+application to retrieve the text of comments. <termref def="dt-compat">For
+compatibility</termref>, the string <quote><code>--</code></quote> (double-hyphen)
+must not occur within comments.</termdef> <phrase diff="add"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E63">[E63]</loc>Parameter
+entity references are not recognized within comments.</phrase></p>
+<scrap lang="ebnf">
+<head>Comments</head>
+<prod id="NT-Comment">
+<lhs>Comment</lhs><rhs>'&lt;!--' ((<nt def="NT-Char">Char</nt> - '-') | ('-'
+(<nt def="NT-Char">Char</nt> - '-')))* '-->'</rhs>
+</prod>
+</scrap>
+<p>An example of a comment:</p>
+<eg>&lt;!&como; declarations for &lt;head> &amp; &lt;body> &comc;></eg>
+<p diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E27">[E27]</loc>Note
+that the grammar does not allow a comment ending in <code>---></code>. The
+following example is <emph>not</emph> well-formed.</p>
+<eg diff="add">&lt;!-- B+, B, or B---></eg>
+</div2>
+<div2 id="sec-pi">
+<head>Processing Instructions</head>
+<p><termdef id="dt-pi" term="Processing instruction"><term>Processing instructions</term>
+(PIs) allow documents to contain instructions for applications.</termdef></p>
+<scrap lang="ebnf">
+<head>Processing Instructions</head>
+<prod id="NT-PI">
+<lhs>PI</lhs><rhs>'&lt;?' <nt def="NT-PITarget">PITarget</nt> (<nt def="NT-S">S</nt>
+(<nt def="NT-Char">Char</nt>* - (<nt def="NT-Char">Char</nt>* &pic; <nt def="NT-Char">Char</nt>*)))? &pic;</rhs>
+</prod>
+<prod id="NT-PITarget">
+<lhs>PITarget</lhs><rhs><nt def="NT-Name">Name</nt> - (('X' | 'x') ('M' |
+'m') ('L' | 'l'))</rhs>
+</prod>
+</scrap>
+<p>PIs are not part of the document's <termref def="dt-chardata">character
+data</termref>, but must be passed through to the application. The PI begins
+with a target (<nt def="NT-PITarget">PITarget</nt>) used to identify the application
+to which the instruction is directed. The target names <quote><code>XML</code></quote>, <quote><code>xml</code></quote>,
+and so on are reserved for standardization in this or future versions of this
+specification. The XML <termref def="dt-notation">Notation</termref> mechanism
+may be used for formal declaration of PI targets. <phrase diff="add"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E63">[E63]</loc>Parameter
+entity references are not recognized within processing instructions.</phrase></p>
+</div2>
+<div2 id="sec-cdata-sect">
+<head>CDATA Sections</head>
+<p><termdef id="dt-cdsection" term="CDATA Section"><term>CDATA sections</term>
+may occur anywhere character data may occur; they are used to escape blocks
+of text containing characters which would otherwise be recognized as markup.
+CDATA sections begin with the string <quote><code>&lt;![CDATA[</code></quote>
+and end with the string <quote><code>]]&gt;</code></quote>:</termdef></p>
+<scrap lang="ebnf">
+<head>CDATA Sections</head>
+<prod id="NT-CDSect">
+<lhs>CDSect</lhs><rhs><nt def="NT-CDStart">CDStart</nt> <nt def="NT-CData">CData</nt> <nt
+def="NT-CDEnd">CDEnd</nt></rhs>
+</prod>
+<prod id="NT-CDStart">
+<lhs>CDStart</lhs><rhs>'&lt;![CDATA['</rhs>
+</prod>
+<prod id="NT-CData">
+<lhs>CData</lhs><rhs>(<nt def="NT-Char">Char</nt>* - (<nt def="NT-Char">Char</nt>*
+']]&gt;' <nt def="NT-Char">Char</nt>*)) </rhs>
+</prod>
+<prod id="NT-CDEnd">
+<lhs>CDEnd</lhs><rhs>']]&gt;'</rhs>
+</prod>
+</scrap>
+<p>Within a CDATA section, only the <nt def="NT-CDEnd">CDEnd</nt> string is
+recognized as markup, so that left angle brackets and ampersands may occur
+in their literal form; they need not (and cannot) be escaped using <quote><code>&amp;lt;</code></quote>
+and <quote><code>&amp;amp;</code></quote>. CDATA sections cannot nest.</p>
+<p>An example of a CDATA section, in which <quote><code>&lt;greeting></code></quote>
+and <quote><code>&lt;/greeting></code></quote> are recognized as <termref
+def="dt-chardata">character data</termref>, not <termref def="dt-markup">markup</termref>:</p>
+<eg>&lt;![CDATA[&lt;greeting>Hello, world!&lt;/greeting>]]&gt; </eg>
+</div2>
+<div2 id="sec-prolog-dtd">
+<head>Prolog and Document Type Declaration</head>
+<p><termdef id="dt-xmldecl" term="XML Declaration">XML documents <phrase diff="chg"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E107">[E107]</loc>should</phrase>
+begin with an <term>XML declaration</term> which specifies the version of
+XML being used.</termdef> For example, the following is a complete XML document, <termref
+def="dt-wellformed">well-formed</termref> but not <termref def="dt-valid">valid</termref>:</p>
+<eg><![CDATA[<?xml version="1.0"?> <greeting>Hello, world!</greeting> ]]></eg>
+<p>and so is this:</p>
+<eg><![CDATA[<greeting>Hello, world!</greeting>]]></eg>
+<p>The version number <quote><code>1.0</code></quote> should be used to indicate
+conformance to this version of this specification; it is an error for a document
+to use the value <quote><code>1.0</code></quote> if it does not conform to
+this version of this specification. It is the intent of the XML working group
+to give later versions of this specification numbers other than <quote><code>1.0</code></quote>,
+but this intent does not indicate a commitment to produce any future versions
+of XML, nor if any are produced, to use any particular numbering scheme. Since
+future versions are not ruled out, this construct is provided as a means to
+allow the possibility of automatic version recognition, should it become necessary.
+Processors may signal an error if they receive documents labeled with versions
+they do not support.</p>
+<p>The function of the markup in an XML document is to describe its storage
+and logical structure and to associate attribute-value pairs with its logical
+structures. XML provides a mechanism, the <termref def="dt-doctype">document
+type declaration</termref>, to define constraints on the logical structure
+and to support the use of predefined storage units. <termdef id="dt-valid"
+term="Validity">An XML document is <term>valid</term> if it has an associated
+document type declaration and if the document complies with the constraints
+expressed in it.</termdef></p>
+<p>The document type declaration must appear before the first <termref def="dt-element">element</termref>
+in the document.</p>
+<scrap id="xmldoc" lang="ebnf">
+<head>Prolog</head>
+<prodgroup pcw2="6" pcw4="17.5" pcw5="9">
+<prod id="NT-prolog">
+<lhs>prolog</lhs><rhs><nt def="NT-XMLDecl">XMLDecl</nt>? <nt def="NT-Misc">Misc</nt>*
+(<nt def="NT-doctypedecl">doctypedecl</nt> <nt def="NT-Misc">Misc</nt>*)?</rhs>
+</prod>
+<prod id="NT-XMLDecl">
+<lhs>XMLDecl</lhs><rhs>&pio; <nt def="NT-VersionInfo">VersionInfo</nt> <nt
+def="NT-EncodingDecl">EncodingDecl</nt>? <nt def="NT-SDDecl">SDDecl</nt>? <nt
+def="NT-S">S</nt>? &pic;</rhs>
+</prod>
+<prod id="NT-VersionInfo" diff="chg">
+<lhs>VersionInfo</lhs><rhs><nt def="NT-S">S</nt> 'version' <nt def="NT-Eq">Eq</nt>
+("'" <nt def="NT-VersionNum">VersionNum</nt> "'" | '"' <nt def="NT-VersionNum">VersionNum</nt>
+'"')<com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E15">[E15]</loc></com></rhs>
+</prod>
+<prod id="NT-Eq">
+<lhs>Eq</lhs><rhs><nt def="NT-S">S</nt>? '=' <nt def="NT-S">S</nt>?</rhs>
+</prod>
+<prod id="NT-VersionNum">
+<lhs>VersionNum</lhs><rhs>([a-zA-Z0-9_.:] | '-')+</rhs>
+</prod>
+<prod id="NT-Misc">
+<lhs>Misc</lhs><rhs><nt def="NT-Comment">Comment</nt> | <nt def="NT-PI">PI</nt>
+| <nt def="NT-S">S</nt></rhs>
+</prod>
+</prodgroup></scrap>
+<p><termdef id="dt-doctype" term="Document Type Declaration">The XML <term>document
+type declaration</term> contains or points to <termref def="dt-markupdecl">markup
+declarations</termref> that provide a grammar for a class of documents. This
+grammar is known as a document type definition, or <term>DTD</term>. The document
+type declaration can point to an external subset (a special kind of <termref
+def="dt-extent">external entity</termref>) containing markup declarations,
+or can contain the markup declarations directly in an internal subset, or
+can do both. The DTD for a document consists of both subsets taken together.</termdef></p>
+<p><termdef id="dt-markupdecl" term="markup declaration"> A <term>markup declaration</term>
+is an <termref def="dt-eldecl">element type declaration</termref>, an <termref
+def="dt-attdecl">attribute-list declaration</termref>, an <termref def="dt-entdecl">entity
+declaration</termref>, or a <termref def="dt-notdecl">notation declaration</termref>.</termdef>
+These declarations may be contained in whole or in part within <termref def="dt-PE">parameter
+entities</termref>, as described in the well-formedness and validity constraints
+below. For <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E14">[E14]</loc>further</phrase>
+information, see <specref ref="sec-physical-struct"/>.</p>
+<scrap id="dtd" lang="ebnf">
+<head>Document Type Definition</head>
+<prodgroup pcw2="6" pcw4="17.5" pcw5="9">
+<prod id="NT-doctypedecl" diff="chg">
+<lhs>doctypedecl</lhs><rhs>'&lt;!DOCTYPE' <nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt>
+(<nt def="NT-S">S</nt> <nt def="NT-ExternalID">ExternalID</nt>)? <nt def="NT-S">S</nt>?
+('[' (<nt def="NT-markupdecl">markupdecl</nt> | <nt diff="chg" def="NT-DeclSep">DeclSep</nt>)*
+']' <nt def="NT-S">S</nt>?)? '>'</rhs><vc def="vc-roottype"/><wfc def="ExtSubset"
+diff="add"/><com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</loc></com>
+</prod>
+<prod id="NT-DeclSep" diff="add">
+<lhs>DeclSep</lhs><rhs><nt def="NT-PEReference">PEReference</nt> | <nt def="NT-S">S</nt></rhs>
+<wfc def="PE-between-Decls" diff="add"/><com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</loc></com>
+</prod>
+<prod id="NT-markupdecl">
+<lhs>markupdecl</lhs><rhs><nt def="NT-elementdecl">elementdecl</nt> | <nt
+def="NT-AttlistDecl">AttlistDecl</nt> | <nt def="NT-EntityDecl">EntityDecl</nt>
+| <nt def="NT-NotationDecl">NotationDecl</nt> | <nt def="NT-PI">PI</nt> | <nt
+def="NT-Comment">Comment</nt> </rhs><vc def="vc-PEinMarkupDecl"/><wfc def="wfc-PEinInternalSubset"/>
+</prod>
+</prodgroup></scrap>
+<p diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E82">[E82]</loc>Note
+that it is possible to construct a well-formed document containing a <nt def="NT-doctypedecl">doctypedecl</nt>
+that neither points to an external subset nor contains an internal subset.</p>
+<p>The markup declarations may be made up in whole or in part of the <termref
+def="dt-repltext">replacement text</termref> of <termref def="dt-PE">parameter
+entities</termref>. The productions later in this specification for individual
+nonterminals (<nt def="NT-elementdecl">elementdecl</nt>, <nt def="NT-AttlistDecl">AttlistDecl</nt>,
+and so on) describe the declarations <emph>after</emph> all the parameter
+entities have been <termref def="dt-include">included</termref>.</p>
+<p diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E75">[E75]</loc>Parameter
+entity references are recognized anywhere in the DTD (internal and external
+subsets and external parameter entities), except in literals, processing instructions,
+comments, and the contents of ignored conditional sections (see <specref ref="sec-condition-sect"/>).
+They are also recognized in entity value literals. The use of parameter entities
+in the internal subset is restricted as described below.</p>
+<vcnote id="vc-roottype"><head>Root Element Type</head><p>The <nt def="NT-Name">Name</nt>
+in the document type declaration must match the element type of the <termref
+def="dt-root">root element</termref>.</p>
+</vcnote>
+<vcnote id="vc-PEinMarkupDecl"><head>Proper Declaration/PE Nesting</head>
+<p>Parameter-entity <termref def="dt-repltext">replacement text</termref>
+must be properly nested with markup declarations. That is to say, if either
+the first character or the last character of a markup declaration (<nt def="NT-markupdecl">markupdecl</nt>
+above) is contained in the replacement text for a <termref def="dt-PERef">parameter-entity
+reference</termref>, both must be contained in the same replacement text.</p>
+</vcnote>
+<wfcnote id="wfc-PEinInternalSubset"><head>PEs in Internal Subset</head><p>In
+the internal DTD subset, <termref def="dt-PERef">parameter-entity references</termref>
+can occur only where markup declarations can occur, not within markup declarations.
+(This does not apply to references that occur in external parameter entities
+or to the external subset.)</p>
+</wfcnote>
+<wfcnote id="ExtSubset" diff="add"><head><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</loc>External
+Subset</head><p>The external subset, if any, must match the production for <nt
+def="NT-extSubset">extSubset</nt>.</p>
+</wfcnote>
+<wfcnote id="PE-between-Decls" diff="add"><head><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</loc>PE
+Between Declarations</head><p>The replacement text of a parameter entity reference
+in a <nt def="NT-DeclSep">DeclSep</nt> must match the production <nt def="NT-extSubsetDecl">extSubsetDecl</nt>.</p>
+</wfcnote>
+<p>Like the internal subset, the external subset and any external parameter
+entities <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</loc>referenced
+in a <nt def="NT-DeclSep">DeclSep</nt></phrase> must consist of a series of
+complete markup declarations of the types allowed by the non-terminal symbol <nt
+def="NT-markupdecl">markupdecl</nt>, interspersed with white space or <termref
+def="dt-PERef">parameter-entity references</termref>. However, portions of
+the contents of the external subset or of <phrase diff="add"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</loc>these </phrase>
+external parameter entities may conditionally be ignored by using the <termref
+def="dt-cond-section">conditional section</termref> construct; this is not
+allowed in the internal subset.</p>
+<scrap id="ext-Subset">
+<head>External Subset</head>
+<prodgroup pcw2="6" pcw4="17.5" pcw5="9">
+<prod id="NT-extSubset">
+<lhs>extSubset</lhs><rhs><nt def="NT-TextDecl">TextDecl</nt>? <nt def="NT-extSubsetDecl">extSubsetDecl</nt></rhs>
+</prod>
+<prod id="NT-extSubsetDecl" diff="chg">
+<lhs>extSubsetDecl</lhs><rhs>( <nt def="NT-markupdecl">markupdecl</nt> | <nt
+def="NT-conditionalSect">conditionalSect</nt> | <nt diff="chg" def="NT-DeclSep">DeclSep</nt>)*</rhs>
+<com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</loc></com>
+</prod>
+</prodgroup></scrap>
+<p>The external subset and external parameter entities also differ from the
+internal subset in that in them, <termref def="dt-PERef">parameter-entity
+references</termref> are permitted <emph>within</emph> markup declarations,
+not only <emph>between</emph> markup declarations.</p>
+<p>An example of an XML document with a document type declaration:</p>
+<eg><![CDATA[<?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> ]]></eg>
+<p>The <termref def="dt-sysid">system identifier</termref> <quote><code>hello.dtd</code></quote>
+gives the <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E78">[E78]</loc>address
+(a URI reference)</phrase> of a DTD for the document.</p>
+<p>The declarations can also be given locally, as in this example:</p>
+<eg><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE greeting [
+ <!ELEMENT greeting (#PCDATA)>
+]>
+<greeting>Hello, world!</greeting>]]></eg>
+<p>If both the external and internal subsets are used, the internal subset
+is considered to occur before the external subset. <!-- 'is considered to'? boo. whazzat mean? -->
+This has the effect that entity and attribute-list declarations in the internal
+subset take precedence over those in the external subset.</p>
+</div2>
+<div2 id="sec-rmd">
+<head>Standalone Document Declaration</head>
+<p>Markup declarations can affect the content of the document, as passed from
+an <termref def="dt-xml-proc">XML processor</termref> to an application; examples
+are attribute defaults and entity declarations. The standalone document declaration,
+which may appear as a component of the XML declaration, signals whether or
+not there are such declarations which appear external to the <termref def="dt-docent">document
+entity</termref><phrase diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E64">[E64]</loc>
+or in parameter entities. <termdef id="dt-extmkpdecl" term="External Markup Declaration">An <term>external
+markup declaration</term> is defined as a markup declaration occurring in
+the external subset or in a parameter entity (external or internal, the latter
+being included because non-validating processors are not required to read
+them).</termdef></phrase></p>
+<scrap id="fulldtd" lang="ebnf">
+<head>Standalone Document Declaration</head>
+<prodgroup pcw2="4" pcw4="19.5" pcw5="9">
+<prod id="NT-SDDecl">
+<lhs>SDDecl</lhs><rhs> <nt def="NT-S">S</nt> 'standalone' <nt def="NT-Eq">Eq</nt>
+(("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"')) </rhs><vc def="vc-check-rmd"/>
+</prod>
+</prodgroup></scrap>
+<p>In a standalone document declaration, the value <attval>yes</attval> indicates
+that there are no <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E64">[E64]</loc><termref
+def="dt-extmkpdecl">external markup declarations</termref></phrase> which
+affect the information passed from the XML processor to the application. The
+value <attval>no</attval> indicates that there are or may be such external
+markup declarations. Note that the standalone document declaration only denotes
+the presence of external <emph>declarations</emph>; the presence, in a document,
+of references to external <emph>entities</emph>, when those entities are internally
+declared, does not change its standalone status.</p>
+<p>If there are no external markup declarations, the standalone document declaration
+has no meaning. If there are external markup declarations but there is no
+standalone document declaration, the value <attval>no</attval> is assumed.</p>
+<p>Any XML document for which <code>standalone="no"</code> holds can be converted
+algorithmically to a standalone document, which may be desirable for some
+network delivery applications.</p>
+<vcnote id="vc-check-rmd"><head>Standalone Document Declaration</head><p>The
+standalone document declaration must have the value <attval>no</attval> if
+any external markup declarations contain declarations of:</p>
+<ulist>
+<item><p>attributes with <termref def="dt-default">default</termref> values,
+if elements to which these attributes apply appear in the document without
+specifications of values for these attributes, or</p></item>
+<item><p>entities (other than &magicents;), if <termref def="dt-entref">references</termref>
+to those entities appear in the document, or</p></item>
+<item><p>attributes with values subject to <titleref href="#AVNormalize">normalization</titleref>,
+where the attribute appears in the document with a value which will change
+as a result of normalization, or</p></item>
+<item><p>element types with <termref def="dt-elemcontent">element content</termref>,
+if white space occurs directly within any instance of those types.</p></item>
+</ulist>
+</vcnote>
+<p>An example XML declaration with a standalone document declaration:</p>
+<eg>&lt;?xml version="&versionOfXML;" standalone='yes'?></eg>
+</div2>
+<div2 id="sec-white-space">
+<head>White Space Handling</head>
+<p>In editing XML documents, it is often convenient to use <quote>white space</quote>
+(spaces, tabs, and blank lines<phrase diff="del"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E39">[E39]</loc>,
+denoted by the nonterminal <nt def="NT-S">S</nt> in this specification</phrase>)
+to set apart the markup for greater readability. Such white space is typically
+not intended for inclusion in the delivered version of the document. On the
+other hand, <quote>significant</quote> white space that should be preserved
+in the delivered version is common, for example in poetry and source code.</p>
+<p>An <termref def="dt-xml-proc">XML processor</termref> must always pass
+all characters in a document that are not markup through to the application.
+A <termref def="dt-validating"> validating XML processor</termref> must also
+inform the application which of these characters constitute white space appearing
+in <termref def="dt-elemcontent">element content</termref>.</p>
+<p>A special <termref def="dt-attr">attribute</termref> named <att>xml:space</att>
+may be attached to an element to signal an intention that in that element,
+white space should be preserved by applications. In valid documents, this
+attribute, like any other, must be <termref def="dt-attdecl">declared</termref>
+if it is used. When declared, it must be given as an <termref def="dt-enumerated">enumerated
+type</termref> whose <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E81">[E81]</loc>values
+are one or both of</phrase> <attval>default</attval> and <attval>preserve</attval>.
+For example:</p>
+<eg diff="chg"><![CDATA[<!ATTLIST poem xml:space (default|preserve) 'preserve'>]]>
+
+&lt;!-- <loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E81">[E81]</loc>-->
+&lt;!ATTLIST pre xml:space (preserve) #FIXED 'preserve'></eg>
+<p>The value <attval>default</attval> signals that applications' default white-space
+processing modes are acceptable for this element; the value <attval>preserve</attval>
+indicates the intent that applications preserve all the white space. This
+declared intent is considered to apply to all elements within the content
+of the element where it is specified, unless overriden with another instance
+of the <att>xml:space</att> attribute.</p>
+<p>The <termref def="dt-root">root element</termref> of any document is considered
+to have signaled no intentions as regards application space handling, unless
+it provides a value for this attribute or the attribute is declared with a
+default value.</p>
+</div2>
+<div2 id="sec-line-ends">
+<head>End-of-Line Handling</head>
+<p>XML <termref def="dt-parsedent">parsed entities</termref> are often stored
+in computer files which, for editing convenience, are organized into lines.
+These lines are typically separated by some combination of the characters
+carriage-return (#xD) and line-feed (#xA).</p>
+<p diff="del">To simplify the tasks of <termref def="dt-app">applications</termref>,
+wherever an external parsed entity or the literal entity value of an internal
+parsed entity contains either the literal two-character sequence <quote>#xD#xA</quote>
+or a standalone literal #xD, an <termref def="dt-xml-proc">XML processor</termref>
+must pass to the application the single character #xA. (This behavior can
+conveniently be produced by normalizing all line breaks to #xA on input, before
+parsing.)</p>
+<p diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E104">[E104]</loc>To
+simplify the tasks of <termref def="dt-app">applications</termref>, the characters
+passed to an application by the <termref def="dt-xml-proc">XML processor</termref>
+must be as if the XML processor normalized all line breaks in external parsed
+entities (including the document entity) on input, before parsing, by translating
+both the two-character sequence #xD #xA and any #xD that is not followed by
+#xA to a single #xA character.</p>
+</div2>
+<div2 id="sec-lang-tag">
+<head>Language Identification</head>
+<p>In document processing, it is often useful to identify the natural or formal
+language in which the content is written. A special <termref def="dt-attr">attribute</termref>
+named <att>xml:lang</att> may be inserted in documents to specify the language
+used in the contents and attribute values of any element in an XML document.
+In valid documents, this attribute, like any other, must be <termref def="dt-attdecl">declared</termref>
+if it is used. <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E73">[E73]</loc>The
+values of the attribute are language identifiers as defined by <bibref ref="RFC1766"/>, <titleref>Tags
+for the Identification of Languages</titleref>, or its successor on the IETF
+Standards Track.</phrase></p>
+<note diff="add">
+<p><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E73">[E73]</loc><bibref
+ref="RFC1766"/> tags are constructed from two-letter language codes as defined
+by <bibref ref="ISO639"/>, from two-letter country codes as defined by <bibref
+ref="ISO3166"/>, or from language identifiers registered with the Internet
+Assigned Numbers Authority <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E58">[E58]</loc><bibref
+diff="chg" ref="IANA-LANGCODES"/></phrase>. It is expected that the successor
+to <bibref ref="RFC1766"/> will introduce three-letter language codes for
+languages not presently covered by <bibref ref="ISO639"/>.</p>
+</note>
+<p diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E73">[E73]</loc>(Productions
+33 through 38 have been removed.)</p>
+<scrap diff="del" lang="ebnf">
+<head>Language Identification</head>
+<prod id="NT-LanguageID">
+<lhs>LanguageID</lhs><rhs><nt def="NT-Langcode">Langcode</nt> ('-' <nt def="NT-Subcode">Subcode</nt>)*</rhs>
+</prod>
+<prod id="NT-Langcode">
+<lhs>Langcode</lhs><rhs><nt def="NT-ISO639Code">ISO639Code</nt> | <nt def="NT-IanaCode">IanaCode</nt>
+| <nt def="NT-UserCode">UserCode</nt></rhs>
+</prod>
+<prod id="NT-ISO639Code">
+<lhs>ISO639Code</lhs><rhs>([a-z] | [A-Z]) ([a-z] | [A-Z])</rhs>
+</prod>
+<prod id="NT-IanaCode">
+<lhs>IanaCode</lhs><rhs>('i' | 'I') '-' ([a-z] | [A-Z])+</rhs>
+</prod>
+<prod id="NT-UserCode">
+<lhs>UserCode</lhs><rhs>('x' | 'X') '-' ([a-z] | [A-Z])+</rhs>
+</prod>
+<prod id="NT-Subcode">
+<lhs>Subcode</lhs><rhs>([a-z] | [A-Z])+</rhs>
+</prod>
+</scrap>
+<p diff="del">The <nt def="NT-Langcode">Langcode</nt> may be any of the following:</p>
+<ulist diff="del">
+<item><p>a two-letter language code as defined by <bibref ref="ISO639"/>, <titleref>Codes
+for the representation of names of languages</titleref></p></item>
+<item><p>a language identifier registered with the Internet Assigned Numbers
+Authority <bibref diff="chg" ref="IANA-LANGCODES"/>; these begin with the
+prefix <quote><code>i-</code></quote> (or <quote><code>I-</code></quote>)</p>
+</item>
+<item><p>a language identifier assigned by the user, or agreed on between
+parties in private use; these must begin with the prefix <quote><code>x-</code></quote>
+or <quote><code>X-</code></quote> in order to ensure that they do not conflict
+with names later standardized or registered with IANA</p></item>
+</ulist>
+<p diff="del">There may be any number of <nt def="NT-Subcode">Subcode</nt>
+segments; if the first subcode segment exists and the Subcode consists of
+two letters, then it must be a country code from <bibref ref="ISO3166"/>,
+"Codes for the representation of names of countries." If the first subcode
+consists of more than two letters, it must be a subcode for the language in
+question registered with IANA, unless the <nt def="NT-Langcode">Langcode</nt>
+begins with the prefix "<code>x-</code>" or "<code>X-</code>". </p>
+<p diff="del">It is customary to give the language code in lower case, and
+the country code (if any) in upper case. Note that these values, unlike other
+names in XML documents, are case insensitive.</p>
+<p>For example:</p>
+<eg><![CDATA[<p xml:lang="en">The quick brown fox jumps over the lazy dog.</p>
+<p xml:lang="en-GB">What colour is it?</p>
+<p xml:lang="en-US">What color is it?</p>
+<sp who="Faust" desc='leise' xml:lang="de">
+ <l>Habe nun, ach! Philosophie,</l>
+ <l>Juristerei, und Medizin</l>
+ <l>und leider auch Theologie</l>
+ <l>durchaus studiert mit heißem Bemüh'n.</l>
+</sp>]]></eg>
+<!--<p>The xml:lang value is considered to apply both to the contents of an
+element and
+(unless otherwise via attribute default values) to the
+values of all of its attributes with free-text (CDATA) values. -->
+<p>The intent declared with <att>xml:lang</att> is considered to apply to
+all attributes and content of the element where it is specified, unless overridden
+with an instance of <att>xml:lang</att> on another element within that content.</p>
+<!--
+If no
+value is specified for xml:lang on an element, and no default value is
+defined for it in the DTD, then the xml:lang attribute of any element
+takes the same value it has in the parent element, if any. The two
+technical terms in the following example both have the same effective
+value for xml:lang:
+
+ <p xml:lang="en">Here the keywords are
+ <term xml:lang="en">shift</term> and
+ <term>reduce</term>. ...</p>
+
+The application, not the XML processor, is responsible for this '
+inheritance' of attribute values.
+-->
+<p>A simple declaration for <att>xml:lang</att> might take the form</p>
+<eg>xml:lang NMTOKEN #IMPLIED</eg>
+<p>but specific default values may also be given, if appropriate. In a collection
+of French poems for English students, with glosses and notes in English, the <att>xml:lang</att>
+attribute might be declared this way:</p>
+<eg><![CDATA[<!ATTLIST poem xml:lang NMTOKEN 'fr'>
+<!ATTLIST gloss xml:lang NMTOKEN 'en'>
+<!ATTLIST note xml:lang NMTOKEN 'en'>]]></eg>
+</div2>
+</div1>
+<!-- &Elements; -->
+<div1 id="sec-logical-struct">
+<head>Logical Structures</head>
+<p><termdef id="dt-element" term="Element">Each <termref def="dt-xml-doc">XML
+document</termref> contains one or more <term>elements</term>, the boundaries
+of which are either delimited by <termref def="dt-stag">start-tags</termref>
+and <termref def="dt-etag">end-tags</termref>, or, for <termref def="dt-empty">empty</termref>
+elements, by an <termref def="dt-eetag">empty-element tag</termref>. Each
+element has a type, identified by name, sometimes called its <quote>generic
+identifier</quote> (GI), and may have a set of attribute specifications.</termdef>
+Each attribute specification has a <termref def="dt-attrname">name</termref>
+and a <termref def="dt-attrval">value</termref>.</p>
+<scrap lang="ebnf">
+<head>Element</head>
+<prod id="NT-element">
+<lhs>element</lhs><rhs><nt def="NT-EmptyElemTag">EmptyElemTag</nt></rhs>
+<rhs>| <nt def="NT-STag">STag</nt> <nt def="NT-content">content</nt> <nt def="NT-ETag">ETag</nt></rhs>
+<wfc def="GIMatch"/><vc def="elementvalid"/>
+</prod>
+</scrap>
+<p>This specification does not constrain the semantics, use, or (beyond syntax)
+names of the element types and attributes, except that names beginning with
+a match to <code>(('X'|'x')('M'|'m')('L'|'l'))</code> are reserved for standardization
+in this or future versions of this specification.</p>
+<wfcnote id="GIMatch"><head>Element Type Match</head><p>The <nt def="NT-Name">Name</nt>
+in an element's end-tag must match the element type in the start-tag.</p>
+</wfcnote>
+<vcnote id="elementvalid"><head>Element Valid</head><p>An element is valid
+if there is a declaration matching <nt def="NT-elementdecl">elementdecl</nt>
+where the <nt def="NT-Name">Name</nt> matches the element type, and one of
+the following holds:</p>
+<olist>
+<item><p>The declaration matches <kw>EMPTY</kw> and the element has no <termref
+def="dt-content">content</termref>.</p></item>
+<item><p>The declaration matches <nt def="NT-children">children</nt> and the
+sequence of <termref def="dt-parentchild">child elements</termref> belongs
+to the language generated by the regular expression in the content model,
+with optional white space (characters matching the nonterminal <nt def="NT-S">S</nt>)
+between <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E59">[E59]</loc>the
+start-tag and the first child element, between child elements, or between
+the last child element and the end-tag. Note that a CDATA section containing
+only white space does not match the nonterminal <nt def="NT-S">S</nt>, and
+hence cannot appear in these positions.</phrase></p></item>
+<item><p>The declaration matches <nt def="NT-Mixed">Mixed</nt> and the content
+consists of <termref def="dt-chardata">character data</termref> and <termref
+def="dt-parentchild">child elements</termref> whose types match names in the
+content model.</p></item>
+<item><p>The declaration matches <kw>ANY</kw>, and the types of any <termref
+def="dt-parentchild">child elements</termref> have been declared.</p></item>
+</olist>
+</vcnote>
+<div2 id="sec-starttags">
+<head>Start-Tags, End-Tags, and Empty-Element Tags</head>
+<p><termdef id="dt-stag" term="Start-Tag">The beginning of every non-empty
+XML element is marked by a <term>start-tag</term>.</termdef></p>
+<scrap lang="ebnf">
+<head>Start-tag</head>
+<prodgroup pcw2="6" pcw4="15" pcw5="11.5">
+<prod id="NT-STag">
+<lhs>STag</lhs><rhs>'&lt;' <nt def="NT-Name">Name</nt> (<nt def="NT-S">S</nt> <nt
+def="NT-Attribute">Attribute</nt>)* <nt def="NT-S">S</nt>? '>'</rhs><wfc def="uniqattspec"/>
+</prod>
+<prod id="NT-Attribute">
+<lhs>Attribute</lhs><rhs><nt def="NT-Name">Name</nt> <nt def="NT-Eq">Eq</nt> <nt
+def="NT-AttValue">AttValue</nt></rhs><vc def="ValueType"/><wfc def="NoExternalRefs"/>
+<wfc def="CleanAttrVals"/>
+</prod>
+</prodgroup></scrap>
+<p>The <nt def="NT-Name">Name</nt> in the start- and end-tags gives the element's <term>type</term>. <termdef
+id="dt-attr" term="Attribute"> The <nt def="NT-Name">Name</nt>-<nt def="NT-AttValue">AttValue</nt>
+pairs are referred to as the <term>attribute specifications</term> of the
+element</termdef>, <termdef id="dt-attrname" term="Attribute Name">with the <nt
+def="NT-Name">Name</nt> in each pair referred to as the <term>attribute name</term></termdef>
+and <termdef id="dt-attrval" term="Attribute Value">the content of the <nt
+def="NT-AttValue">AttValue</nt> (the text between the <code>'</code> or <code>"</code>
+delimiters) as the <term>attribute value</term>.</termdef><phrase diff="add"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E46">[E46]</loc>Note
+that the order of attribute specifications in a start-tag or empty-element
+tag is not significant.</phrase></p>
+<wfcnote id="uniqattspec"><head>Unique Att Spec</head><p>No attribute name
+may appear more than once in the same start-tag or empty-element tag.</p>
+</wfcnote>
+<vcnote id="ValueType"><head>Attribute Value Type</head><p>The attribute must
+have been declared; the value must be of the type declared for it. (For attribute
+types, see <specref ref="attdecls"/>.)</p>
+</vcnote>
+<wfcnote id="NoExternalRefs"><head>No External Entity References</head><p>Attribute
+values cannot contain direct or indirect entity references to external entities.</p>
+</wfcnote>
+<wfcnote id="CleanAttrVals"><head>No <code>&lt;</code> in Attribute Values</head>
+<p>The <termref def="dt-repltext">replacement text</termref> of any entity
+referred to directly or indirectly in an attribute value <phrase diff="del"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E83">[E83]</loc>(other
+than <quote><code>&amp;lt;</code></quote>) </phrase>must not contain a <code>&lt;</code>.</p>
+</wfcnote>
+<p>An example of a start-tag:</p>
+<eg>&lt;termdef id="dt-dog" term="dog"></eg>
+<p><termdef id="dt-etag" term="End Tag">The end of every element that begins
+with a start-tag must be marked by an <term>end-tag</term> containing a name
+that echoes the element's type as given in the start-tag:</termdef></p>
+<scrap lang="ebnf">
+<head>End-tag</head>
+<prodgroup pcw2="6" pcw4="15" pcw5="11.5">
+<prod id="NT-ETag">
+<lhs>ETag</lhs><rhs>'&lt;/' <nt def="NT-Name">Name</nt> <nt def="NT-S">S</nt>?
+'>'</rhs>
+</prod>
+</prodgroup></scrap>
+<p>An example of an end-tag:</p>
+<eg>&lt;/termdef></eg>
+<p><termdef id="dt-content" term="Content">The <termref def="dt-text">text</termref>
+between the start-tag and end-tag is called the element's <term>content</term>:</termdef></p>
+<scrap lang="ebnf">
+<head>Content of Elements</head>
+<prodgroup pcw2="6" pcw4="15" pcw5="11.5">
+<prod id="NT-content" diff="chg">
+<lhs>content</lhs><rhs><nt def="NT-CharData">CharData</nt>? ((<nt def="NT-element">element</nt>
+| <nt def="NT-Reference">Reference</nt> | <nt def="NT-CDSect">CDSect</nt>
+| <nt def="NT-PI">PI</nt> | <nt def="NT-Comment">Comment</nt>) <nt def="NT-CharData">CharData</nt>?)*</rhs>
+<com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E71">[E71]</loc></com>
+</prod>
+</prodgroup></scrap>
+<p><phrase diff="chg"><termdef id="dt-empty" term="Empty"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E97">[E97]</loc>An element
+with no content is said to be <term>empty</term>.</termdef> The representation
+of an empty element is either a start-tag immediately followed by an end-tag,
+or an empty-element tag.</phrase> <termdef id="dt-eetag" term="empty-element tag">An <term>empty-element
+tag</term> takes a special form:</termdef></p>
+<scrap lang="ebnf">
+<head>Tags for Empty Elements</head>
+<prodgroup pcw2="6" pcw4="15" pcw5="11.5">
+<prod id="NT-EmptyElemTag">
+<lhs>EmptyElemTag</lhs><rhs>'&lt;' <nt def="NT-Name">Name</nt> (<nt def="NT-S">S</nt> <nt
+def="NT-Attribute">Attribute</nt>)* <nt def="NT-S">S</nt>? '/>'</rhs><wfc
+def="uniqattspec"/>
+</prod>
+</prodgroup></scrap>
+<p>Empty-element tags may be used for any element which has no content, whether
+or not it is declared using the keyword <kw>EMPTY</kw>. <termref def="dt-interop">For
+interoperability</termref>, the empty-element tag <phrase diff="chg"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E45">[E45]</loc>should
+be used, and should only be used,</phrase> for elements which are declared
+EMPTY.</p>
+<p>Examples of empty elements:</p>
+<eg>&lt;IMG align="left"
+ src="http://www.w3.org/Icons/WWW/w3c_home" />
+&lt;br>&lt;/br>
+&lt;br/></eg>
+</div2>
+<div2 id="elemdecls">
+<head>Element Type Declarations</head>
+<p>The <termref def="dt-element">element</termref> structure of an <termref
+def="dt-xml-doc">XML document</termref> may, for <termref def="dt-valid">validation</termref>
+purposes, be constrained using element type and attribute-list declarations.
+An element type declaration constrains the element's <termref def="dt-content">content</termref>.</p>
+<p>Element type declarations often constrain which element types can appear
+as <termref def="dt-parentchild">children</termref> of the element. At user
+option, an XML processor may issue a warning when a declaration mentions an
+element type for which no declaration is provided, but this is not an error.</p>
+<p><termdef id="dt-eldecl" term="Element Type declaration">An <term>element
+type declaration</term> takes the form:</termdef></p>
+<scrap lang="ebnf">
+<head>Element Type Declaration</head>
+<prodgroup pcw2="5.5" pcw4="18" pcw5="9">
+<prod id="NT-elementdecl">
+<lhs>elementdecl</lhs><rhs>'&lt;!ELEMENT' <nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt> <nt
+def="NT-S">S</nt> <nt def="NT-contentspec">contentspec</nt> <nt def="NT-S">S</nt>?
+'>'</rhs><vc def="EDUnique"/>
+</prod>
+<prod id="NT-contentspec">
+<lhs>contentspec</lhs><rhs>'EMPTY' | 'ANY' | <nt def="NT-Mixed">Mixed</nt>
+| <nt def="NT-children">children</nt> </rhs>
+</prod>
+</prodgroup></scrap>
+<p>where the <nt def="NT-Name">Name</nt> gives the element type being declared.</p>
+<vcnote id="EDUnique"><head>Unique Element Type Declaration</head><p>No element
+type may be declared more than once.</p>
+</vcnote>
+<p>Examples of element type declarations:</p>
+<eg>&lt;!ELEMENT br EMPTY>
+&lt;!ELEMENT p (#PCDATA|emph)* >
+&lt;!ELEMENT %name.para; %content.para; >
+&lt;!ELEMENT container ANY></eg>
+<div3 id="sec-element-content">
+<head>Element Content</head>
+<p><termdef id="dt-elemcontent" term="Element content">An element <termref
+def="dt-stag">type</termref> has <term>element content</term> when elements
+of that type must contain only <termref def="dt-parentchild">child</termref>
+elements (no character data), optionally separated by white space (characters
+matching the nonterminal <nt def="NT-S">S</nt>).</termdef><termdef id="dt-content-model"
+term="Content model">In this case, the constraint includes a <phrase diff="chg"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E55">[E55]</loc><term>content
+model</term></phrase>, a simple grammar governing the allowed types of the
+child elements and the order in which they are allowed to appear.</termdef>
+The grammar is built on content particles (<nt def="NT-cp">cp</nt>s), which
+consist of names, choice lists of content particles, or sequence lists of
+content particles:</p>
+<scrap lang="ebnf">
+<head>Element-content Models</head>
+<prodgroup pcw2="5.5" pcw4="16" pcw5="11">
+<prod id="NT-children">
+<lhs>children</lhs><rhs>(<nt def="NT-choice">choice</nt> | <nt def="NT-seq">seq</nt>)
+('?' | '*' | '+')?</rhs>
+</prod>
+<prod id="NT-cp">
+<lhs>cp</lhs><rhs>(<nt def="NT-Name">Name</nt> | <nt def="NT-choice">choice</nt>
+| <nt def="NT-seq">seq</nt>) ('?' | '*' | '+')?</rhs>
+</prod>
+<prod id="NT-choice" diff="chg">
+<lhs>choice</lhs><rhs>'(' <nt def="NT-S">S</nt>? <nt def="NT-cp">cp</nt> ( <nt
+def="NT-S">S</nt>? '|' <nt def="NT-S">S</nt>? <nt def="NT-cp">cp</nt> )+ <nt
+def="NT-S">S</nt>? ')'</rhs><com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E50">[E50]</loc></com>
+<com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E52">[E52]</loc></com>
+<vc def="vc-PEinGroup"/>
+</prod>
+<prod id="NT-seq" diff="chg">
+<lhs>seq</lhs><rhs>'(' <nt def="NT-S">S</nt>? <nt def="NT-cp">cp</nt> ( <nt
+def="NT-S">S</nt>? ',' <nt def="NT-S">S</nt>? <nt def="NT-cp">cp</nt> )* <nt
+def="NT-S">S</nt>? ')'</rhs><com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E52">[E52]</loc></com>
+<vc def="vc-PEinGroup"/>
+</prod>
+</prodgroup></scrap>
+<p>where each <nt def="NT-Name">Name</nt> is the type of an element which
+may appear as a <termref def="dt-parentchild">child</termref>. Any content
+particle in a choice list may appear in the <termref def="dt-elemcontent">element
+content</termref> at the location where the choice list appears in the grammar;
+content particles occurring in a sequence list must each appear in the <termref
+def="dt-elemcontent">element content</termref> in the order given in the list.
+The optional character following a name or list governs whether the element
+or the content particles in the list may occur one or more (<code>+</code>),
+zero or more (<code>*</code>), or zero or one times (<code>?</code>). The
+absence of such an operator means that the element or content particle must
+appear exactly once. This syntax and meaning are identical to those used in
+the productions in this specification.</p>
+<p>The content of an element matches a content model if and only if it is
+possible to trace out a path through the content model, obeying the sequence,
+choice, and repetition operators and matching each element in the content
+against an element type in the content model. <termref def="dt-compat">For
+compatibility</termref>, it is an error if an element in the document can
+match more than one occurrence of an element type in the content model. For
+more information, see <specref ref="determinism"/>.</p>
+<!--appendix <specref ref="determinism"/>.-->
+<!-- appendix on deterministic content models. -->
+<vcnote id="vc-PEinGroup"><head>Proper Group/PE Nesting</head><p>Parameter-entity <termref
+def="dt-repltext">replacement text</termref> must be properly nested with <phrase
+diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E11">[E11]</loc>parenthesized</phrase>
+groups. That is to say, if either of the opening or closing parentheses in
+a <nt def="NT-choice">choice</nt>, <nt def="NT-seq">seq</nt>, or <nt def="NT-Mixed">Mixed</nt>
+construct is contained in the replacement text for a <termref def="dt-PERef">parameter
+entity</termref>, both must be contained in the same replacement text.</p>
+<p diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E19">[E19]</loc><termref
+def="dt-interop">For interoperability</termref>, if a parameter-entity reference
+appears in a <nt def="NT-choice">choice</nt>, <nt def="NT-seq">seq</nt>, or <nt
+def="NT-Mixed">Mixed</nt> construct, its replacement text should contain at
+least one non-blank character, and neither the first nor last non-blank character
+of the replacement text should be a connector (<code>|</code> or <code>,</code>).</p>
+</vcnote>
+<p>Examples of element-content models:</p>
+<eg>&lt;!ELEMENT spec (front, body, back?)>
+&lt;!ELEMENT div1 (head, (p | list | note)*, div2*)>
+&lt;!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*></eg>
+</div3>
+<div3 id="sec-mixed-content">
+<head>Mixed Content</head>
+<p><termdef id="dt-mixed" term="Mixed Content">An element <termref def="dt-stag">type</termref>
+has <term>mixed content</term> when elements of that type may contain character
+data, optionally interspersed with <termref def="dt-parentchild">child</termref>
+elements.</termdef> In this case, the types of the child elements may be constrained,
+but not their order or their number of occurrences:</p>
+<scrap lang="ebnf">
+<head>Mixed-content Declaration</head>
+<prodgroup pcw2="5.5" pcw4="16" pcw5="11">
+<prod id="NT-Mixed">
+<lhs>Mixed</lhs><rhs>'(' <nt def="NT-S">S</nt>? '#PCDATA' (<nt def="NT-S">S</nt>?
+'|' <nt def="NT-S">S</nt>? <nt def="NT-Name">Name</nt>)* <nt def="NT-S">S</nt>?
+')*' </rhs>
+<rhs>| '(' <nt def="NT-S">S</nt>? '#PCDATA' <nt def="NT-S">S</nt>? ')' </rhs>
+<vc def="vc-PEinGroup"/><vc def="vc-MixedChildrenUnique"/>
+</prod>
+</prodgroup></scrap>
+<p>where the <nt def="NT-Name">Name</nt>s give the types of elements that
+may appear as children. <phrase diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E10">[E10]</loc>The
+keyword <kw>#PCDATA</kw> derives historically from the term <quote>parsed
+character data.</quote></phrase></p>
+<vcnote id="vc-MixedChildrenUnique"><head>No Duplicate Types</head><p>The
+same name must not appear more than once in a single mixed-content declaration.</p>
+</vcnote>
+<p>Examples of mixed content declarations:</p>
+<eg>&lt;!ELEMENT p (#PCDATA|a|ul|b|i|em)*>
+&lt;!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* >
+&lt;!ELEMENT b (#PCDATA)></eg>
+</div3>
+</div2>
+<div2 id="attdecls">
+<head>Attribute-List Declarations</head>
+<p><termref def="dt-attr">Attributes</termref> are used to associate name-value
+pairs with <termref def="dt-element">elements</termref>. Attribute specifications
+may appear only within <termref def="dt-stag">start-tags</termref> and <termref
+def="dt-eetag">empty-element tags</termref>; thus, the productions used to
+recognize them appear in <specref ref="sec-starttags"/>. Attribute-list declarations
+may be used:</p>
+<ulist>
+<item><p>To define the set of attributes pertaining to a given element type.</p>
+</item>
+<item><p>To establish type constraints for these attributes.</p></item>
+<item><p>To provide <termref def="dt-default">default values</termref> for
+attributes.</p></item>
+</ulist>
+<p><termdef id="dt-attdecl" term="Attribute-List Declaration"> <term>Attribute-list
+declarations</term> specify the name, data type, and default value (if any)
+of each attribute associated with a given element type:</termdef></p>
+<scrap lang="ebnf">
+<head>Attribute-list Declaration</head>
+<prod id="NT-AttlistDecl">
+<lhs>AttlistDecl</lhs><rhs>'&lt;!ATTLIST' <nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt> <nt
+def="NT-AttDef">AttDef</nt>* <nt def="NT-S">S</nt>? '>'</rhs>
+</prod>
+<prod id="NT-AttDef">
+<lhs>AttDef</lhs><rhs><nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt> <nt
+def="NT-S">S</nt> <nt def="NT-AttType">AttType</nt> <nt def="NT-S">S</nt> <nt
+def="NT-DefaultDecl">DefaultDecl</nt></rhs>
+</prod>
+</scrap>
+<p>The <nt def="NT-Name">Name</nt> in the <nt def="NT-AttlistDecl">AttlistDecl</nt>
+rule is the type of an element. At user option, an XML processor may issue
+a warning if attributes are declared for an element type not itself declared,
+but this is not an error. The <nt def="NT-Name">Name</nt> in the <nt def="NT-AttDef">AttDef</nt>
+rule is the name of the attribute.</p>
+<p>When more than one <nt def="NT-AttlistDecl">AttlistDecl</nt> is provided
+for a given element type, the contents of all those provided are merged. When
+more than one definition is provided for the same attribute of a given element
+type, the first declaration is binding and later declarations are ignored. <phrase
+diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E9">[E9]</loc><termref
+def="dt-interop">For interoperability,</termref> writers of DTDs may choose
+to provide at most one attribute-list declaration for a given element type,
+at most one attribute definition for a given attribute name in an attribute-list
+declaration, and at least one attribute definition in each attribute-list
+declaration.</phrase> For interoperability, an XML processor may at user option
+issue a warning when more than one attribute-list declaration is provided
+for a given element type, or more than one attribute definition is provided
+for a given attribute, but this is not an error.</p>
+<div3 id="sec-attribute-types">
+<head>Attribute Types</head>
+<p>XML attribute types are of three kinds: a string type, a set of tokenized
+types, and enumerated types. The string type may take any literal string as
+a value; the tokenized types have varying lexical and semantic constraints<phrase
+diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E8">[E8]</loc>.
+The validity constraints noted in the grammar are applied after the attribute
+value has been normalized as described in <specref ref="attdecls"/>.</phrase></p>
+<scrap lang="ebnf">
+<head>Attribute Types</head>
+<prodgroup pcw4="14" pcw5="11.5">
+<prod id="NT-AttType">
+<lhs>AttType</lhs><rhs><nt def="NT-StringType">StringType</nt> | <nt def="NT-TokenizedType">TokenizedType</nt>
+| <nt def="NT-EnumeratedType">EnumeratedType</nt> </rhs>
+</prod>
+<prod id="NT-StringType">
+<lhs>StringType</lhs><rhs>'CDATA'</rhs>
+</prod>
+<prod id="NT-TokenizedType">
+<lhs>TokenizedType</lhs><rhs>'ID'</rhs><vc def="id"/><vc def="one-id-per-el"/>
+<vc def="id-default"/>
+<rhs>| 'IDREF'</rhs><vc def="idref"/>
+<rhs>| 'IDREFS'</rhs><vc def="idref"/>
+<rhs>| 'ENTITY'</rhs><vc def="entname"/>
+<rhs>| 'ENTITIES'</rhs><vc def="entname"/>
+<rhs>| 'NMTOKEN'</rhs><vc def="nmtok"/>
+<rhs>| 'NMTOKENS'</rhs><vc def="nmtok"/>
+</prod>
+</prodgroup></scrap>
+<vcnote id="id"><head>ID</head><p>Values of type <kw>ID</kw> must match the <nt
+def="NT-Name">Name</nt> production. A name must not appear more than once
+in an XML document as a value of this type; i.e., ID values must uniquely
+identify the elements which bear them.</p>
+</vcnote>
+<vcnote id="one-id-per-el"><head>One ID per Element Type</head><p>No element
+type may have more than one ID attribute specified.</p>
+</vcnote>
+<vcnote id="id-default"><head>ID Attribute Default</head><p>An ID attribute
+must have a declared default of <kw>#IMPLIED</kw> or <kw>#REQUIRED</kw>.</p>
+</vcnote>
+<vcnote id="idref"><head>IDREF</head><p>Values of type <kw>IDREF</kw> must
+match the <nt def="NT-Name">Name</nt> production, and values of type <kw>IDREFS</kw>
+must match <nt def="NT-Names">Names</nt>; each <nt def="NT-Name">Name</nt>
+must match the value of an ID attribute on some element in the XML document;
+i.e. <kw>IDREF</kw> values must match the value of some ID attribute.</p>
+</vcnote>
+<vcnote id="entname"><head>Entity Name</head><p>Values of type <kw>ENTITY</kw>
+must match the <nt def="NT-Name">Name</nt> production, values of type <kw>ENTITIES</kw>
+must match <nt def="NT-Names">Names</nt>; each <nt def="NT-Name">Name</nt>
+must match the name of an <termref def="dt-unparsed">unparsed entity</termref>
+declared in the <termref def="dt-doctype">DTD</termref>.</p>
+</vcnote>
+<vcnote id="nmtok"><head>Name Token</head><p>Values of type <kw>NMTOKEN</kw>
+must match the <nt def="NT-Nmtoken">Nmtoken</nt> production; values of type <kw>NMTOKENS</kw>
+must match <termref def="NT-Nmtokens">Nmtokens</termref>.</p>
+</vcnote>
+<!-- why?
+<p>The XML processor must normalize attribute values before
+passing them to the application, as described in
+<specref ref="AVNormalize"/>.</p>-->
+<p><termdef id="dt-enumerated" term="Enumerated Attribute
+Values"><term>Enumerated attributes</term> can take one of a list of values
+provided in the declaration</termdef>. There are two kinds of enumerated types:</p>
+<scrap lang="ebnf">
+<head>Enumerated Attribute Types</head>
+<prod id="NT-EnumeratedType">
+<lhs>EnumeratedType</lhs><rhs><nt def="NT-NotationType">NotationType</nt>
+| <nt def="NT-Enumeration">Enumeration</nt> </rhs>
+</prod>
+<prod id="NT-NotationType">
+<lhs>NotationType</lhs><rhs>'NOTATION' <nt def="NT-S">S</nt> '(' <nt def="NT-S">S</nt>? <nt
+def="NT-Name">Name</nt> (<nt def="NT-S">S</nt>? '|' <nt def="NT-S">S</nt>? <nt
+def="NT-Name">Name</nt>)* <nt def="NT-S">S</nt>? ')' </rhs><vc def="notatn"/>
+<vc def="OneNotationPer" diff="add"/><vc def="NoNotationEmpty" diff="add"/>
+</prod>
+<prod id="NT-Enumeration">
+<lhs>Enumeration</lhs><rhs>'(' <nt def="NT-S">S</nt>? <nt def="NT-Nmtoken">Nmtoken</nt>
+(<nt def="NT-S">S</nt>? '|' <nt def="NT-S">S</nt>? <nt def="NT-Nmtoken">Nmtoken</nt>)* <nt
+def="NT-S">S</nt>? ')'</rhs><vc def="enum"/>
+</prod>
+</scrap>
+<p>A <kw>NOTATION</kw> attribute identifies a <termref def="dt-notation">notation</termref>,
+declared in the DTD with associated system and/or public identifiers, to be
+used in interpreting the element to which the attribute is attached.</p>
+<vcnote id="notatn"><head>Notation Attributes</head><p>Values of this type
+must match one of the <titleref href="#Notations">notation</titleref> names
+included in the declaration; all notation names in the declaration must be
+declared.</p>
+</vcnote>
+<vcnote id="OneNotationPer" diff="add"><head><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E7">[E7]</loc>One
+Notation Per Element Type</head><p>No element type may have more than one <kw>NOTATION</kw>
+attribute specified.</p>
+</vcnote>
+<vcnote id="NoNotationEmpty" diff="add"><head><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E68">[E68]</loc>No
+Notation on Empty Element</head><p><termref def="dt-compat">For compatibility</termref>,
+an attribute of type <kw>NOTATION</kw> must not be declared on an element
+declared <kw>EMPTY</kw>.</p>
+</vcnote>
+<vcnote id="enum"><head>Enumeration</head><p>Values of this type must match
+one of the <nt def="NT-Nmtoken">Nmtoken</nt> tokens in the declaration.</p>
+</vcnote>
+<p><termref def="dt-interop">For interoperability,</termref> the same <nt
+def="NT-Nmtoken">Nmtoken</nt> should not occur more than once in the enumerated
+attribute types of a single element type.</p>
+</div3>
+<div3 id="sec-attr-defaults">
+<head>Attribute Defaults</head>
+<p>An <termref def="dt-attdecl">attribute declaration</termref> provides information
+on whether the attribute's presence is required, and if not, how an XML processor
+should react if a declared attribute is absent in a document.</p>
+<scrap lang="ebnf">
+<head>Attribute Defaults</head>
+<prodgroup pcw4="14" pcw5="11.5">
+<prod id="NT-DefaultDecl">
+<lhs>DefaultDecl</lhs><rhs>'#REQUIRED' |&nbsp;'#IMPLIED' </rhs>
+<rhs>| (('#FIXED' S)? <nt def="NT-AttValue">AttValue</nt>)</rhs><vc def="RequiredAttr"/>
+<vc def="defattrvalid"/><wfc def="CleanAttrVals"/><vc def="FixedAttr"/>
+</prod>
+</prodgroup></scrap>
+<p>In an attribute declaration, <kw>#REQUIRED</kw> means that the attribute
+must always be provided, <kw>#IMPLIED</kw> that no default value is provided. <!-- not any more!!
+<kw>#IMPLIED</kw> means that if the attribute is omitted
+from an element of this type,
+the XML processor must inform the application
+that no value was specified; no constraint is placed on the behavior
+of the application. --> <termdef id="dt-default" term="Attribute Default">If
+the declaration is neither <kw>#REQUIRED</kw> nor <kw>#IMPLIED</kw>, then
+the <nt def="NT-AttValue">AttValue</nt> value contains the declared <term>default</term>
+value; the <kw>#FIXED</kw> keyword states that the attribute must always have
+the default value. If a default value is declared, when an XML processor encounters
+an omitted attribute, it is to behave as though the attribute were present
+with the declared default value.</termdef></p>
+<vcnote id="RequiredAttr"><head>Required Attribute</head><p>If the default
+declaration is the keyword <kw>#REQUIRED</kw>, then the attribute must be
+specified for all elements of the type in the attribute-list declaration.</p>
+</vcnote>
+<vcnote id="defattrvalid"><head>Attribute Default Legal</head><p>The declared
+default value must meet the lexical constraints of the declared attribute
+type.</p>
+</vcnote>
+<vcnote id="FixedAttr"><head>Fixed Attribute Default</head><p>If an attribute
+has a default value declared with the <kw>#FIXED</kw> keyword, instances of
+that attribute must match the default value.</p>
+</vcnote>
+<p>Examples of attribute-list declarations:</p>
+<eg>&lt;!ATTLIST termdef
+ id ID #REQUIRED
+ name CDATA #IMPLIED>
+&lt;!ATTLIST list
+ type (bullets|ordered|glossary) "ordered">
+&lt;!ATTLIST form
+ method CDATA #FIXED "POST"></eg>
+</div3>
+<div3 id="AVNormalize" diff="chg">
+<head><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E70">[E70]</loc>Attribute-Value
+Normalization</head>
+<p>Before the value of an attribute is passed to the application or checked
+for validity, the XML processor must normalize the attribute value by applying
+the algorithm below, or by using some other method such that the value passed
+to the application is the same as that produced by the algorithm.</p>
+<olist>
+<item><p>All line breaks must have been normalized on input to #xA as described
+in <specref ref="sec-line-ends"/>, so the rest of this algorithm operates
+on text normalized in this way.</p></item>
+<item><p>Begin with a normalized value consisting of the empty string.</p>
+</item>
+<item><p>For each character, entity reference, or character reference in the
+unnormalized attribute value, beginning with the first and continuing to the
+last, do the following:</p>
+<ulist>
+<item><p>For a character reference, append the referenced character to the
+normalized value.</p></item>
+<item><p>For an entity reference, recursively apply step 3 of this algorithm
+to the replacement text of the entity.</p></item>
+<item><p>For a white space character (#x20, #xD, #xA, #x9), append a space
+character (#x20) to the normalized value.</p></item>
+<item><p>For another character, append the character to the normalized value.</p>
+</item>
+</ulist>
+</item>
+</olist>
+<p>If the attribute type is not CDATA, then the XML processor must further
+process the normalized attribute value by discarding any leading and trailing
+space (#x20) characters, and by replacing sequences of space (#x20) characters
+by a single space (#x20) character.</p>
+<p>Note that if the unnormalized attribute value contains a character reference
+to a white space character other than space (#x20), the normalized value contains
+the referenced character itself (#xD, #xA or #x9). This contrasts with the
+case where the unnormalized value contains a white space character (not a
+reference), which is replaced with a space character (#x20) in the normalized
+value and also contrasts with the case where the unnormalized value contains
+an entity reference whose replacement text contains a white space character;
+being recursively processed, the white space character is replaced with a
+space character (#x20) in the normalized value.</p>
+<p>All attributes for which no declaration has been read should be treated
+by a non-validating <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E95">[E95]</loc>processor</phrase>
+as if declared <kw>CDATA</kw>.</p>
+<p>Following are examples of attribute normalization. Given the following
+declarations:</p>
+<eg>&lt;!ENTITY d "&amp;#xD;">
+&lt;!ENTITY a "&amp;#xA;">
+&lt;!ENTITY da "&amp;#xD;&amp;#xA;"></eg>
+<p>the attribute specifications in the left column below would be normalized
+to the character sequences of the middle column if the attribute <att>a</att>
+is declared <kw>NMTOKENS</kw> and to those of the right columns if <att>a</att>
+is declared <kw>CDATA</kw>.</p>
+<table border="1" frame="border"><thead><tr><th>Attribute specification</th>
+<th>a is NMTOKENS</th><th>a is CDATA</th></tr></thead><tbody><tr><td><eg>a="
+
+xyz"</eg></td><td><code>x y z</code></td><td><code>#x20 #x20 x y z</code></td>
+</tr><tr><td><eg>a="&amp;d;&amp;d;A&amp;a;&amp;a;B&amp;da;"</eg></td><td><code>A
+#x20 B</code></td><td><code>#x20 #x20 A #x20 #x20 B #x20 #x20</code></td>
+</tr><tr><td><eg>a=
+"&amp;#xd;&amp;#xd;A&amp;#xa;&amp;#xa;B&amp;#xd;&amp;#xa;"</eg></td><td><code>#xD
+#xD A #xA #xA B #xD #xA</code></td><td><code>#xD #xD A #xA #xA B #xD #xD</code></td>
+</tr></tbody></table>
+<p>Note that the last example is invalid (but well-formed) if <att>a</att>
+is declared to be of type <kw>NMTOKENS</kw>.</p>
+</div3>
+</div2>
+<div2 id="sec-condition-sect">
+<head>Conditional Sections</head>
+<p><termdef id="dt-cond-section" term="conditional section"> <term>Conditional
+sections</term> are portions of the <termref def="dt-doctype">document type
+declaration external subset</termref> which are included in, or excluded from,
+the logical structure of the DTD based on the keyword which governs them.</termdef></p>
+<scrap lang="ebnf">
+<head>Conditional Section</head>
+<prodgroup pcw2="9" pcw4="14.5">
+<prod id="NT-conditionalSect">
+<lhs>conditionalSect</lhs><rhs><nt def="NT-includeSect">includeSect</nt> | <nt
+def="NT-ignoreSect">ignoreSect</nt> </rhs>
+</prod>
+<prod id="NT-includeSect">
+<lhs>includeSect</lhs><rhs>'&lt;![' S? 'INCLUDE' S? '[' <nt def="NT-extSubsetDecl">extSubsetDecl</nt>
+']]&gt;' </rhs><com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</loc></com>
+<vc def="condsec-nesting" diff="add"/>
+</prod>
+<prod id="NT-ignoreSect">
+<lhs>ignoreSect</lhs><rhs>'&lt;![' S? 'IGNORE' S? '[' <nt def="NT-ignoreSectContents">ignoreSectContents</nt>*
+']]&gt;'</rhs><com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</loc></com>
+<vc def="condsec-nesting" diff="add"/>
+</prod>
+<prod id="NT-ignoreSectContents">
+<lhs>ignoreSectContents</lhs><rhs><nt def="NT-Ignore">Ignore</nt> ('&lt;![' <nt
+def="NT-ignoreSectContents">ignoreSectContents</nt> ']]&gt;' <nt def="NT-Ignore">Ignore</nt>)*</rhs>
+</prod>
+<prod id="NT-Ignore">
+<lhs>Ignore</lhs><rhs><nt def="NT-Char">Char</nt>* - (<nt def="NT-Char">Char</nt>*
+('&lt;![' | ']]&gt;') <nt def="NT-Char">Char</nt>*) </rhs>
+</prod>
+</prodgroup></scrap>
+<vcnote id="condsec-nesting" diff="add"><head><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</loc>Proper
+Conditional Section/PE Nesting</head><p>If any of the "<code>&lt;![</code>",
+"<code>[</code>", or "<code>]]&gt;</code>" of a conditional section is contained
+in the replacement text for a parameter-entity reference, all of them must
+be contained in the same replacement text.</p>
+</vcnote>
+<p>Like the internal and external DTD subsets, a conditional section may contain
+one or more complete declarations, comments, processing instructions, or nested
+conditional sections, intermingled with white space.</p>
+<p>If the keyword of the conditional section is <kw>INCLUDE</kw>, then the
+contents of the conditional section are part of the DTD. If the keyword of
+the conditional section is <kw>IGNORE</kw>, then the contents of the conditional
+section are not logically part of the DTD. <phrase diff="del"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</loc>Note that
+for reliable parsing, the contents of even ignored conditional sections must
+be read in order to detect nested conditional sections and ensure that the
+end of the outermost (ignored) conditional section is properly detected.</phrase>
+If a conditional section with a keyword of <kw>INCLUDE</kw> occurs within
+a larger conditional section with a keyword of <kw>IGNORE</kw>, both the outer
+and the inner conditional sections are ignored.<phrase diff="add"> <loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</loc>The contents
+of an ignored conditional section are parsed by ignoring all characters after
+the "<code>[</code>" following the keyword, except conditional section starts
+"<code>&lt;![</code>" and ends "<code>]]&gt;</code>", until the matching conditional
+section end is found. Parameter entity references are not recognized in this
+process.</phrase></p>
+<p>If the keyword of the conditional section is a parameter-entity reference,
+the parameter entity must be replaced by its content before the processor
+decides whether to include or ignore the conditional section.</p>
+<p>An example:</p>
+<eg>&lt;!ENTITY % draft 'INCLUDE' >
+&lt;!ENTITY % final 'IGNORE' >
+
+&lt;![%draft;[
+&lt;!ELEMENT book (comments*, title, body, supplements?)>
+]]&gt;
+&lt;![%final;[
+&lt;!ELEMENT book (title, body, supplements?)>
+]]&gt;</eg>
+</div2>
+<!--
+<div2 id='sec-pass-to-app'>
+<head>XML Processor Treatment of Logical Structure</head>
+<p>When an XML processor encounters a start-tag, it must make
+at least the following information available to the application:
+<ulist>
+<item>
+<p>the element type's generic identifier</p>
+</item>
+<item>
+<p>the names of attributes known to apply to this element type
+(validating processors must make available names of all attributes
+declared for the element type; non-validating processors must
+make available at least the names of the attributes for which
+values are specified.
+</p>
+</item>
+</ulist>
+</p>
+</div2>
+-->
+</div1>
+<!-- &Entities; -->
+<div1 id="sec-physical-struct">
+<head>Physical Structures</head>
+<p><termdef id="dt-entity" term="Entity">An XML document may consist of one
+or many storage units. <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E6">[E6]</loc>These
+are called <term>entities</term>; they all have <term>content</term> and are
+all (except for the <termref def="dt-docent">document entity</termref> and
+the <termref def="dt-doctype">external DTD subset</termref>) identified by
+entity <term>name</term></phrase>.</termdef> Each XML document has one entity
+called the <termref def="dt-docent">document entity</termref>, which serves
+as the starting point for the <termref def="dt-xml-proc">XML processor</termref>
+and may contain the whole document.</p>
+<p>Entities may be either parsed or unparsed. <termdef id="dt-parsedent" term="Text Entity">A <term>parsed
+entity's</term> contents are referred to as its <termref def="dt-repltext">replacement
+text</termref>; this <termref def="dt-text">text</termref> is considered an
+integral part of the document.</termdef></p>
+<p><termdef id="dt-unparsed" term="Unparsed Entity">An <term>unparsed entity</term>
+is a resource whose contents may or may not be <termref def="dt-text">text</termref>,
+and if text, <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E25">[E25]</loc>may
+be other than</phrase> XML. Each unparsed entity has an associated <termref
+def="dt-notation">notation</termref>, identified by name. Beyond a requirement
+that an XML processor make the identifiers for the entity and notation available
+to the application, XML places no constraints on the contents of unparsed
+entities.</termdef></p>
+<p>Parsed entities are invoked by name using entity references; unparsed entities
+by name, given in the value of <kw>ENTITY</kw> or <kw>ENTITIES</kw> attributes.</p>
+<p><termdef id="gen-entity" term="general entity"><term>General entities</term>
+are entities for use within the document content. In this specification, general
+entities are sometimes referred to with the unqualified term <emph>entity</emph>
+when this leads to no ambiguity.</termdef> <termdef id="dt-PE" term="Parameter entity"><phrase
+diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E53">[E53]</loc><term>Parameter
+entities</term></phrase> are parsed entities for use within the DTD.</termdef>
+These two types of entities use different forms of reference and are recognized
+in different contexts. Furthermore, they occupy different namespaces; a parameter
+entity and a general entity with the same name are two distinct entities.</p>
+<div2 id="sec-references">
+<head>Character and Entity References</head>
+<p><termdef id="dt-charref" term="Character Reference"> A <term>character
+reference</term> refers to a specific character in the ISO/IEC 10646 character
+set, for example one not directly accessible from available input devices.</termdef></p>
+<scrap lang="ebnf">
+<head>Character Reference</head>
+<prod id="NT-CharRef">
+<lhs>CharRef</lhs><rhs>'&amp;#' [0-9]+ ';' </rhs>
+<rhs>| '&hcro;' [0-9a-fA-F]+ ';'</rhs><wfc def="wf-Legalchar"/>
+</prod>
+</scrap>
+<wfcnote id="wf-Legalchar"><head>Legal Character</head><p>Characters referred
+to using character references must match the production for <termref def="NT-Char">Char</termref>.</p>
+</wfcnote>
+<p>If the character reference begins with <quote><code>&amp;#x</code></quote>,
+the digits and letters up to the terminating <code>;</code> provide a hexadecimal
+representation of the character's code point in ISO/IEC 10646. If it begins
+just with <quote><code>&amp;#</code></quote>, the digits up to the terminating <code>;</code>
+provide a decimal representation of the character's code point.</p>
+<p><termdef id="dt-entref" term="Entity Reference">An <term>entity reference</term>
+refers to the content of a named entity.</termdef> <termdef id="dt-GERef"
+term="General Entity Reference">References to parsed general entities use
+ampersand (<code>&amp;</code>) and semicolon (<code>;</code>) as delimiters.</termdef> <termdef
+id="dt-PERef" term="Parameter-entity reference"> <term>Parameter-entity references</term>
+use percent-sign (<code>%</code>) and semicolon (<code>;</code>) as delimiters.</termdef></p>
+<scrap lang="ebnf">
+<head>Entity Reference</head>
+<prod id="NT-Reference">
+<lhs>Reference</lhs><rhs><nt def="NT-EntityRef">EntityRef</nt> | <nt def="NT-CharRef">CharRef</nt></rhs>
+</prod>
+<prod id="NT-EntityRef">
+<lhs>EntityRef</lhs><rhs>'&amp;' <nt def="NT-Name">Name</nt> ';'</rhs><wfc
+def="wf-entdeclared"/><vc def="vc-entdeclared"/><wfc def="textent"/><wfc def="norecursion"/>
+</prod>
+<prod id="NT-PEReference">
+<lhs>PEReference</lhs><rhs>'%' <nt def="NT-Name">Name</nt> ';'</rhs><vc def="vc-entdeclared"/>
+<wfc def="norecursion"/><wfc def="indtd"/>
+</prod>
+</scrap>
+<wfcnote id="wf-entdeclared"><head>Entity Declared</head><p>In a document
+without any DTD, a document with only an internal DTD subset which contains
+no parameter entity references, or a document with <quote><code>standalone='yes'</code></quote>, <phrase
+diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E34">[E34]</loc>for
+an entity reference that does not occur within the external subset or a parameter
+entity, the <nt def="NT-Name">Name</nt> given in the entity reference must <termref
+def="dt-match">match</termref> that in an <titleref href="#sec-entity-decl">entity
+declaration</titleref> that does not occur within the external subset or a
+parameter entity</phrase>, except that well-formed documents need not declare
+any of the following entities: &magicents;. <phrase diff="del"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E29">[E29]</loc>The declaration
+of a parameter entity must precede any reference to it. Similarly, </phrase>The
+declaration of a general entity must precede any reference to it which appears
+in a default value in an attribute-list declaration.</p>
+<p>Note that if entities are declared in the external subset or in external
+parameter entities, a non-validating processor is <titleref href="#include-if-valid">not
+obligated to</titleref> read and process their declarations; for such documents,
+the rule that an entity must be declared is a well-formedness constraint only
+if <titleref href="#sec-rmd">standalone='yes'</titleref>.</p>
+</wfcnote>
+<vcnote id="vc-entdeclared"><head>Entity Declared</head><p>In a document with
+an external subset or external parameter entities with <quote><code>standalone='no'</code></quote>,
+the <nt def="NT-Name">Name</nt> given in the entity reference must <termref
+def="dt-match">match</termref> that in an <titleref href="#sec-entity-decl">entity
+declaration</titleref>. For interoperability, valid documents should declare
+the entities &magicents;, in the form specified in <specref ref="sec-predefined-ent"/>.
+The declaration of a parameter entity must precede any reference to it. Similarly,
+the declaration of a general entity must precede any <phrase diff="chg"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E92">[E92]</loc>attribute-list
+declaration containing a default value with a direct or indirect reference
+to that general entity.</phrase></p>
+</vcnote>
+<!-- FINAL EDIT: is this duplication too clumsy? -->
+<wfcnote id="textent"><head>Parsed Entity</head><p>An entity reference must
+not contain the name of an <termref def="dt-unparsed">unparsed entity</termref>.
+Unparsed entities may be referred to only in <termref def="dt-attrval">attribute
+values</termref> declared to be of type <kw>ENTITY</kw> or <kw>ENTITIES</kw>.</p>
+</wfcnote>
+<wfcnote id="norecursion"><head>No Recursion</head><p>A parsed entity must
+not contain a recursive reference to itself, either directly or indirectly.</p>
+</wfcnote>
+<wfcnote id="indtd"><head>In DTD</head><p>Parameter-entity references may
+only appear in the <termref def="dt-doctype">DTD</termref>.</p>
+</wfcnote>
+<p>Examples of character and entity references:</p>
+<eg>Type &lt;key>less-than&lt;/key> (&hcro;3C;) to save options.
+This document was prepared on &amp;docdate; and
+is classified &amp;security-level;.</eg>
+<p>Example of a parameter-entity reference:</p>
+<eg><![CDATA[<!-- declare the parameter entity "ISOLat2"... -->
+<!ENTITY % ISOLat2
+ SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
+<!-- ... now reference it. -->
+%ISOLat2;]]></eg>
+</div2>
+<div2 id="sec-entity-decl">
+<head>Entity Declarations</head>
+<p><termdef id="dt-entdecl" term="entity declaration"> Entities are declared
+thus:</termdef></p>
+<scrap lang="ebnf">
+<head>Entity Declaration</head>
+<prodgroup pcw2="5" pcw4="18.5">
+<prod id="NT-EntityDecl">
+<lhs>EntityDecl</lhs><rhs><nt def="NT-GEDecl">GEDecl</nt><!--</rhs><com>General entities</com>
+<rhs>--> | <nt def="NT-PEDecl">PEDecl</nt></rhs>
+<!--<com>Parameter entities</com>-->
+</prod>
+<prod id="NT-GEDecl">
+<lhs>GEDecl</lhs><rhs>'&lt;!ENTITY' <nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt> <nt
+def="NT-S">S</nt> <nt def="NT-EntityDef">EntityDef</nt> <nt def="NT-S">S</nt>?
+'>'</rhs>
+</prod>
+<prod id="NT-PEDecl">
+<lhs>PEDecl</lhs><rhs>'&lt;!ENTITY' <nt def="NT-S">S</nt> '%' <nt def="NT-S">S</nt> <nt
+def="NT-Name">Name</nt> <nt def="NT-S">S</nt> <nt def="NT-PEDef">PEDef</nt> <nt
+def="NT-S">S</nt>? '>'</rhs>
+<!--<com>Parameter entities</com>-->
+</prod>
+<prod id="NT-EntityDef">
+<lhs>EntityDef</lhs><rhs><nt def="NT-EntityValue">EntityValue</nt> <!--</rhs>
+<rhs>-->| (<nt def="NT-ExternalID">ExternalID</nt> <nt def="NT-NDataDecl">NDataDecl</nt>?)</rhs>
+<!-- <nt def='NT-ExternalDef'>ExternalDef</nt></rhs> -->
+</prod>
+<!-- FINAL EDIT: what happened to WFs here? -->
+<prod id="NT-PEDef">
+<lhs>PEDef</lhs><rhs><nt def="NT-EntityValue">EntityValue</nt> | <nt def="NT-ExternalID">ExternalID</nt></rhs>
+</prod>
+</prodgroup></scrap>
+<p>The <nt def="NT-Name">Name</nt> identifies the entity in an <termref def="dt-entref">entity
+reference</termref> or, in the case of an unparsed entity, in the value of
+an <kw>ENTITY</kw> or <kw>ENTITIES</kw> attribute. If the same entity is declared
+more than once, the first declaration encountered is binding; at user option,
+an XML processor may issue a warning if entities are declared multiple times.</p>
+<div3 id="sec-internal-ent">
+<head>Internal Entities</head>
+<p><termdef id="dt-internent" term="Internal Entity Replacement Text">If the
+entity definition is an <nt def="NT-EntityValue">EntityValue</nt>, the defined
+entity is called an <term>internal entity</term>. There is no separate physical
+storage object, and the content of the entity is given in the declaration.</termdef>
+Note that some processing of entity and character references in the <termref
+def="dt-litentval">literal entity value</termref> may be required to produce
+the correct <termref def="dt-repltext">replacement text</termref>: see <specref
+ref="intern-replacement"/>.</p>
+<p>An internal entity is a <termref def="dt-parsedent">parsed entity</termref>.</p>
+<p>Example of an internal entity declaration:</p>
+<eg>&lt;!ENTITY Pub-Status "This is a pre-release of the
+ specification."></eg>
+</div3>
+<div3 id="sec-external-ent">
+<head>External Entities</head>
+<p><termdef id="dt-extent" term="External Entity">If the entity is not internal,
+it is an <term>external entity</term>, declared as follows:</termdef></p>
+<scrap lang="ebnf">
+<head>External Entity Declaration</head>
+<!--
+<prod id='NT-ExternalDef'><lhs>ExternalDef</lhs>
+<rhs></prod> -->
+<prod id="NT-ExternalID">
+<lhs>ExternalID</lhs><rhs>'SYSTEM' <nt def="NT-S">S</nt> <nt def="NT-SystemLiteral">SystemLiteral</nt></rhs>
+<rhs>| 'PUBLIC' <nt def="NT-S">S</nt> <nt def="NT-PubidLiteral">PubidLiteral</nt> <nt
+def="NT-S">S</nt> <nt def="NT-SystemLiteral">SystemLiteral</nt> </rhs>
+</prod>
+<prod id="NT-NDataDecl">
+<lhs>NDataDecl</lhs><rhs><nt def="NT-S">S</nt> 'NDATA' <nt def="NT-S">S</nt> <nt
+def="NT-Name">Name</nt></rhs><vc def="not-declared"/>
+</prod>
+</scrap>
+<p>If the <nt def="NT-NDataDecl">NDataDecl</nt> is present, this is a general <termref
+def="dt-unparsed">unparsed entity</termref>; otherwise it is a parsed entity.</p>
+<vcnote id="not-declared"><head>Notation Declared</head><p>The <nt def="NT-Name">Name</nt>
+must match the declared name of a <termref def="dt-notation">notation</termref>.</p>
+</vcnote>
+<p><phrase diff="chg"><termdef id="dt-sysid" term="System Identifier">The <nt
+def="NT-SystemLiteral">SystemLiteral</nt> is called the entity's <term>system
+identifier</term>. It is a <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E88">[E88]</loc>URI
+reference</phrase><phrase diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E66">[E66]</loc>
+(as defined in <bibref ref="rfc2396"/>, updated by <bibref ref="rfc2732"/>)</phrase>, <loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E76">[E76]</loc>meant
+to be dereferenced to obtain input for the XML processor to construct the
+entity's replacement text.</termdef> It is an error for a fragment identifier
+(beginning with a <code>#</code> character) to be part of a system identifier.</phrase>
+Unless otherwise provided by information outside the scope of this specification
+(e.g. a special XML element type defined by a particular DTD, or a processing
+instruction defined by a particular application specification), relative URIs
+are relative to the location of the resource within which the entity declaration
+occurs. A URI might thus be relative to the <termref def="dt-docent">document
+entity</termref>, to the entity containing the <termref def="dt-doctype">external
+DTD subset</termref>, or to some other <termref def="dt-extent">external parameter
+entity</termref>.</p>
+<p diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E78">[E78]</loc>URI
+references require encoding and escaping of certain characters. The disallowed
+characters include all non-ASCII characters, plus the excluded characters
+listed in Section 2.4 of <bibref ref="rfc2396"/>, except for the number sign
+(<code>#</code>) and percent sign (<code>%</code>) characters and the square
+bracket characters re-allowed in <bibref ref="rfc2732"/>. Disallowed characters
+must be escaped as follows:</p>
+<olist diff="add">
+<item><p>Each disallowed character is converted to UTF-8 <bibref ref="rfc2279"/>
+as one or more bytes.</p></item>
+<item><p>Any octets corresponding to a disallowed character are escaped with
+the URI escaping mechanism (that is, converted to <code>%</code><var>HH</var>,
+where HH is the hexadecimal notation of the byte value).</p></item>
+<item><p>The original character is replaced by the resulting character sequence.</p>
+</item>
+</olist>
+<p><termdef id="dt-pubid" term="Public identifier"> In addition to a system
+identifier, an external identifier may include a <term>public identifier</term>.</termdef>
+An XML processor attempting to retrieve the entity's content may use the public
+identifier to try to generate an alternative <phrase diff="chg"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E88">[E88]</loc>URI reference</phrase>.
+If the processor is unable to do so, it must use the <phrase diff="chg"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E88">[E88]</loc>URI
+reference</phrase> specified in the system literal. Before a match is attempted,
+all strings of white space in the public identifier must be normalized to
+single space characters (#x20), and leading and trailing white space must
+be removed.</p>
+<p>Examples of external entity declarations:</p>
+<eg>&lt;!ENTITY open-hatch
+ SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
+&lt;!ENTITY open-hatch
+ PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
+ "http://www.textuality.com/boilerplate/OpenHatch.xml">
+&lt;!ENTITY hatch-pic
+ SYSTEM "../grafix/OpenHatch.gif"
+ NDATA gif ></eg>
+</div3>
+</div2>
+<div2 id="TextEntities">
+<head>Parsed Entities</head>
+<div3 id="sec-TextDecl">
+<head>The Text Declaration</head>
+<p>External parsed entities <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E107">[E107]</loc>should</phrase
+> each begin with a <term>text declaration</term>.</p>
+<scrap lang="ebnf">
+<head>Text Declaration</head>
+<prodgroup pcw4="12.5" pcw5="13">
+<prod id="NT-TextDecl">
+<lhs>TextDecl</lhs><rhs>&pio; <nt def="NT-VersionInfo">VersionInfo</nt>? <nt
+def="NT-EncodingDecl">EncodingDecl</nt> <nt def="NT-S">S</nt>? &pic;</rhs>
+</prod>
+</prodgroup></scrap>
+<p>The text declaration must be provided literally, not by reference to a
+parsed entity. No text declaration may appear at any position other than the
+beginning of an external parsed entity. <phrase diff="add"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E94">[E94]</loc>The text declaration
+in an external parsed entity is not considered part of its <termref def="dt-repltext">replacement
+text</termref>.</phrase></p>
+</div3>
+<div3 id="wf-entities">
+<head>Well-Formed Parsed Entities</head>
+<p>The document entity is well-formed if it matches the production labeled <nt
+def="NT-document">document</nt>. An external general parsed entity is well-formed
+if it matches the production labeled <nt def="NT-extParsedEnt">extParsedEnt</nt>. <phrase
+diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</loc>All
+external parameter entities are well-formed by definition.</phrase></p>
+<scrap lang="ebnf">
+<head>Well-Formed External Parsed Entity</head>
+<prod id="NT-extParsedEnt">
+<lhs>extParsedEnt</lhs><rhs><nt def="NT-TextDecl">TextDecl</nt>? <nt def="NT-content">content</nt></rhs>
+</prod>
+<prod id="NT-extPE" diff="del">
+<lhs>extPE</lhs><rhs><nt def="NT-TextDecl">TextDecl</nt>? <nt def="NT-extSubsetDecl">extSubsetDecl</nt></rhs>
+<com><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</loc></com>
+</prod>
+</scrap>
+<p>An internal general parsed entity is well-formed if its replacement text
+matches the production labeled <nt def="NT-content">content</nt>. All internal
+parameter entities are well-formed by definition.</p>
+<p>A consequence of well-formedness in entities is that the logical and physical
+structures in an XML document are properly nested; no <termref def="dt-stag">start-tag</termref>, <termref
+def="dt-etag">end-tag</termref>, <termref def="dt-empty">empty-element tag</termref>, <termref
+def="dt-element">element</termref>, <termref def="dt-comment">comment</termref>, <termref
+def="dt-pi">processing instruction</termref>, <termref def="dt-charref">character
+reference</termref>, or <termref def="dt-entref">entity reference</termref>
+can begin in one entity and end in another.</p>
+</div3>
+<div3 id="charencoding">
+<head>Character Encoding in Entities</head>
+<p>Each external parsed entity in an XML document may use a different encoding
+for its characters. All XML processors must be able to read entities in <phrase
+diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E56">[E56]</loc>both
+the UTF-8 and UTF-16 encodings.</phrase> <phrase diff="add"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E77">[E77]</loc>The terms <quote>UTF-8</quote>
+and <quote>UTF-16</quote> in this specification do not apply to character
+encodings with any other labels, even if the encodings or labels are very
+similar to UTF-8 or UTF-16.</phrase></p>
+<p>Entities encoded in UTF-16 must begin with the Byte Order Mark described
+by <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</loc>Annex
+F of <bibref ref="ISO10646"/>, Annex H of <bibref ref="ISO10646-2000"/>, section
+2.4 of <bibref ref="Unicode"/>, and section 2.7 of <bibref ref="Unicode3"/></phrase>
+(the ZERO WIDTH NO-BREAK SPACE character, #xFEFF). This is an encoding signature,
+not part of either the markup or the character data of the XML document. XML
+processors must be able to use this character to differentiate between UTF-8
+and UTF-16 encoded documents.</p>
+<p>Although an XML processor is required to read only entities in the UTF-8
+and UTF-16 encodings, it is recognized that other encodings are used around
+the world, and it may be desired for XML processors to read entities that
+use them. <phrase diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E47">[E47]</loc>In
+the absence of external character encoding information (such as MIME headers),</phrase>
+parsed entities which are stored in an encoding other than UTF-8 or UTF-16
+must begin with a text declaration <phrase diff="add">(see <specref ref="sec-TextDecl"/>) </phrase>containing
+an encoding declaration:</p>
+<scrap lang="ebnf">
+<head>Encoding Declaration</head>
+<prod id="NT-EncodingDecl">
+<lhs>EncodingDecl</lhs><rhs><nt def="NT-S">S</nt> 'encoding' <nt def="NT-Eq">Eq</nt>
+('"' <nt def="NT-EncName">EncName</nt> '"' | "'" <nt def="NT-EncName">EncName</nt>
+"'" ) </rhs>
+</prod>
+<prod id="NT-EncName">
+<lhs>EncName</lhs><rhs>[A-Za-z] ([A-Za-z0-9._] | '-')*</rhs><com>Encoding
+name contains only Latin characters</com>
+</prod>
+</scrap>
+<p>In the <termref def="dt-docent">document entity</termref>, the encoding
+declaration is part of the <termref def="dt-xmldecl">XML declaration</termref>.
+The <nt def="NT-EncName">EncName</nt> is the name of the encoding used.</p>
+<!-- FINAL EDIT: check name of IANA and charset names -->
+<p>In an encoding declaration, the values <quote><code>UTF-8</code></quote>, <quote><code>UTF-16</code></quote>, <quote><code>ISO-10646-UCS-2</code
+></quote>, and <quote><code>ISO-10646-UCS-4</code></quote> should be used
+for the various encodings and transformations of Unicode / ISO/IEC 10646,
+the values <quote><code>ISO-8859-1</code></quote>, <quote><code>ISO-8859-2</code></quote>,
+... <loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E106">[E106]</loc><phrase
+diff="chg"><quote><code>ISO-8859-</code><var>n</var></quote> (where <var>n</var>
+is the part number)</phrase> should be used for the parts of ISO 8859, and
+the values <quote><code>ISO-2022-JP</code></quote>, <quote><code>Shift_JIS</code></quote>,
+and <quote><code>EUC-JP</code></quote> should be used for the various encoded
+forms of JIS X-0208-1997. <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E57">[E57]</loc>It
+is recommended that character encodings registered (as <emph>charset</emph>s)
+with the Internet Assigned Numbers Authority <phrase diff="chg"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E58">[E58]</loc><bibref ref="IANA"/></phrase>,
+other than those just listed, be referred to using their registered names;
+other encodings should use names starting with an <quote>x-</quote> prefix.
+XML processors should match character encoding names in a case-insensitive
+way and should either interpret an IANA-registered name as the encoding registered
+at IANA for that name or treat it as unknown (processors are, of course, not
+required to support all IANA-registered encodings).</phrase></p>
+<p>In the absence of information provided by an external transport protocol
+(e.g. HTTP or MIME), it is an <termref def="dt-error">error</termref> for
+an entity including an encoding declaration to be presented to the XML processor
+in an encoding other than that named in the declaration, <phrase diff="del"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E5">[E5]</loc>for
+an encoding declaration to occur other than at the beginning of an external
+entity, </phrase>or for an entity which begins with neither a Byte Order Mark
+nor an encoding declaration to use an encoding other than UTF-8. Note that
+since ASCII is a subset of UTF-8, ordinary ASCII entities do not strictly
+need an encoding declaration.</p>
+<p diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E5">[E5]</loc>It
+is <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E36">[E36]</loc>a
+fatal</phrase> error for a <nt def="NT-TextDecl">TextDecl</nt> to occur other
+than at the beginning of an external entity.</p>
+<p>It is a <termref def="dt-fatal">fatal error</termref> when an XML processor
+encounters an entity with an encoding that it is unable to process. <phrase
+diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E79">[E79]</loc>It
+is a fatal error if an XML entity is determined (via default, encoding declaration,
+or higher-level protocol) to be in a certain encoding but contains octet sequences
+that are not legal in that encoding. It is also a fatal error if an XML entity
+contains no encoding declaration and its content is not legal UTF-8 or UTF-16.</phrase></p>
+<p>Examples of <phrase diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E23">[E23]</loc>text
+declarations containing </phrase>encoding declarations:</p>
+<eg>&lt;?xml encoding='UTF-8'?>
+&lt;?xml encoding='EUC-JP'?></eg>
+</div3>
+</div2>
+<div2 id="entproc">
+<head>XML Processor Treatment of Entities and References</head>
+<p>The table below summarizes the contexts in which character references,
+entity references, and invocations of unparsed entities might appear and the
+required behavior of an <termref def="dt-xml-proc">XML processor</termref>
+in each case. The labels in the leftmost column describe the recognition context: <glist>
+<gitem><label>Reference in Content</label>
+<def>
+<p>as a reference anywhere after the <termref def="dt-stag">start-tag</termref>
+and before the <termref def="dt-etag">end-tag</termref> of an element; corresponds
+to the nonterminal <nt def="NT-content">content</nt>.</p>
+</def></gitem>
+<gitem><label>Reference in Attribute Value</label>
+<def>
+<p>as a reference within either the value of an attribute in a <termref def="dt-stag">start-tag</termref>,
+or a default value in an <termref def="dt-attdecl">attribute declaration</termref>;
+corresponds to the nonterminal <nt def="NT-AttValue">AttValue</nt>.</p>
+</def></gitem>
+<gitem><label>Occurs as Attribute Value</label>
+<def>
+<p>as a <nt def="NT-Name">Name</nt>, not a reference, appearing either as
+the value of an attribute which has been declared as type <kw>ENTITY</kw>,
+or as one of the space-separated tokens in the value of an attribute which
+has been declared as type <kw>ENTITIES</kw>.</p>
+</def></gitem>
+<gitem><label>Reference in Entity Value</label>
+<def>
+<p>as a reference within a parameter or internal entity's <termref def="dt-litentval">literal
+entity value</termref> in the entity's declaration; corresponds to the nonterminal <nt
+def="NT-EntityValue">EntityValue</nt>.</p>
+</def></gitem>
+<gitem><label>Reference in DTD</label>
+<def>
+<p diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E90">[E90]</loc>as
+a reference within either the internal or external subsets of the <termref
+def="dt-doctype">DTD</termref>, but outside of an <nt def="NT-EntityValue">EntityValue</nt>, <nt
+def="NT-AttValue">AttValue</nt>, <nt def="NT-PI">PI</nt>, <nt def="NT-Comment">Comment</nt>, <nt
+def="NT-SystemLiteral">SystemLiteral</nt>, <nt def="NT-PubidLiteral">PubidLiteral</nt>,
+or the contents of an ignored conditional section (see <specref ref="sec-condition-sect"/>).</p>
+<p>.</p>
+</def></gitem>
+</glist></p>
+<table border="1" frame="border" cellpadding="7"><tbody align="center"><tr>
+<td rowspan="2" colspan="1"></td><td colspan="4" align="center" valign="bottom">Entity
+Type</td><td rowspan="2" align="center">Character</td></tr><tr align="center"
+valign="bottom"><td>Parameter</td><td>Internal General</td><td>External Parsed
+General</td><td>Unparsed</td></tr><tr align="center" valign="middle"><td align="right">Reference
+in Content</td><td><titleref href="#not-recognized">Not recognized</titleref></td>
+<td><titleref href="#included">Included</titleref></td><td><titleref href="#include-if-valid">Included
+if validating</titleref></td><td><titleref href="#forbidden">Forbidden</titleref></td>
+<td><titleref href="#included">Included</titleref></td></tr><tr align="center"
+valign="middle"><td align="right">Reference in Attribute Value</td><td><titleref
+href="#not-recognized">Not recognized</titleref></td><td><titleref href="#inliteral">Included
+in literal</titleref></td><td><titleref href="#forbidden">Forbidden</titleref></td>
+<td><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E51">[E51]</loc><titleref
+diff="chg" href="#forbidden">Forbidden</titleref></td><td><titleref href="#included">Included</titleref></td>
+</tr><tr align="center" valign="middle"><td align="right">Occurs as Attribute
+Value</td><td><titleref href="#not-recognized">Not recognized</titleref></td>
+<td><titleref href="#forbidden">Forbidden</titleref></td><td><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E51">[E51]</loc><titleref
+diff="chg" href="#forbidden">Forbidden</titleref></td><td><titleref href="#notify">Notify</titleref></td>
+<td><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E51">[E51]</loc><titleref
+diff="chg" href="#not-recognized">Not recognized</titleref></td></tr><tr align="center"
+valign="middle"><td align="right">Reference in EntityValue</td><td><titleref
+href="#inliteral">Included in literal</titleref></td><td><titleref href="#bypass">Bypassed</titleref></td>
+<td><titleref href="#bypass">Bypassed</titleref></td><td><titleref href="#forbidden">Forbidden</titleref></td>
+<td><titleref href="#included">Included</titleref></td></tr><tr align="center"
+valign="middle"><td align="right">Reference in DTD</td><td><titleref href="#as-PE">Included
+as PE</titleref></td><td><titleref href="#forbidden">Forbidden</titleref></td>
+<td><titleref href="#forbidden">Forbidden</titleref></td><td><titleref href="#forbidden">Forbidden</titleref></td>
+<td><titleref href="#forbidden">Forbidden</titleref></td></tr></tbody></table>
+<div3 id="not-recognized">
+<head>Not Recognized</head>
+<p>Outside the DTD, the <code>%</code> character has no special significance;
+thus, what would be parameter entity references in the DTD are not recognized
+as markup in <nt def="NT-content">content</nt>. Similarly, the names of unparsed
+entities are not recognized except when they appear in the value of an appropriately
+declared attribute.</p>
+</div3>
+<div3 id="included">
+<head>Included</head>
+<p><termdef id="dt-include" term="Include">An entity is <term>included</term>
+when its <termref def="dt-repltext">replacement text</termref> is retrieved
+and processed, in place of the reference itself, as though it were part of
+the document at the location the reference was recognized.</termdef> The replacement
+text may contain both <termref def="dt-chardata">character data</termref>
+and (except for parameter entities) <termref def="dt-markup">markup</termref>,
+which must be recognized in the usual way<phrase diff="del"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E65">[E65]</loc>, except that
+the replacement text of entities used to escape markup delimiters (the entities &magicents;)
+is always treated as data</phrase>. (The string <quote><code>AT&amp;amp;T;</code></quote>
+expands to <quote><code>AT&amp;T;</code></quote> and the remaining ampersand
+is not recognized as an entity-reference delimiter.) A character reference
+is <term>included</term> when the indicated character is processed in place
+of the reference itself. </p>
+</div3>
+<div3 id="include-if-valid">
+<head>Included If Validating</head>
+<p>When an XML processor recognizes a reference to a parsed entity, in order
+to <termref def="dt-valid">validate</termref> the document, the processor
+must <termref def="dt-include">include</termref> its replacement text. If
+the entity is external, and the processor is not attempting to validate the
+XML document, the processor <termref def="dt-may">may</termref>, but need
+not, include the entity's replacement text. If a non-validating <phrase diff="chg"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E95">[E95]</loc>processor</phrase>
+does not include the replacement text, it must inform the application that
+it recognized, but did not read, the entity.</p>
+<p>This rule is based on the recognition that the automatic inclusion provided
+by the SGML and XML entity mechanism, primarily designed to support modularity
+in authoring, is not necessarily appropriate for other applications, in particular
+document browsing. Browsers, for example, when encountering an external parsed
+entity reference, might choose to provide a visual indication of the entity's
+presence and retrieve it for display only on demand.</p>
+</div3>
+<div3 id="forbidden">
+<head>Forbidden</head>
+<p>The following are forbidden, and constitute <termref def="dt-fatal">fatal</termref>
+errors:</p>
+<ulist>
+<item><p>the appearance of a reference to an <termref def="dt-unparsed">unparsed
+entity</termref>.</p></item>
+<item><p>the appearance of any character or general-entity reference in the
+DTD except within an <nt def="NT-EntityValue">EntityValue</nt> or <nt def="NT-AttValue">AttValue</nt>.</p>
+</item>
+<item><p>a reference to an external entity in an attribute value.</p></item>
+</ulist>
+</div3>
+<div3 id="inliteral">
+<head>Included in Literal</head>
+<p>When an <termref def="dt-entref">entity reference</termref> appears in
+an attribute value, or a parameter entity reference appears in a literal entity
+value, its <termref def="dt-repltext">replacement text</termref> is processed
+in place of the reference itself as though it were part of the document at
+the location the reference was recognized, except that a single or double
+quote character in the replacement text is always treated as a normal data
+character and will not terminate the literal. For example, this is well-formed:</p>
+<eg diff="chg">&lt;!-- <loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E4">[E4]</loc> -->
+<![CDATA[<!ENTITY % YN '"Yes"' >
+<!ENTITY WhatHeSaid "He said %YN;" >]]></eg>
+<p>while this is not:</p>
+<eg>&lt;!ENTITY EndAttr "27'" >
+&lt;element attribute='a-&amp;EndAttr;></eg>
+</div3>
+<div3 id="notify">
+<head>Notify</head>
+<p>When the name of an <termref def="dt-unparsed">unparsed entity</termref>
+appears as a token in the value of an attribute of declared type <kw>ENTITY</kw>
+or <kw>ENTITIES</kw>, a validating processor must inform the application of
+the <termref def="dt-sysid">system</termref> and <termref def="dt-pubid">public</termref>
+(if any) identifiers for both the entity and its associated <termref def="dt-notation">notation</termref>.</p>
+</div3>
+<div3 id="bypass">
+<head>Bypassed</head>
+<p>When a general entity reference appears in the <nt def="NT-EntityValue">EntityValue</nt>
+in an entity declaration, it is bypassed and left as is.</p>
+</div3>
+<div3 id="as-PE">
+<head>Included as PE</head>
+<p>Just as with external parsed entities, parameter entities need only be <titleref
+href="#include-if-valid">included if validating</titleref>. When a parameter-entity
+reference is recognized in the DTD and included, its <termref def="dt-repltext">replacement
+text</termref> is enlarged by the attachment of one leading and one following
+space (#x20) character; the intent is to constrain the replacement text of
+parameter entities to contain an integral number of grammatical tokens in
+the DTD. <phrase diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E96">[E96]</loc>This
+behavior does not apply to parameter entity references within entity values;
+these are described in <specref ref="inliteral"/>.</phrase></p>
+</div3>
+</div2>
+<div2 id="intern-replacement">
+<head>Construction of Internal Entity Replacement Text</head>
+<p>In discussing the treatment of internal entities, it is useful to distinguish
+two forms of the entity's value. <termdef id="dt-litentval" term="Literal Entity Value">The <term>literal
+entity value</term> is the quoted string actually present in the entity declaration,
+corresponding to the non-terminal <nt def="NT-EntityValue">EntityValue</nt>.</termdef> <termdef
+id="dt-repltext" term="Replacement Text">The <term>replacement text</term>
+is the content of the entity, after replacement of character references and
+parameter-entity references.</termdef></p>
+<p>The literal entity value as given in an internal entity declaration (<nt
+def="NT-EntityValue">EntityValue</nt>) may contain character, parameter-entity,
+and general-entity references. Such references must be contained entirely
+within the literal entity value. The actual replacement text that is <termref
+def="dt-include">included</termref> as described above must contain the <emph>replacement
+text</emph> of any parameter entities referred to, and must contain the character
+referred to, in place of any character references in the literal entity value;
+however, general-entity references must be left as-is, unexpanded. For example,
+given the following declarations:</p>
+<eg><![CDATA[<!ENTITY % pub "&#xc9;ditions Gallimard" >
+<!ENTITY rights "All rights reserved" >
+<!ENTITY book "La Peste: Albert Camus,
+&#xA9; 1947 %pub;. &rights;" >]]></eg>
+<p>then the replacement text for the entity <quote><code>book</code></quote>
+is:</p>
+<eg>La Peste: Albert Camus,
+© 1947 Éditions Gallimard. &amp;rights;</eg>
+<p>The general-entity reference <quote><code>&amp;rights;</code></quote> would
+be expanded should the reference <quote><code>&amp;book;</code></quote> appear
+in the document's content or an attribute value.</p>
+<p>These simple rules may have complex interactions; for a detailed discussion
+of a difficult example, see <specref ref="sec-entexpand"/>.</p>
+</div2>
+<div2 id="sec-predefined-ent">
+<head>Predefined Entities</head>
+<p><termdef id="dt-escape" term="escape">Entity and character references can
+both be used to <term>escape</term> the left angle bracket, ampersand, and
+other delimiters. A set of general entities (&magicents;) is specified for
+this purpose. Numeric character references may also be used; they are expanded
+immediately when recognized and must be treated as character data, so the
+numeric character references <quote><code>&amp;#60;</code></quote> and <quote><code>&amp;#38;</code></quote>
+may be used to escape <code>&lt;</code> and <code>&amp;</code> when they occur
+in character data.</termdef></p>
+<p>All XML processors must recognize these entities whether they are declared
+or not. <termref def="dt-interop">For interoperability</termref>, valid XML
+documents should declare these entities, like any others, before using them. <phrase
+diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E80">[E80]</loc>If
+the entities <code>lt</code> or <code>amp</code> are declared, they must be
+declared as internal entities whose replacement text is a character reference
+to the <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E103">[E103]</loc>respective
+character (less-than sign or ampersand)</phrase> being escaped; the double
+escaping is required for these entities so that references to them produce
+a well-formed result. If the entities <code>gt</code>, <code>apos</code>,
+or <code>quot</code> are declared, they must be declared as internal entities
+whose replacement text is the single character being escaped (or a character
+reference to that character; the double escaping here is unnecessary but harmless).
+For example:</phrase></p>
+<eg><![CDATA[<!ENTITY lt "&#38;#60;">
+<!ENTITY gt "&#62;">
+<!ENTITY amp "&#38;#38;">
+<!ENTITY apos "&#39;">
+<!ENTITY quot "&#34;">]]></eg>
+<p diff="del">Note that the <code>&lt;</code> and <code>&amp;</code> characters
+in the declarations of <quote><code>lt</code></quote> and <quote><code>amp</code></quote>
+are doubly escaped to meet the requirement that entity replacement be well-formed.</p>
+</div2>
+<div2 id="Notations">
+<head>Notation Declarations</head>
+<p><termdef id="dt-notation" term="Notation"><term>Notations</term> identify
+by name the format of <termref def="dt-extent">unparsed entities</termref>,
+the format of elements which bear a notation attribute, or the application
+to which a <termref def="dt-pi">processing instruction</termref> is addressed.</termdef></p>
+<p><termdef id="dt-notdecl" term="Notation Declaration"> <term>Notation declarations</term>
+provide a name for the notation, for use in entity and attribute-list declarations
+and in attribute specifications, and an external identifier for the notation
+which may allow an XML processor or its client application to locate a helper
+application capable of processing data in the given notation.</termdef></p>
+<scrap lang="ebnf">
+<head>Notation Declarations</head>
+<prod id="NT-NotationDecl">
+<lhs>NotationDecl</lhs><rhs>'&lt;!NOTATION' <nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt> <nt
+def="NT-S">S</nt> (<nt def="NT-ExternalID">ExternalID</nt> | <nt def="NT-PublicID">PublicID</nt>) <nt
+def="NT-S">S</nt>? '>'</rhs><vc def="UniqueNotationName" diff="add"/>
+</prod>
+<prod id="NT-PublicID">
+<lhs>PublicID</lhs><rhs>'PUBLIC' <nt def="NT-S">S</nt> <nt def="NT-PubidLiteral">PubidLiteral</nt> </rhs>
+</prod>
+</scrap>
+<vcnote id="UniqueNotationName" diff="add"><head><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E22">[E22]</loc>Unique
+Notation Name</head><p>Only one notation declaration can declare a given <nt
+def="NT-Name">Name</nt>.</p>
+</vcnote>
+<p>XML processors must provide applications with the name and external identifier(s)
+of any notation declared and referred to in an attribute value, attribute
+definition, or entity declaration. They may additionally resolve the external
+identifier into the <termref def="dt-sysid">system identifier</termref>, file
+name, or other information needed to allow the application to call a processor
+for data in the notation described. (It is not an error, however, for XML
+documents to declare and refer to notations for which notation-specific applications
+are not available on the system where the XML processor or application is
+running.)</p>
+</div2>
+<div2 id="sec-doc-entity">
+<head>Document Entity</head>
+<p><termdef id="dt-docent" term="Document Entity">The <term>document entity</term>
+serves as the root of the entity tree and a starting-point for an <termref
+def="dt-xml-proc">XML processor</termref>.</termdef> This specification does
+not specify how the document entity is to be located by an XML processor;
+unlike other entities, the document entity has no name and might well appear
+on a processor input stream without any identification at all.</p>
+</div2>
+</div1>
+<!-- &Conformance; -->
+<div1 id="sec-conformance">
+<head>Conformance</head>
+<div2 id="proc-types">
+<head>Validating and Non-Validating Processors</head>
+<p>Conforming <termref def="dt-xml-proc">XML processors</termref> fall into
+two classes: validating and non-validating.</p>
+<p>Validating and non-validating processors alike must report violations of
+this specification's well-formedness constraints in the content of the <termref
+def="dt-docent">document entity</termref> and any other <termref def="dt-parsedent">parsed
+entities</termref> that they read.</p>
+<p><termdef id="dt-validating" term="Validating Processor"><term>Validating
+processors</term> must<phrase diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E21">[E21]</loc>,
+at user option,</phrase> report violations of the constraints expressed by
+the declarations in the <termref def="dt-doctype">DTD</termref>, and failures
+to fulfill the validity constraints given in this specification.</termdef>
+To accomplish this, validating XML processors must read and process the entire
+DTD and all external parsed entities referenced in the document.</p>
+<p>Non-validating processors are required to check only the <termref def="dt-docent">document
+entity</termref>, including the entire internal DTD subset, for well-formedness. <termdef
+id="dt-use-mdecl" term="Process Declarations"> While they are not required
+to check the document for validity, they are required to <term>process</term>
+all the declarations they read in the internal DTD subset and in any parameter
+entity that they read, up to the first reference to a parameter entity that
+they do <emph>not</emph> read; that is to say, they must use the information
+in those declarations to <titleref href="#AVNormalize">normalize</titleref>
+attribute values, <titleref href="#included">include</titleref> the replacement
+text of internal entities, and supply <titleref href="#sec-attr-defaults">default
+attribute values</titleref>.</termdef> <phrase diff="add"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E33">[E33]</loc>Except when <code>standalone="yes"</code>, </phrase>they
+must not <termref def="dt-use-mdecl">process</termref> <termref def="dt-entdecl">entity
+declarations</termref> or <termref def="dt-attdecl">attribute-list declarations</termref>
+encountered after a reference to a parameter entity that is not read, since
+the entity may have contained overriding declarations.</p>
+</div2>
+<div2 id="safe-behavior">
+<head>Using XML Processors</head>
+<p>The behavior of a validating XML processor is highly predictable; it must
+read every piece of a document and report all well-formedness and validity
+violations. Less is required of a non-validating processor; it need not read
+any part of the document other than the document entity. This has two effects
+that may be important to users of XML processors:</p>
+<ulist>
+<item><p>Certain well-formedness errors, specifically those that require reading
+external entities, may not be detected by a non-validating processor. Examples
+include the constraints entitled <titleref href="#wf-entdeclared">Entity Declared</titleref>, <titleref
+href="#textent">Parsed Entity</titleref>, and <titleref href="#norecursion">No
+Recursion</titleref>, as well as some of the cases described as <titleref
+href="#forbidden">forbidden</titleref> in <specref ref="entproc"/>.</p></item>
+<item><p>The information passed from the processor to the application may
+vary, depending on whether the processor reads parameter and external entities.
+For example, a non-validating processor may not <titleref href="#AVNormalize">normalize</titleref>
+attribute values, <titleref href="#included">include</titleref> the replacement
+text of internal entities, or supply <titleref href="#sec-attr-defaults">default
+attribute values</titleref>, where doing so depends on having read declarations
+in external or parameter entities.</p></item>
+</ulist>
+<p>For maximum reliability in interoperating between different XML processors,
+applications which use non-validating processors should not rely on any behaviors
+not required of such processors. Applications which require facilities such
+as the use of default attributes or internal entities which are declared in
+external entities should use validating XML processors.</p>
+</div2>
+</div1>
+<div1 id="sec-notation">
+<head>Notation</head>
+<p>The formal grammar of XML is given in this specification using a simple
+Extended Backus-Naur Form (EBNF) notation. Each rule in the grammar defines
+one symbol, in the form</p>
+<eg>symbol ::= expression</eg>
+<p>Symbols are written with an initial capital letter if they are <phrase
+diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E42">[E42]</loc>the
+start symbol of a regular language,</phrase> otherwise with an initial lower
+case letter. Literal strings are quoted.</p>
+<p>Within the expression on the right-hand side of a rule, the following expressions
+are used to match strings of one or more characters: <glist>
+<gitem><label><code>#xN</code></label>
+<def>
+<p>where <code>N</code> is a hexadecimal integer, the expression matches the
+character in ISO/IEC 10646 whose canonical (UCS-4) code value, when interpreted
+as an unsigned binary number, has the value indicated. The number of leading
+zeros in the <code>#xN</code> form is insignificant; the number of leading
+zeros in the corresponding code value is governed by the character encoding
+in use and is not significant for XML.</p>
+</def></gitem>
+<gitem><label><code>[a-zA-Z]</code>, <code>[#xN-#xN]</code></label>
+<def>
+<p>matches any <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E93">[E93]</loc><nt
+def="NT-Char">Char</nt></phrase> with a value in the range(s) indicated (inclusive).</p>
+</def></gitem>
+<gitem diff="add"><label><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E3">[E3]</loc><code>[abc]</code>, <code>[#xN#xN#xN]</code
+></label>
+<def>
+<p>matches any <nt def="NT-Char">Char</nt> with a value among the characters
+enumerated. Enumerations and ranges can be mixed in one set of brackets.</p>
+</def></gitem>
+<gitem><label><code>[^a-z]</code>, <code>[^#xN-#xN]</code></label>
+<def>
+<p>matches any <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E93">[E93]</loc><nt
+def="NT-Char">Char</nt></phrase> with a value <emph>outside</emph> the range
+indicated.</p>
+</def></gitem>
+<gitem><label><code>[^abc]</code>, <code>[^#xN#xN#xN]</code></label>
+<def>
+<p>matches any <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E93">[E93]</loc><nt
+def="NT-Char">Char</nt></phrase> with a value not among the characters given. <phrase
+diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E3">[E3]</loc>Enumerations
+and ranges of forbidden values can be mixed in one set of brackets.</phrase></p>
+</def></gitem>
+<gitem><label><code>"string"</code></label>
+<def>
+<p>matches a literal string <termref def="dt-match">matching</termref> that
+given inside the double quotes.</p>
+</def></gitem>
+<gitem><label><code>'string'</code></label>
+<def>
+<p>matches a literal string <termref def="dt-match">matching</termref> that
+given inside the single quotes.</p>
+</def></gitem>
+</glist> These symbols may be combined to match more complex patterns as follows,
+where <code>A</code> and <code>B</code> represent simple expressions: <glist>
+<gitem><label>(<code>expression</code>)</label>
+<def>
+<p><code>expression</code> is treated as a unit and may be combined as described
+in this list.</p>
+</def></gitem>
+<gitem><label><code>A?</code></label>
+<def>
+<p>matches <code>A</code> or nothing; optional <code>A</code>.</p>
+</def></gitem>
+<gitem><label><code>A B</code></label>
+<def>
+<p>matches <code>A</code> followed by <code>B</code>. <phrase diff="add"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E20">[E20]</loc>This
+operator has higher precedence than alternation; thus <code>A B | C D</code>
+is identical to <code>(A B) | (C D)</code>.</phrase></p>
+</def></gitem>
+<gitem><label><code>A | B</code></label>
+<def>
+<p>matches <code>A</code> or <code>B</code> but not both.</p>
+</def></gitem>
+<gitem><label><code>A - B</code></label>
+<def>
+<p>matches any string that matches <code>A</code> but does not match <code>B</code>.</p>
+</def></gitem>
+<gitem><label><code>A+</code></label>
+<def>
+<p>matches one or more occurrences of <code>A</code>.<phrase diff="add"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E20">[E20]</loc>Concatenation
+has higher precedence than alternation; thus <code>A+ | B+</code> is identical
+to <code>(A+) | (B+)</code>.</phrase></p>
+</def></gitem>
+<gitem><label><code>A*</code></label>
+<def>
+<p>matches zero or more occurrences of <code>A</code>. <phrase diff="add"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E20">[E20]</loc>Concatenation
+has higher precedence than alternation; thus <code>A* | B*</code> is identical
+to <code>(A*) | (B*)</code>.</phrase></p>
+</def></gitem>
+</glist> Other notations used in the productions are: <glist>
+<gitem><label><code>/* ... */</code></label>
+<def>
+<p>comment.</p>
+</def></gitem>
+<gitem><label><code>[ wfc: ... ]</code></label>
+<def>
+<p>well-formedness constraint; this identifies by name a constraint on <termref
+def="dt-wellformed">well-formed</termref> documents associated with a production.</p>
+</def></gitem>
+<gitem><label><code>[ vc: ... ]</code></label>
+<def>
+<p>validity constraint; this identifies by name a constraint on <termref def="dt-valid">valid</termref>
+documents associated with a production.</p>
+</def></gitem>
+</glist></p>
+</div1>
+</body><back>
+<!-- &SGML; -->
+<!-- &Biblio; -->
+<div1 id="sec-bibliography">
+<head>References</head>
+<div2 id="sec-existing-stds">
+<head>Normative References</head>
+<blist>
+<bibl id="IANA" diff="chg" key="IANA-CHARSETS"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E58">[E58]</loc>(Internet
+Assigned Numbers Authority) <titleref>Official Names for Character Sets</titleref>,
+ed. Keld Simonsen et al. See <loc href="ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets">ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets</loc
+>. </bibl>
+<bibl id="RFC1766" href="http://www.ietf.org/rfc/rfc1766.txt" key="IETF RFC 1766">IETF
+(Internet Engineering Task Force). <titleref>RFC 1766: Tags for the Identification
+of Languages</titleref>, ed. H. Alvestrand. 1995.</bibl>
+<bibl id="ISO639-old" diff="del" key="ISO 639"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E38">[E38]</loc>
+(International Organization for Standardization). <titleref>ISO 639:1988 (E).
+Code for the representation of names of languages.</titleref> [Geneva]: International
+Organization for Standardization, 1988.</bibl>
+<bibl id="ISO3166-old" diff="del" key="ISO 3166"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E38">[E38]</loc>
+(International Organization for Standardization). <titleref>ISO 3166-1:1997
+(E). Codes for the representation of names of countries and their subdivisions &mdash;
+Part 1: Country codes</titleref> [Geneva]: International Organization for
+Standardization, 1997.</bibl>
+<bibl id="ISO10646" key="ISO/IEC 10646">ISO (International Organization for
+Standardization). <titleref>ISO/IEC 10646-1993 (E). Information technology &mdash;
+Universal Multiple-Octet Coded Character Set (UCS) &mdash; Part 1: Architecture
+and Basic Multilingual Plane.</titleref> [Geneva]: International Organization
+for Standardization, 1993 (plus amendments AM 1 through AM 7).</bibl>
+<bibl id="ISO10646-2000" diff="add" key="ISO/IEC 10646-2000"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</loc> ISO (International
+Organization for Standardization). <titleref>ISO/IEC 10646-1:2000. Information
+technology &mdash; Universal Multiple-Octet Coded Character Set (UCS) &mdash;
+Part 1: Architecture and Basic Multilingual Plane.</titleref> [Geneva]: International
+Organization for Standardization, 2000.</bibl>
+<bibl id="Unicode" key="Unicode">The Unicode Consortium. <emph>The Unicode
+Standard, Version 2.0.</emph> Reading, Mass.: Addison-Wesley Developers Press,
+1996.</bibl>
+<bibl id="Unicode3" diff="add" key="Unicode3"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</loc>
+The Unicode Consortium. <emph>The Unicode Standard, Version 3.0.</emph> Reading,
+Mass.: Addison-Wesley Developers Press, 2000. ISBN 0-201-61633-5.</bibl>
+</blist></div2>
+<div2 id="null">
+<!--
+ID made "null" to match its previous value in the First
+Edition; it's odd, but if there's no set value, the stylesheet
+currently generates an odd string that would be backwards
+incompatible with any references anyone might have made before.
+-->
+<head>Other References</head>
+<blist>
+<bibl id="Aho" key="Aho/Ullman">Aho, Alfred V., Ravi Sethi, and Jeffrey D.
+Ullman. <titleref>Compilers: Principles, Techniques, and Tools</titleref>.
+Reading: Addison-Wesley, 1986, rpt. corr. 1988.</bibl>
+<bibl id="Berners-Lee" key="Berners-Lee et al."> Berners-Lee, T., R. Fielding,
+and L. Masinter. <titleref>Uniform Resource Identifiers (URI): Generic Syntax
+and Semantics</titleref>. 1997. (Work in progress; see updates to RFC1738.)</bibl>
+<bibl id="ABK" diff="chg" key="Brüggemann-Klein"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E2">[E2]</loc>Brüggemann-Klein,
+Anne. Formal Models in Document Processing. Habilitationsschrift. Faculty
+of Mathematics at the University of Freiburg, 1993. (See <loc href="ftp://ftp.informatik.uni-freiburg.de/documents/papers/brueggem/habil.ps">ftp://ftp.informatik.uni-freiburg.de/documents/papers/brueggem/habil.ps</loc
+>.)</bibl>
+<bibl id="ABKDW" diff="chg" key="Brüggemann-Klein and Wood"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E2">[E2]</loc>Brüggemann-Klein,
+Anne, and Derick Wood. <titleref>Deterministic Regular Languages</titleref>.
+Universität Freiburg, Institut für Informatik, Bericht 38, Oktober 1991. Extended
+abstract in A. Finkel, M. Jantzen, Hrsg., STACS 1992, S. 173-184. Springer-Verlag,
+Berlin 1992. Lecture Notes in Computer Science 577. Full version titled <titleref>One-Unambiguous
+Regular Languages</titleref> in Information and Computation 140 (2): 229-253,
+February 1998.</bibl>
+<bibl id="Clark" key="Clark">James Clark. Comparison of SGML and XML. See <loc
+href="http://www.w3.org/TR/NOTE-sgml-xml-971215">http://www.w3.org/TR/NOTE-sgml-xml-971215</loc>. </bibl>
+<bibl id="IANA-LANGCODES" diff="add" href="http://www.isi.edu/in-notes/iana/assignments/languages/"
+key="IANA-LANGCODES"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E58">[E58]</loc>(Internet
+Assigned Numbers Authority) <titleref>Registry of Language Tags</titleref>,
+ed. Keld Simonsen et al.</bibl>
+<bibl id="RFC1738" diff="del" href="http://www.ietf.org/rfc/rfc1738.txt" key="IETF RFC1738">IETF
+(Internet Engineering Task Force). <titleref>RFC 1738: Uniform Resource Locators
+(URL)</titleref>, ed. T. Berners-Lee, L. Masinter, M. McCahill. 1994. </bibl>
+<bibl id="RFC1808" diff="del" href="http://www.ietf.org/rfc/rfc1808.txt" key="IETF RFC1808">IETF
+(Internet Engineering Task Force). <titleref>RFC 1808: Relative Uniform Resource
+Locators</titleref>, ed. R. Fielding. 1995. </bibl>
+<bibl id="RFC2141" href="http://www.ietf.org/rfc/rfc2141.txt" key="IETF RFC2141">IETF
+(Internet Engineering Task Force). <emph>RFC 2141: URN Syntax</emph>, ed.
+R. Moats. 1997. </bibl>
+<bibl id="rfc2279" diff="add" href="http://www.ietf.org/rfc/rfc2279.txt" key="IETF RFC 2279"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E78">[E78]</loc>IETF
+(Internet Engineering Task Force). <titleref>RFC 2279: UTF-8, a transformation
+format of ISO 10646</titleref>, <phrase diff="add">ed. F. Yergeau, </phrase>1998.</bibl>
+<bibl id="rfc2376" diff="add" href="http://www.ietf.org/rfc/rfc2376.txt" key="IETF RFC 2376"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E48">[E48]</loc>IETF
+(Internet Engineering Task Force). <titleref>RFC 2376: XML Media Types</titleref>.
+ed. E. Whitehead, M. Murata. 1998.</bibl>
+<bibl id="rfc2396" diff="add" href="http://www.ietf.org/rfc/rfc2396.txt" key="IETF RFC 2396"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E66">[E66]</loc>IETF
+(Internet Engineering Task Force). <titleref>RFC 2396: Uniform Resource Identifiers
+(URI): Generic Syntax</titleref>. T. Berners-Lee, R. Fielding, L. Masinter.
+1998.</bibl>
+<bibl id="rfc2732" diff="add" href="http://www.ietf.org/rfc/rfc2732.txt" key="IETF RFC 2732"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E66">[E66]</loc>IETF
+(Internet Engineering Task Force). <titleref>RFC 2732: Format for Literal
+IPv6 Addresses in URL's</titleref>. R. Hinden, B. Carpenter, L. Masinter.
+1999.</bibl>
+<bibl id="rfc2781" diff="add" href="http://www.ietf.org/rfc/rfc2781.txt" key="IETF RFC 2781"><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E77">[E77]</loc>
+IETF (Internet Engineering Task Force). <emph>RFC 2781: UTF-16, an encoding
+of ISO 10646</emph>, ed. P. Hoffman, F. Yergeau. 2000.</bibl>
+<bibl id="ISO639" diff="add" key="ISO 639"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E38">[E38]</loc>
+(International Organization for Standardization). <titleref>ISO 639:1988 (E).
+Code for the representation of names of languages.</titleref> [Geneva]: International
+Organization for Standardization, 1988.</bibl>
+<bibl id="ISO3166" diff="add" key="ISO 3166"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E38">[E38]</loc>
+(International Organization for Standardization). <titleref>ISO 3166-1:1997
+(E). Codes for the representation of names of countries and their subdivisions &mdash;
+Part 1: Country codes</titleref> [Geneva]: International Organization for
+Standardization, 1997.</bibl>
+<bibl id="ISO8879" key="ISO 8879">ISO (International Organization for Standardization). <titleref>ISO
+8879:1986(E). Information processing &mdash; Text and Office Systems &mdash;
+Standard Generalized Markup Language (SGML).</titleref> First edition &mdash;
+1986-10-15. [Geneva]: International Organization for Standardization, 1986. </bibl>
+<bibl id="ISO10744" key="ISO/IEC 10744">ISO (International Organization for
+Standardization). <titleref>ISO/IEC 10744-1992 (E). Information technology &mdash;
+Hypermedia/Time-based Structuring Language (HyTime). </titleref> [Geneva]:
+International Organization for Standardization, 1992. <emph>Extended Facilities
+Annexe.</emph> [Geneva]: International Organization for Standardization, 1996. </bibl>
+<bibl id="websgml" diff="add" href="http://www.sgmlsource.com/8879rev/n0029.htm"
+key="WEBSGML"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E43">[E43]</loc>ISO
+(International Organization for Standardization). <titleref>ISO 8879:1986
+TC2. Information technology &mdash; Document Description and Processing Languages. </titleref>
+[Geneva]: International Organization for Standardization, 1998.</bibl>
+<bibl id="xml-names" diff="add" xmlns:xlink="http://www.w3.org/TR/WD-xlink"
+href="http://www.w3.org/TR/REC-xml-names/" key="XML Names"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E98">[E98]</loc>Tim Bray,
+Dave Hollander, and Andrew Layman, editors. <titleref>Namespaces in XML</titleref>.
+Textuality, Hewlett-Packard, and Microsoft. World Wide Web Consortium, 1999.</bibl>
+</blist></div2>
+</div1>
+<div1 id="CharClasses">
+<head>Character Classes</head>
+<p>Following the characteristics defined in the Unicode standard, characters
+are classed as base characters (among others, these contain the alphabetic
+characters of the Latin alphabet<phrase diff="del"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E84">[E84]</loc>, without
+diacritics</phrase>), ideographic characters, and combining characters (among
+others, this class contains most diacritics)<phrase diff="del"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E30">[E30]</loc>; these classes
+combine to form the class of letters.</phrase> Digits and extenders are also
+distinguished.</p>
+<scrap id="CHARACTERS" lang="ebnf">
+<head>Characters</head>
+<prodgroup pcw3="3" pcw4="15">
+<prod id="NT-Letter">
+<lhs>Letter</lhs><rhs><nt def="NT-BaseChar">BaseChar</nt> | <nt def="NT-Ideographic">Ideographic</nt></rhs>
+</prod>
+<prod id="NT-BaseChar">
+<lhs>BaseChar</lhs><rhs>[#x0041-#x005A] |&nbsp;[#x0061-#x007A] |&nbsp;[#x00C0-#x00D6]
+|&nbsp;[#x00D8-#x00F6] |&nbsp;[#x00F8-#x00FF] |&nbsp;[#x0100-#x0131] |&nbsp;[#x0134-#x013E]
+|&nbsp;[#x0141-#x0148] |&nbsp;[#x014A-#x017E] |&nbsp;[#x0180-#x01C3] |&nbsp;[#x01CD-#x01F0]
+|&nbsp;[#x01F4-#x01F5] |&nbsp;[#x01FA-#x0217] |&nbsp;[#x0250-#x02A8] |&nbsp;[#x02BB-#x02C1]
+|&nbsp;#x0386 |&nbsp;[#x0388-#x038A] |&nbsp;#x038C |&nbsp;[#x038E-#x03A1]
+|&nbsp;[#x03A3-#x03CE] |&nbsp;[#x03D0-#x03D6] |&nbsp;#x03DA |&nbsp;#x03DC
+|&nbsp;#x03DE |&nbsp;#x03E0 |&nbsp;[#x03E2-#x03F3] |&nbsp;[#x0401-#x040C]
+|&nbsp;[#x040E-#x044F] |&nbsp;[#x0451-#x045C] |&nbsp;[#x045E-#x0481] |&nbsp;[#x0490-#x04C4]
+|&nbsp;[#x04C7-#x04C8] |&nbsp;[#x04CB-#x04CC] |&nbsp;[#x04D0-#x04EB] |&nbsp;[#x04EE-#x04F5]
+|&nbsp;[#x04F8-#x04F9] |&nbsp;[#x0531-#x0556] |&nbsp;#x0559 |&nbsp;[#x0561-#x0586]
+|&nbsp;[#x05D0-#x05EA] |&nbsp;[#x05F0-#x05F2] |&nbsp;[#x0621-#x063A] |&nbsp;[#x0641-#x064A]
+|&nbsp;[#x0671-#x06B7] |&nbsp;[#x06BA-#x06BE] |&nbsp;[#x06C0-#x06CE] |&nbsp;[#x06D0-#x06D3]
+|&nbsp;#x06D5 |&nbsp;[#x06E5-#x06E6] |&nbsp;[#x0905-#x0939] |&nbsp;#x093D
+|&nbsp;[#x0958-#x0961] |&nbsp;[#x0985-#x098C] |&nbsp;[#x098F-#x0990] |&nbsp;[#x0993-#x09A8]
+|&nbsp;[#x09AA-#x09B0] |&nbsp;#x09B2 |&nbsp;[#x09B6-#x09B9] |&nbsp;[#x09DC-#x09DD]
+|&nbsp;[#x09DF-#x09E1] |&nbsp;[#x09F0-#x09F1] |&nbsp;[#x0A05-#x0A0A] |&nbsp;[#x0A0F-#x0A10]
+|&nbsp;[#x0A13-#x0A28] |&nbsp;[#x0A2A-#x0A30] |&nbsp;[#x0A32-#x0A33] |&nbsp;[#x0A35-#x0A36]
+|&nbsp;[#x0A38-#x0A39] |&nbsp;[#x0A59-#x0A5C] |&nbsp;#x0A5E |&nbsp;[#x0A72-#x0A74]
+|&nbsp;[#x0A85-#x0A8B] |&nbsp;#x0A8D |&nbsp;[#x0A8F-#x0A91] |&nbsp;[#x0A93-#x0AA8]
+|&nbsp;[#x0AAA-#x0AB0] |&nbsp;[#x0AB2-#x0AB3] |&nbsp;[#x0AB5-#x0AB9] |&nbsp;#x0ABD
+|&nbsp;#x0AE0 |&nbsp;[#x0B05-#x0B0C] |&nbsp;[#x0B0F-#x0B10] |&nbsp;[#x0B13-#x0B28]
+|&nbsp;[#x0B2A-#x0B30] |&nbsp;[#x0B32-#x0B33] |&nbsp;[#x0B36-#x0B39] |&nbsp;#x0B3D
+|&nbsp;[#x0B5C-#x0B5D] |&nbsp;[#x0B5F-#x0B61] |&nbsp;[#x0B85-#x0B8A] |&nbsp;[#x0B8E-#x0B90]
+|&nbsp;[#x0B92-#x0B95] |&nbsp;[#x0B99-#x0B9A] |&nbsp;#x0B9C |&nbsp;[#x0B9E-#x0B9F]
+|&nbsp;[#x0BA3-#x0BA4] |&nbsp;[#x0BA8-#x0BAA] |&nbsp;[#x0BAE-#x0BB5] |&nbsp;[#x0BB7-#x0BB9]
+|&nbsp;[#x0C05-#x0C0C] |&nbsp;[#x0C0E-#x0C10] |&nbsp;[#x0C12-#x0C28] |&nbsp;[#x0C2A-#x0C33]
+|&nbsp;[#x0C35-#x0C39] |&nbsp;[#x0C60-#x0C61] |&nbsp;[#x0C85-#x0C8C] |&nbsp;[#x0C8E-#x0C90]
+|&nbsp;[#x0C92-#x0CA8] |&nbsp;[#x0CAA-#x0CB3] |&nbsp;[#x0CB5-#x0CB9] |&nbsp;#x0CDE
+|&nbsp;[#x0CE0-#x0CE1] |&nbsp;[#x0D05-#x0D0C] |&nbsp;[#x0D0E-#x0D10] |&nbsp;[#x0D12-#x0D28]
+|&nbsp;[#x0D2A-#x0D39] |&nbsp;[#x0D60-#x0D61] |&nbsp;[#x0E01-#x0E2E] |&nbsp;#x0E30
+|&nbsp;[#x0E32-#x0E33] |&nbsp;[#x0E40-#x0E45] |&nbsp;[#x0E81-#x0E82] |&nbsp;#x0E84
+|&nbsp;[#x0E87-#x0E88] |&nbsp;#x0E8A |&nbsp;#x0E8D |&nbsp;[#x0E94-#x0E97]
+|&nbsp;[#x0E99-#x0E9F] |&nbsp;[#x0EA1-#x0EA3] |&nbsp;#x0EA5 |&nbsp;#x0EA7
+|&nbsp;[#x0EAA-#x0EAB] |&nbsp;[#x0EAD-#x0EAE] |&nbsp;#x0EB0 |&nbsp;[#x0EB2-#x0EB3]
+|&nbsp;#x0EBD |&nbsp;[#x0EC0-#x0EC4] |&nbsp;[#x0F40-#x0F47] |&nbsp;[#x0F49-#x0F69]
+|&nbsp;[#x10A0-#x10C5] |&nbsp;[#x10D0-#x10F6] |&nbsp;#x1100 |&nbsp;[#x1102-#x1103]
+|&nbsp;[#x1105-#x1107] |&nbsp;#x1109 |&nbsp;[#x110B-#x110C] |&nbsp;[#x110E-#x1112]
+|&nbsp;#x113C |&nbsp;#x113E |&nbsp;#x1140 |&nbsp;#x114C |&nbsp;#x114E |&nbsp;#x1150
+|&nbsp;[#x1154-#x1155] |&nbsp;#x1159 |&nbsp;[#x115F-#x1161] |&nbsp;#x1163
+|&nbsp;#x1165 |&nbsp;#x1167 |&nbsp;#x1169 |&nbsp;[#x116D-#x116E] |&nbsp;[#x1172-#x1173]
+|&nbsp;#x1175 |&nbsp;#x119E |&nbsp;#x11A8 |&nbsp;#x11AB |&nbsp;[#x11AE-#x11AF]
+|&nbsp;[#x11B7-#x11B8] |&nbsp;#x11BA |&nbsp;[#x11BC-#x11C2] |&nbsp;#x11EB
+|&nbsp;#x11F0 |&nbsp;#x11F9 |&nbsp;[#x1E00-#x1E9B] |&nbsp;[#x1EA0-#x1EF9]
+|&nbsp;[#x1F00-#x1F15] |&nbsp;[#x1F18-#x1F1D] |&nbsp;[#x1F20-#x1F45] |&nbsp;[#x1F48-#x1F4D]
+|&nbsp;[#x1F50-#x1F57] |&nbsp;#x1F59 |&nbsp;#x1F5B |&nbsp;#x1F5D |&nbsp;[#x1F5F-#x1F7D]
+|&nbsp;[#x1F80-#x1FB4] |&nbsp;[#x1FB6-#x1FBC] |&nbsp;#x1FBE |&nbsp;[#x1FC2-#x1FC4]
+|&nbsp;[#x1FC6-#x1FCC] |&nbsp;[#x1FD0-#x1FD3] |&nbsp;[#x1FD6-#x1FDB] |&nbsp;[#x1FE0-#x1FEC]
+|&nbsp;[#x1FF2-#x1FF4] |&nbsp;[#x1FF6-#x1FFC] |&nbsp;#x2126 |&nbsp;[#x212A-#x212B]
+|&nbsp;#x212E |&nbsp;[#x2180-#x2182] |&nbsp;[#x3041-#x3094] |&nbsp;[#x30A1-#x30FA]
+|&nbsp;[#x3105-#x312C] |&nbsp;[#xAC00-#xD7A3] </rhs>
+</prod>
+<prod id="NT-Ideographic">
+<lhs>Ideographic</lhs><rhs>[#x4E00-#x9FA5] |&nbsp;#x3007 |&nbsp;[#x3021-#x3029] </rhs>
+</prod>
+<prod id="NT-CombiningChar">
+<lhs>CombiningChar</lhs><rhs>[#x0300-#x0345] |&nbsp;[#x0360-#x0361] |&nbsp;[#x0483-#x0486]
+|&nbsp;[#x0591-#x05A1] |&nbsp;[#x05A3-#x05B9] |&nbsp;[#x05BB-#x05BD] |&nbsp;#x05BF
+|&nbsp;[#x05C1-#x05C2] |&nbsp;#x05C4 |&nbsp;[#x064B-#x0652] |&nbsp;#x0670
+|&nbsp;[#x06D6-#x06DC] |&nbsp;[#x06DD-#x06DF] |&nbsp;[#x06E0-#x06E4] |&nbsp;[#x06E7-#x06E8]
+|&nbsp;[#x06EA-#x06ED] |&nbsp;[#x0901-#x0903] |&nbsp;#x093C |&nbsp;[#x093E-#x094C]
+|&nbsp;#x094D |&nbsp;[#x0951-#x0954] |&nbsp;[#x0962-#x0963] |&nbsp;[#x0981-#x0983]
+|&nbsp;#x09BC |&nbsp;#x09BE |&nbsp;#x09BF |&nbsp;[#x09C0-#x09C4] |&nbsp;[#x09C7-#x09C8]
+|&nbsp;[#x09CB-#x09CD] |&nbsp;#x09D7 |&nbsp;[#x09E2-#x09E3] |&nbsp;#x0A02
+|&nbsp;#x0A3C |&nbsp;#x0A3E |&nbsp;#x0A3F |&nbsp;[#x0A40-#x0A42] |&nbsp;[#x0A47-#x0A48]
+|&nbsp;[#x0A4B-#x0A4D] |&nbsp;[#x0A70-#x0A71] |&nbsp;[#x0A81-#x0A83] |&nbsp;#x0ABC
+|&nbsp;[#x0ABE-#x0AC5] |&nbsp;[#x0AC7-#x0AC9] |&nbsp;[#x0ACB-#x0ACD] |&nbsp;[#x0B01-#x0B03]
+|&nbsp;#x0B3C |&nbsp;[#x0B3E-#x0B43] |&nbsp;[#x0B47-#x0B48] |&nbsp;[#x0B4B-#x0B4D]
+|&nbsp;[#x0B56-#x0B57] |&nbsp;[#x0B82-#x0B83] |&nbsp;[#x0BBE-#x0BC2] |&nbsp;[#x0BC6-#x0BC8]
+|&nbsp;[#x0BCA-#x0BCD] |&nbsp;#x0BD7 |&nbsp;[#x0C01-#x0C03] |&nbsp;[#x0C3E-#x0C44]
+|&nbsp;[#x0C46-#x0C48] |&nbsp;[#x0C4A-#x0C4D] |&nbsp;[#x0C55-#x0C56] |&nbsp;[#x0C82-#x0C83]
+|&nbsp;[#x0CBE-#x0CC4] |&nbsp;[#x0CC6-#x0CC8] |&nbsp;[#x0CCA-#x0CCD] |&nbsp;[#x0CD5-#x0CD6]
+|&nbsp;[#x0D02-#x0D03] |&nbsp;[#x0D3E-#x0D43] |&nbsp;[#x0D46-#x0D48] |&nbsp;[#x0D4A-#x0D4D]
+|&nbsp;#x0D57 |&nbsp;#x0E31 |&nbsp;[#x0E34-#x0E3A] |&nbsp;[#x0E47-#x0E4E]
+|&nbsp;#x0EB1 |&nbsp;[#x0EB4-#x0EB9] |&nbsp;[#x0EBB-#x0EBC] |&nbsp;[#x0EC8-#x0ECD]
+|&nbsp;[#x0F18-#x0F19] |&nbsp;#x0F35 |&nbsp;#x0F37 |&nbsp;#x0F39 |&nbsp;#x0F3E
+|&nbsp;#x0F3F |&nbsp;[#x0F71-#x0F84] |&nbsp;[#x0F86-#x0F8B] |&nbsp;[#x0F90-#x0F95]
+|&nbsp;#x0F97 |&nbsp;[#x0F99-#x0FAD] |&nbsp;[#x0FB1-#x0FB7] |&nbsp;#x0FB9
+|&nbsp;[#x20D0-#x20DC] |&nbsp;#x20E1 |&nbsp;[#x302A-#x302F] |&nbsp;#x3099
+|&nbsp;#x309A </rhs>
+</prod>
+<prod id="NT-Digit">
+<lhs>Digit</lhs><rhs>[#x0030-#x0039] |&nbsp;[#x0660-#x0669] |&nbsp;[#x06F0-#x06F9]
+|&nbsp;[#x0966-#x096F] |&nbsp;[#x09E6-#x09EF] |&nbsp;[#x0A66-#x0A6F] |&nbsp;[#x0AE6-#x0AEF]
+|&nbsp;[#x0B66-#x0B6F] |&nbsp;[#x0BE7-#x0BEF] |&nbsp;[#x0C66-#x0C6F] |&nbsp;[#x0CE6-#x0CEF]
+|&nbsp;[#x0D66-#x0D6F] |&nbsp;[#x0E50-#x0E59] |&nbsp;[#x0ED0-#x0ED9] |&nbsp;[#x0F20-#x0F29] </rhs>
+</prod>
+<prod id="NT-Extender">
+<lhs>Extender</lhs><rhs>#x00B7 |&nbsp;#x02D0 |&nbsp;#x02D1 |&nbsp;#x0387 |&nbsp;#x0640
+|&nbsp;#x0E46 |&nbsp;#x0EC6 |&nbsp;#x3005 |&nbsp;[#x3031-#x3035] |&nbsp;[#x309D-#x309E]
+|&nbsp;[#x30FC-#x30FE] </rhs>
+</prod>
+</prodgroup></scrap>
+<p>The character classes defined here can be derived from the Unicode <phrase
+diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</loc>2.0</phrase>
+character database as follows:</p>
+<ulist>
+<item><p>Name start characters must have one of the categories Ll, Lu, Lo,
+Lt, Nl.</p></item>
+<item><p>Name characters other than Name-start characters must have one of
+the categories Mc, Me, Mn, Lm, or Nd.</p></item>
+<item><p>Characters in the compatibility area (i.e. with character code greater
+than #xF900 and less than #xFFFE) are not allowed in XML names.</p></item>
+<item><p>Characters which have a font or compatibility decomposition (i.e.
+those with a <quote>compatibility formatting tag</quote> in field 5 of the
+database -- marked by field 5 beginning with a <quote>&lt;</quote>) are not
+allowed.</p></item>
+<item><p>The following characters are treated as name-start characters rather
+than name characters, because the property file classifies them as Alphabetic:
+[#x02BB-#x02C1], #x0559, #x06E5, #x06E6.</p></item>
+<item><p>Characters #x20DD-#x20E0 are excluded (in accordance with Unicode <phrase
+diff="add"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</loc>2.0</phrase>,
+section 5.14).</p></item>
+<item><p>Character #x00B7 is classified as an extender, because the property
+list so identifies it.</p></item>
+<item><p>Character #x0387 is added as a name character, because #x00B7 is
+its canonical equivalent.</p></item>
+<item><p>Characters ':' and '_' are allowed as name-start characters.</p>
+</item>
+<item><p>Characters '-' and '.' are allowed as name characters.</p></item>
+</ulist>
+</div1>
+<inform-div1 id="sec-xml-and-sgml">
+<head>XML and SGML</head>
+<p><phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E43">[E43]</loc>XML
+is designed to be a subset of SGML, in that every XML document should also
+be a conforming SGML document.</phrase> For a detailed comparison of the additional
+restrictions that XML places on documents beyond those of SGML, see <bibref
+ref="Clark"/>.</p>
+</inform-div1>
+<inform-div1 id="sec-entexpand">
+<head>Expansion of Entity and Character References</head>
+<p>This appendix contains some examples illustrating the sequence of entity-
+and character-reference recognition and expansion, as specified in <specref
+ref="entproc"/>.</p>
+<p>If the DTD contains the declaration</p>
+<eg><![CDATA[<!ENTITY example "<p>An ampersand (&#38;#38;) may be escaped
+numerically (&#38;#38;#38;) or with a general entity
+(&amp;amp;).</p>" >]]></eg>
+<p>then the XML processor will recognize the character references when it
+parses the entity declaration, and resolve them before storing the following
+string as the value of the entity <quote><code>example</code></quote>:</p>
+<eg><![CDATA[<p>An ampersand (&#38;) may be escaped
+numerically (&#38;#38;) or with a general entity
+(&amp;amp;).</p>]]></eg>
+<p>A reference in the document to <quote><code>&amp;example;</code></quote>
+will cause the text to be reparsed, at which time the start- and end-tags
+of the <el>p</el> element will be recognized and the three references will
+be recognized and expanded, resulting in a <el>p</el> element with the following
+content (all data, no delimiters or markup):</p>
+<eg><![CDATA[An ampersand (&) may be escaped
+numerically (&#38;) or with a general entity
+(&amp;).]]></eg>
+<p>A more complex example will illustrate the rules and their effects fully.
+In the following example, the line numbers are solely for reference.</p>
+<eg><![CDATA[1 <?xml version='1.0'?>
+2 <!DOCTYPE test [
+3 <!ELEMENT test (#PCDATA) >
+4 <!ENTITY % xx '&#37;zz;'>
+5 <!ENTITY % zz '&#60;!ENTITY tricky "error-prone" >' >
+6 %xx;
+7 ]>
+8 <test>This sample shows a &tricky; method.</test>]]></eg>
+<p>This produces the following:</p>
+<ulist spacing="compact">
+<item><p>in line 4, the reference to character 37 is expanded immediately,
+and the parameter entity <quote><code>xx</code></quote> is stored in the symbol
+table with the value <quote><code>%zz;</code></quote>. Since the replacement
+text is not rescanned, the reference to parameter entity <quote><code>zz</code></quote>
+is not recognized. (And it would be an error if it were, since <quote><code>zz</code></quote>
+is not yet declared.)</p></item>
+<item><p>in line 5, the character reference <quote><code>&amp;#60;</code></quote>
+is expanded immediately and the parameter entity <quote><code>zz</code></quote>
+is stored with the replacement text <quote><code>&lt;!ENTITY tricky "error-prone"
+></code></quote>, which is a well-formed entity declaration.</p></item>
+<item><p>in line 6, the reference to <quote><code>xx</code></quote> is recognized,
+and the replacement text of <quote><code>xx</code></quote> (namely <quote><code>%zz;</code></quote>)
+is parsed. The reference to <quote><code>zz</code></quote> is recognized in
+its turn, and its replacement text (<quote><code>&lt;!ENTITY tricky "error-prone"
+></code></quote>) is parsed. The general entity <quote><code>tricky</code></quote>
+has now been declared, with the replacement text <quote><code>error-prone</code></quote>.</p>
+</item>
+<item><p>in line 8, the reference to the general entity <quote><code>tricky</code></quote>
+is recognized, and it is expanded, so the full content of the <el>test</el>
+element is the self-describing (and ungrammatical) string <emph>This sample
+shows a error-prone method.</emph></p></item>
+</ulist>
+</inform-div1>
+<inform-div1 id="determinism">
+<head>Deterministic Content Models</head>
+<p><phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E102">[E102]</loc>As
+noted in <specref ref="sec-element-content"/>, it is required that content
+models in element type declarations be deterministic. This requirement is <termref
+def="dt-compat">for compatibility</termref> with SGML (which calls deterministic
+content models <quote>unambiguous</quote>);</phrase> XML processors built
+using SGML systems may flag non-deterministic content models as errors.</p>
+<p>For example, the content model <code>((b, c) | (b, d))</code> is non-deterministic,
+because given an initial <el>b</el> the <phrase diff="chg"><loc role="erratumref"
+href="http://www.w3.org/XML/xml-19980210-errata#E95">[E95]</loc>XML processor</phrase>
+cannot know which <el>b</el> in the model is being matched without looking
+ahead to see which element follows the <el>b</el>. In this case, the two references
+to <el>b</el> can be collapsed into a single reference, making the model read <code>(b,
+(c | d))</code>. An initial <el>b</el> now clearly matches only a single name
+in the content model. The <phrase diff="chg"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E95">[E95]</loc>processor</phrase
+> doesn't need to look ahead to see what follows; either <el>c</el> or <el>d</el>
+would be accepted.</p>
+<p>More formally: a finite state automaton may be constructed from the content
+model using the standard algorithms, e.g. algorithm 3.5 in section 3.9 of
+Aho, Sethi, and Ullman <bibref ref="Aho"/>. In many such algorithms, a follow
+set is constructed for each position in the regular expression (i.e., each
+leaf node in the syntax tree for the regular expression); if any position
+has a follow set in which more than one following position is labeled with
+the same element type name, then the content model is in error and may be
+reported as an error.</p>
+<p>Algorithms exist which allow many but not all non-deterministic content
+models to be reduced automatically to equivalent deterministic models; see
+Brüggemann-Klein 1991 <bibref ref="ABK"/>.</p>
+</inform-div1>
+<inform-div1 id="sec-guessing">
+<head><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E105">[E105]</loc><loc
+role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E48">[E48]</loc>Autodetection
+of Character Encodings</head>
+<p>The XML encoding declaration functions as an internal label on each entity,
+indicating which character encoding is in use. Before an XML processor can
+read the internal label, however, it apparently has to know what character
+encoding is in use&mdash;which is what the internal label is trying to indicate.
+In the general case, this is a hopeless situation. It is not entirely hopeless
+in XML, however, because XML limits the general case in two ways: each implementation
+is assumed to support only a finite set of character encodings, and the XML
+encoding declaration is restricted in position and content in order to make
+it feasible to autodetect the character encoding in use in each entity in
+normal cases. Also, in many cases other sources of information are available
+in addition to the XML data stream itself. Two cases may be distinguished,
+depending on whether the XML entity is presented to the processor without,
+or with, any accompanying (external) information. We consider the first case
+first.</p>
+<div2 id="sec-guessing-no-ext-info">
+<head diff="add">Detection Without External Encoding Information</head>
+<p>Because each XML entity <phrase diff="add">not accompanied by external
+encoding information and </phrase>not in UTF-8 or UTF-16 <phrase diff="chg">encoding</phrase> <emph>must</emph>
+begin with an XML encoding declaration, in which the first characters must
+be '<code>&lt;?xml</code>', any conforming processor can detect, after two
+to four octets of input, which of the following cases apply. In reading this
+list, it may help to know that in UCS-4, '&lt;' is <quote><code>#x0000003C</code></quote>
+and '?' is <quote><code>#x0000003F</code></quote>, and the Byte Order Mark
+required of UTF-16 data streams is <quote><code>#xFEFF</code></quote>. <phrase
+diff="add">The notation <var>##</var> is used to denote any byte value except <phrase
+diff="chg">that two consecutive <var>##</var>s cannot be both 00</phrase>.</phrase></p>
+<p diff="add">With a Byte Order Mark:</p>
+<table diff="add" border="1" frame="border"><tbody><tr><td><code>00 00 FE
+FF</code></td><td>UCS-4, big-endian machine (1234 order)</td></tr><tr><td><code>FF
+FE 00 00</code></td><td>UCS-4, little-endian machine (4321 order)</td></tr>
+<tr><td><code>00 00 FF FE</code></td><td>UCS-4, unusual octet order (2143)</td>
+</tr><tr><td><code>FE FF 00 00</code></td><td>UCS-4, unusual octet order (3412)</td>
+</tr><tr><td><code>FE FF ## ##</code></td><td>UTF-16, big-endian</td></tr>
+<tr><td><code>FF FE ## ##</code></td><td>UTF-16, little-endian</td></tr><tr>
+<td><code>EF BB BF</code></td><td>UTF-8</td></tr></tbody></table>
+<p diff="add">Without a Byte Order Mark:</p>
+<table diff="add" border="1" frame="border"><tbody><tr><td><code>00&nbsp;00&nbsp;00&nbsp;3C</code></td>
+<td rowspan="4">UCS-4 or other encoding with a 32-bit code unit and ASCII
+characters encoded as ASCII values, in respectively big-endian (1234), little-endian
+(4321) and two unusual byte orders (2143 and 3412). The encoding declaration
+must be read to determine which of UCS-4 or other supported 32-bit encodings
+applies.</td></tr><tr><td><code>3C 00 00 00</code></td>
+<!--<td>UCS-4, little-endian machine (4321 order)</td>-->
+</tr><tr><td><code>00 00 3C 00</code></td>
+<!--<td>UCS-4, unusual octet order (2143)</td>-->
+</tr><tr><td><code>00 3C 00 00</code></td>
+<!--<td>UCS-4, unusual octet order (3412)</td>-->
+</tr><tr><td><code>00 3C 00 3F</code></td><td>UTF-16BE or big-endian ISO-10646-UCS-2
+or other encoding with a 16-bit code unit in big-endian order and ASCII characters
+encoded as ASCII values (the encoding declaration must be read to determine
+which)</td></tr><tr><td><code>3C 00 3F 00</code></td><td>UTF-16LE or little-endian
+ISO-10646-UCS-2 or other encoding with a 16-bit code unit in little-endian
+order and ASCII characters encoded as ASCII values (the encoding declaration
+must be read to determine which)</td></tr><tr><td><code>3C 3F 78 6D</code></td>
+<td>UTF-8, ISO 646, ASCII, some part of ISO 8859, Shift-JIS, EUC, or any other
+7-bit, 8-bit, or mixed-width encoding which ensures that the characters of
+ASCII have their normal positions, width, and values; the actual encoding
+declaration must be read to detect which of these applies, but since all of
+these encodings use the same bit patterns for the relevant ASCII characters,
+the encoding declaration itself may be read reliably</td></tr><tr><td><code>4C
+6F A7 94</code></td><td>EBCDIC (in some flavor; the full encoding declaration
+must be read to tell which code page is in use)</td></tr><tr><td>Other</td>
+<td>UTF-8 without an encoding declaration, or else the data stream is mislabeled
+(lacking a required encoding declaration), corrupt, fragmentary, or enclosed
+in a wrapper of some kind</td></tr></tbody></table>
+<note diff="add">
+<p>In cases above which do not require reading the encoding declaration to
+determine the encoding, section 4.3.3 still requires that the encoding declaration,
+if present, be read and that the encoding name be checked to match the actual
+encoding of the entity. Also, it is possible that new character encodings
+will be invented that will make it necessary to use the encoding declaration
+to determine the encoding, in cases where this is not required at present.</p>
+</note>
+<p>This level of autodetection is enough to read the XML encoding declaration
+and parse the character-encoding identifier, which is still necessary to distinguish
+the individual members of each family of encodings (e.g. to tell UTF-8 from
+8859, and the parts of 8859 from each other, or to distinguish the specific
+EBCDIC code page in use, and so on).</p>
+<p>Because the contents of the encoding declaration are restricted to <phrase
+diff="chg">characters from the ASCII repertoire (however encoded)</phrase>,
+a processor can reliably read the entire encoding declaration as soon as it
+has detected which family of encodings is in use. Since in practice, all widely
+used character encodings fall into one of the categories above, the XML encoding
+declaration allows reasonably reliable in-band labeling of character encodings,
+even when external sources of information at the operating-system or transport-protocol
+level are unreliable. <phrase diff="del">Note that since external parsed entities
+in UTF-16 may begin with any character, this autodetection does not always
+work. Also, </phrase><phrase diff="add">Character encodings such as UTF-7
+that make overloaded usage of ASCII-valued bytes may fail to be reliably detected.</phrase></p>
+<p>Once the processor has detected the character encoding in use, it can act
+appropriately, whether by invoking a separate input routine for each case,
+or by calling the proper conversion function on each character of input.</p>
+<p>Like any self-labeling system, the XML encoding declaration will not work
+if any software changes the entity's character set or encoding without updating
+the encoding declaration. Implementors of character-encoding routines should
+be careful to ensure the accuracy of the internal and external information
+used to label the entity.</p>
+</div2>
+<div2 id="sec-guessing-with-ext-info">
+<head diff="add">Priorities in the Presence of External Encoding Information</head>
+<p>The second possible case occurs when the XML entity is accompanied by encoding
+information, as in some file systems and some network protocols. When multiple
+sources of information are available, their relative priority and the preferred
+method of handling conflict should be specified as part of the higher-level
+protocol used to deliver XML. <phrase diff="chg">In particular, please refer
+to <bibref ref="rfc2376"/> or its successor, which defines the <code>text/xml</code>
+and <code>application/xml</code> MIME types and provides some useful guidance.
+In the interests of interoperability, however, the following rule is recommended.</phrase></p>
+<ulist>
+<item><p>If an XML entity is in a file, the Byte-Order Mark and encoding declaration <phrase
+diff="del">PI </phrase>are used (if present) to determine the character encoding.<phrase
+diff="del"><loc role="erratumref" href="http://www.w3.org/XML/xml-19980210-errata#E74">[E74]</loc>
+All other heuristics and sources of information are solely for error recovery.</phrase></p>
+</item>
+</ulist>
+<ulist diff="del">
+<item><p>If an XML entity is delivered with a MIME type of text/xml, then
+the <code>charset</code> parameter on the MIME type determines the character
+encoding method; all other heuristics and sources of information are solely
+for error recovery.</p></item>
+<item><p>If an XML entity is delivered with a MIME type of application/xml,
+then the Byte-Order Mark and encoding-declaration PI are used (if present)
+to determine the character encoding. All other heuristics and sources of information
+are solely for error recovery.</p></item>
+</ulist>
+<p diff="del">These rules apply only in the absence of protocol-level documentation;
+in particular, when the MIME types text/xml and application/xml are defined,
+the recommendations of the relevant RFC will supersede these rules.</p>
+</div2>
+</inform-div1>
+<inform-div1 id="sec-xml-wg">
+<head>W3C XML Working Group</head>
+<p>This specification was prepared and approved for publication by the W3C
+XML Working Group (WG). WG approval of this specification does not necessarily
+imply that all WG members voted for its approval. The current and former members
+of the XML WG are:</p>
+<orglist>
+<member><name>Jon Bosak</name><affiliation>Sun</affiliation><role>Chair</role>
+</member>
+<member><name>James Clark</name><role>Technical Lead</role></member>
+<member><name>Tim Bray</name><affiliation>Textuality and Netscape</affiliation>
+<role>XML Co-editor</role></member>
+<member><name>Jean Paoli</name><affiliation>Microsoft</affiliation><role>XML
+Co-editor</role></member>
+<member><name>C. M. Sperberg-McQueen</name><affiliation>U. of Ill.</affiliation>
+<role>XML Co-editor</role></member>
+<member><name>Dan Connolly</name><affiliation>W3C</affiliation><role>W3C Liaison</role>
+</member>
+<member><name>Paula Angerstein</name><affiliation>Texcel</affiliation></member>
+<member><name>Steve DeRose</name><affiliation>INSO</affiliation></member>
+<member><name>Dave Hollander</name><affiliation>HP</affiliation></member>
+<member><name>Eliot Kimber</name><affiliation>ISOGEN</affiliation></member>
+<member><name>Eve Maler</name><affiliation>ArborText</affiliation></member>
+<member><name>Tom Magliery</name><affiliation>NCSA</affiliation></member>
+<member><name>Murray Maloney</name><affiliation diff="chg">SoftQuad, Grif
+SA, Muzmo and Veo Systems</affiliation></member>
+<member><name diff="chg">MURATA Makoto (FAMILY Given)</name><affiliation>Fuji
+Xerox Information Systems</affiliation></member>
+<member><name>Joel Nava</name><affiliation>Adobe</affiliation></member>
+<member><name>Conleth O'Connell</name><affiliation>Vignette</affiliation>
+</member>
+<member><name>Peter Sharpe</name><affiliation>SoftQuad</affiliation></member>
+<member><name>John Tigue</name><affiliation>DataChannel</affiliation></member>
+</orglist>
+</inform-div1>
+<inform-div1 id="sec-core-wg" diff="add">
+<head>W3C XML Core Group</head>
+<p>The second edition of this specification was prepared by the W3C XML Core
+Working Group (WG). The members of the WG at the time of publication of this
+edition were:</p>
+<orglist>
+<member><name>Paula Angerstein</name><affiliation>Vignette</affiliation></member>
+<member><name>Daniel Austin</name><affiliation>Ask Jeeves</affiliation></member>
+<member><name>Tim Boland</name></member>
+<member><name>Allen Brown</name><affiliation>Microsoft</affiliation></member>
+<member><name>Dan Connolly</name><affiliation>W3C</affiliation><role>Staff
+Contact</role></member>
+<member><name>John Cowan</name><affiliation>Reuters Limited</affiliation>
+</member>
+<member><name>John Evdemon</name><affiliation>XMLSolutions Corporation</affiliation>
+</member>
+<member><name>Paul Grosso</name><affiliation>Arbortext</affiliation><role>Co-Chair</role>
+</member>
+<member><name>Arnaud Le Hors</name><affiliation>IBM</affiliation><role>Co-Chair</role>
+</member>
+<member><name>Eve Maler</name><affiliation>Sun Microsystems</affiliation>
+<role>Second Edition Editor</role></member>
+<member><name>Jonathan Marsh</name><affiliation>Microsoft</affiliation></member>
+<member><name>MURATA Makoto (FAMILY Given)</name><affiliation>IBM</affiliation>
+</member>
+<member><name>Mark Needleman</name><affiliation>Data Research Associates</affiliation>
+</member>
+<member><name>David Orchard</name><affiliation>Jamcracker</affiliation></member>
+<member><name>Lew Shannon</name><affiliation>NCR</affiliation></member>
+<member><name>Richard Tobin</name><affiliation>University of Edinburgh</affiliation>
+</member>
+<member><name>Daniel Veillard</name><affiliation>W3C</affiliation></member>
+<member><name>Dan Vint</name><affiliation>Lexica</affiliation></member>
+<member><name>Norman Walsh</name><affiliation>Sun Microsystems</affiliation>
+</member>
+<member><name>François Yergeau</name><affiliation>Alis Technologies</affiliation>
+<role>Errata List Editor</role></member>
+<member><name>Kongyi Zhou</name><affiliation>Oracle</affiliation></member>
+</orglist>
+</inform-div1>
+<inform-div1 diff="add">
+<head>Production Notes</head>
+<p>This Second Edition was encoded in the <loc href="http://www.w3.org/XML/1998/06/xmlspec-v21.dtd">XMLspec
+DTD</loc> (which has <loc href="http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm">documentation</loc>
+available). The HTML versions were produced with a combination of the <loc
+href="http://www.w3.org/XML/1998/06/xmlspec.xsl">xmlspec.xsl</loc>, <loc href="http://www.w3.org/XML/1998/06/diffspec.xsl">diffspec.xsl</loc>,
+and <loc href="http://www.w3.org/XML/1998/06/REC-xml-2e.xsl">REC-xml-2e.xsl</loc>
+XSLT stylesheets. The PDF version was produced with the <loc href="http://www.tdb.uu.se/~jan/html2ps.html">html2ps</loc>
+facility and a distiller program.</p>
+</inform-div1>
+</back></spec>
diff --git a/libxslt/tests/xmlspec/REC-xml-2e.xsl b/libxslt/tests/xmlspec/REC-xml-2e.xsl
new file mode 100644
index 0000000..afe3fc1
--- /dev/null
+++ b/libxslt/tests/xmlspec/REC-xml-2e.xsl
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+<xsl:import href="diffspec.xsl"/>
+
+<xsl:template match="loc[@role='erratumref']">
+ <xsl:choose>
+ <xsl:when test="$show.diff.markup='0'">
+ <!-- nop -->
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="loc[@role='erratumref']" mode="text">
+ <xsl:choose>
+ <xsl:when test="$show.diff.markup='0'">
+ <!-- nop -->
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+</xsl:stylesheet>
+
diff --git a/libxslt/tests/xmlspec/W3C-REC.css b/libxslt/tests/xmlspec/W3C-REC.css
new file mode 100644
index 0000000..a52b50c
--- /dev/null
+++ b/libxslt/tests/xmlspec/W3C-REC.css
@@ -0,0 +1,94 @@
+/* This is an SSI script. Policy:
+ (1) Use CVS
+ (2) send e-mail to w3t-comm@w3.org if you edit this
+*/
+/* Style for a "Recommendation" */
+
+/*
+ This is an SSI script. Policy:
+ (1) Use CVS
+ (2) send e-mail to w3t-comm@w3.org if you edit this
+
+ Acknowledgments:
+
+ - 'background-color' doesn't work on Mac IE 3, but 'background'
+ does (Susan Lesch <lesch@macvirus.com>)
+
+ - 'smaller' leads to illegible text in both Mac IE and Mac NS,
+ 'small' is better: works in Mac NS, but is always 12pt in Mac IE
+ 3 (Susan Lesch <lesch@macvirus.com>)
+
+ $Id$
+*/
+
+body {
+ margin: 2em 1em 2em 70px;
+ font-family: sans-serif;
+ color: black;
+ background: white;
+ background-position: top left;
+ background-attachment: fixed;
+ background-repeat: no-repeat;
+}
+
+th, td { /* ns 4 */
+ font-family: sans-serif;
+}
+
+h1, h2, h3, h4, h5, h6 { text-align: left }
+h1, h2, h3 { color: #005A9C }
+h1 { font: 170% sans-serif }
+h2 { font: 140% sans-serif }
+h3 { font: 120% sans-serif }
+h4 { font: bold 100% sans-serif }
+h5 { font: italic 100% sans-serif }
+h6 { font: small-caps 100% sans-serif }
+
+.hide { display: none }
+
+div.head { margin-bottom: 1em }
+div.head h1 { margin-top: 2em; clear: both }
+div.head table { margin-left: 2em; margin-top: 2em }
+div.head img { color: white; border: none } /* remove border from top image */
+
+p.copyright { font-size: small }
+p.copyright small { font-size: small }
+
+@media screen { /* hide from IE3 */
+a:hover { background: #ffa }
+}
+
+pre { margin-left: 2em }
+/*
+p {
+ margin-top: 0.6em;
+ margin-bottom: 0.6em;
+}
+*/
+dt, dd { margin-top: 0; margin-bottom: 0 } /* opera 3.50 */
+dt { font-weight: bold }
+
+pre, code { font-family: monospace } /* navigator 4 requires this */
+
+ul.toc {
+ list-style: disc; /* Mac NS has problem with 'none' */
+ list-style: none;
+}
+
+@media aural {
+ h1, h2, h3 { stress: 20; richness: 90 }
+ .hide { speak: none }
+ p.copyright { volume: x-soft; speech-rate: x-fast }
+ dt { pause-before: 20% }
+ pre { speak-punctuation: code }
+}
+
+/* Things (icons) that should only show up in projection mode */
+.projection { display: none }
+@media projection { .projection { display: inline } }
+
+
+body {
+ background-image: url(logo-REC);
+}
+
diff --git a/libxslt/tests/xmlspec/diffspec.xsl b/libxslt/tests/xmlspec/diffspec.xsl
new file mode 100644
index 0000000..3097188
--- /dev/null
+++ b/libxslt/tests/xmlspec/diffspec.xsl
@@ -0,0 +1,329 @@
+<?xml version="1.0"?>
+
+<!-- Version: $Id$ -->
+
+<!-- Stylesheet for @diff markup in XMLspec -->
+<!-- Author: Norman Walsh (Norman.Walsh@East.Sun.COM) -->
+<!-- Date Created: 2000.07.21 -->
+
+<!-- This stylesheet is copyright (c) 2000 by its authors. Free
+ distribution and modification is permitted, including adding to
+ the list of authors and copyright holders, as long as this
+ copyright notice is maintained. -->
+
+<!-- This stylesheet attempts to implement the XML Specification V2.1
+ DTD. Documents conforming to earlier DTDs may not be correctly
+ transformed.
+
+ This stylesheet supports the use of change-markup with the @diff
+ attribute. If you use @diff, you should always use this stylesheet.
+ If you want to turn off the highlighting of differences, use this
+ stylesheet, but set show.diff.markup to 0.
+
+ Using the original xmlspec stylesheet with @diff markup will cause
+ @diff=del text to be presented.
+-->
+
+<!-- ChangeLog:
+ 25 Sep 2000: (Norman.Walsh@East.Sun.COM)
+ - Use inline diff markup (as opposed to block) for name and
+ affiliation
+ - Handle @diff='del' correctly in bibl and other list-contexts.
+ 14 Aug 2000: (Norman.Walsh@East.Sun.COM)
+ - Support additional.title param
+ 27 Jul 2000: (Norman.Walsh@East.Sun.COM)
+ - Fix HTML markup problem with diff'd authors in authlist
+ 26 Jul 2000: (Norman.Walsh@East.Sun.COM)
+ - Update pointer to latest xmlspec-stylesheet.
+ 21 Jul 2000: (Norman.Walsh@East.Sun.COM)
+ - Initial version
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+<xsl:import href="xmlspec.xsl"/>
+
+<xsl:param name="show.diff.markup">0</xsl:param>
+
+<xsl:param name="additional.css">
+<xsl:if test="$show.diff.markup = '1'">
+<xsl:text>
+div.diff-add { background-color: yellow }
+div.diff-del { text-decoration: line-through }
+div.diff-chg { background-color: lime }
+div.diff-off { }
+
+span.diff-add { background-color: yellow }
+span.diff-del { text-decoration: line-through }
+span.diff-chg { background-color: lime }
+span.diff-off { }
+
+td.diff-add { background-color: yellow }
+td.diff-del { text-decoration: line-through }
+td.diff-chg { background-color: lime }
+td.diff-off { }
+</xsl:text>
+</xsl:if>
+</xsl:param>
+
+<xsl:param name="additional.title">
+ <xsl:if test="$show.diff.markup != '0'">
+ <xsl:text>Review Version</xsl:text>
+ </xsl:if>
+</xsl:param>
+
+<xsl:param name="called.by.diffspec">1</xsl:param>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="diff-markup">
+ <xsl:param name="diff">off</xsl:param>
+ <xsl:choose>
+ <xsl:when test="ancestor::scrap">
+ <!-- forget it, we can't add stuff inside tables -->
+ <!-- handled in base stylesheet -->
+ <xsl:apply-imports/>
+ </xsl:when>
+ <xsl:when test="self::gitem or self::bibl">
+ <!-- forget it, we can't add stuff inside dls; handled below -->
+ <xsl:apply-imports/>
+ </xsl:when>
+ <xsl:when test="ancestor-or-self::phrase">
+ <span class="diff-{$diff}">
+ <xsl:apply-imports/>
+ </span>
+ </xsl:when>
+ <xsl:when test="ancestor::p and not(self::p)">
+ <span class="diff-{$diff}">
+ <xsl:apply-imports/>
+ </span>
+ </xsl:when>
+ <xsl:when test="ancestor-or-self::affiliation">
+ <span class="diff-{$diff}">
+ <xsl:apply-imports/>
+ </span>
+ </xsl:when>
+ <xsl:when test="ancestor-or-self::name">
+ <span class="diff-{$diff}">
+ <xsl:apply-imports/>
+ </span>
+ </xsl:when>
+ <xsl:otherwise>
+ <div class="diff-{$diff}">
+ <xsl:apply-imports/>
+ </div>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*[@diff='chg']">
+ <xsl:choose>
+ <xsl:when test="$show.diff.markup='1'">
+ <xsl:call-template name="diff-markup">
+ <xsl:with-param name="diff">chg</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*[@diff='add']">
+ <xsl:choose>
+ <xsl:when test="$show.diff.markup='1'">
+ <xsl:call-template name="diff-markup">
+ <xsl:with-param name="diff">add</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*[@diff='del']">
+ <xsl:choose>
+ <xsl:when test="$show.diff.markup='1'">
+ <xsl:call-template name="diff-markup">
+ <xsl:with-param name="diff">del</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- suppress deleted markup -->
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*[@diff='off']">
+ <xsl:choose>
+ <xsl:when test="$show.diff.markup='1'">
+ <xsl:call-template name="diff-markup">
+ <xsl:with-param name="diff">off</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- ================================================================= -->
+
+ <xsl:template match="bibl[@diff]" priority="1">
+ <xsl:variable name="dt">
+ <xsl:if test="@id">
+ <a name="{@id}"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@key">
+ <xsl:value-of select="@key"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dd">
+ <xsl:apply-templates/>
+ <xsl:if test="@href">
+ <xsl:text> (See </xsl:text>
+ <a href="{@href}">
+ <xsl:value-of select="@href"/>
+ </a>
+ <xsl:text>.)</xsl:text>
+ </xsl:if>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="@diff and $show.diff.markup = '1'">
+ <dt class="label">
+ <span class="diff-{@diff}">
+ <xsl:copy-of select="$dt"/>
+ </span>
+ </dt>
+ <dd>
+ <div class="diff-{@diff}">
+ <xsl:copy-of select="$dd"/>
+ </div>
+ </dd>
+ </xsl:when>
+ <xsl:when test="@diff='del' and $show.diff.markup='0'">
+ <!-- suppressed -->
+ </xsl:when>
+ <xsl:otherwise>
+ <dt class="label">
+ <xsl:copy-of select="$dt"/>
+ </dt>
+ <dd>
+ <xsl:copy-of select="$dd"/>
+ </dd>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="gitem/label">
+ <xsl:variable name="diffval" select="ancestor-or-self::*/@diff"/>
+ <xsl:choose>
+ <xsl:when test="$diffval != '' and $show.diff.markup='1'">
+ <dt class="label">
+ <span class="diff-{ancestor-or-self::*/@diff}">
+ <xsl:apply-templates/>
+ </span>
+ </dt>
+ </xsl:when>
+ <xsl:when test="$diffval='del' and $show.diff.markup='0'">
+ <!-- suppressed -->
+ </xsl:when>
+ <xsl:otherwise>
+ <dt class="label">
+ <xsl:apply-templates/>
+ </dt>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="gitem/def">
+ <xsl:variable name="diffval" select="ancestor-or-self::*/@diff"/>
+ <xsl:choose>
+ <xsl:when test="$diffval != '' and $show.diff.markup='1'">
+ <dd>
+ <div class="diff-{ancestor-or-self::*/@diff}">
+ <xsl:apply-templates/>
+ </div>
+ </dd>
+ </xsl:when>
+ <xsl:when test="$diffval='del' and $show.diff.markup='0'">
+ <!-- suppressed -->
+ </xsl:when>
+ <xsl:otherwise>
+ <dd>
+ <xsl:apply-templates/>
+ </dd>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- authlist: list of authors (editors, really) -->
+ <!-- called in enforced order from header's template, in <dl>
+ context -->
+ <xsl:template match="authlist[@diff]">
+ <xsl:choose>
+ <xsl:when test="$show.diff.markup='1'">
+ <dt>
+ <span class="diff-{ancestor-or-self::*/@diff}">
+ <xsl:text>Editor</xsl:text>
+ <xsl:if test="count(author) > 1">
+ <xsl:text>s</xsl:text>
+ </xsl:if>
+ <xsl:text>:</xsl:text>
+ </span>
+ </dt>
+ </xsl:when>
+ <xsl:when test="@diff='del' and $show.diff.markup='0'">
+ <!-- suppressed -->
+ </xsl:when>
+ <xsl:otherwise>
+ <dt>
+ <xsl:text>Editor</xsl:text>
+ <xsl:if test="count(author) > 1">
+ <xsl:text>s</xsl:text>
+ </xsl:if>
+ <xsl:text>:</xsl:text>
+ </dt>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- author: an editor of a spec -->
+ <!-- only appears in authlist -->
+ <!-- called in <dl> context -->
+ <xsl:template match="author[@diff]" priority="1">
+ <xsl:choose>
+ <xsl:when test="@diff and $show.diff.markup='1'">
+ <dd>
+ <span class="diff-{ancestor-or-self::*/@diff}">
+ <xsl:apply-templates/>
+ <xsl:if test="@role = '2e'">
+ <xsl:text> - Second Edition</xsl:text>
+ </xsl:if>
+ </span>
+ </dd>
+ </xsl:when>
+ <xsl:when test="@diff='del' and $show.diff.markup='0'">
+ <!-- suppressed -->
+ </xsl:when>
+ <xsl:otherwise>
+ <dd>
+ <xsl:apply-templates/>
+ <xsl:if test="@role = '2e'">
+ <xsl:text> - Second Edition</xsl:text>
+ </xsl:if>
+ </dd>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/libxslt/tests/xmlspec/logo-REC b/libxslt/tests/xmlspec/logo-REC
new file mode 100644
index 0000000..bddad3e
--- /dev/null
+++ b/libxslt/tests/xmlspec/logo-REC
Binary files differ
diff --git a/libxslt/tests/xmlspec/xmlspec-v21.dtd b/libxslt/tests/xmlspec/xmlspec-v21.dtd
new file mode 100644
index 0000000..b70fd69
--- /dev/null
+++ b/libxslt/tests/xmlspec/xmlspec-v21.dtd
@@ -0,0 +1,1734 @@
+<!-- ............................................................... -->
+<!-- XML specification DTD ......................................... -->
+<!-- ............................................................... -->
+
+<!--
+TYPICAL INVOCATION:
+# <!DOCTYPE spec PUBLIC
+# "-//W3C//DTD Specification V2.1//EN"
+# "http://www.w3.org/XML/1998/06/xmlspec-v21.dtd">
+
+PURPOSE:
+ This XML DTD is for W3C specifications and other technical reports.
+ It is based in part on the TEI Lite and Sweb DTDs.
+
+DEPENDENCIES:
+ None.
+
+CHANGE HISTORY:
+ The list of changes is at the end of the DTD.
+
+ For all details, see the design report at:
+
+# <http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm>
+
+ Search this file for "#" in the first column to see change history
+ comments. To find changes made this time, search for "2000-03-07".
+
+MAINTAINER:
+ Eve Maler
+ Sun Microsystems, Inc.
+ elm@east.sun.com
+ voice: +1 781 442 3190
+ fax: +1 781 442 1437
+-->
+
+<!-- ............................................................... -->
+<!-- Entities for characters and symbols ........................... -->
+<!-- ............................................................... -->
+
+<!--
+#1998-03-10: maler: Added &ldquo; and &rdquo;.
+# Used 8879:1986-compatible decimal character
+# references.
+# Merged charent.mod file back into main file.
+#1998-05-14: maler: Fixed ldquo and rdquo. Gave mdash a real number.
+#1998-12-03: maler: Escaped the leading ampersands.
+-->
+
+<!ENTITY lt "&#38;#60;">
+<!ENTITY gt "&#62;">
+<!ENTITY amp "&#38;#38;">
+<!ENTITY apos "&#39;">
+<!ENTITY quot "&#34;">
+<!ENTITY nbsp "&#160;">
+<!ENTITY mdash "&#38;#x2014;">
+<!ENTITY ldquo "&#38;#x201C;">
+<!ENTITY rdquo "&#38;#x201D;">
+
+<!-- ............................................................... -->
+<!-- Entities for classes of standalone elements ................... -->
+<!-- ............................................................... -->
+
+<!--
+#1997-10-16: maler: Added table to %illus.class;.
+#1997-11-28: maler: Added htable to %illus.class;.
+#1997-12-29: maler: IGNOREd table.
+#1998-03-10: maler: Removed SGML Open-specific %illus.class;.
+# Added "local" entities for customization.
+#1998-05-14: maler: Added issue to %note.class;.
+# Removed %[local.]statusp.class;.
+#1998-05-21: maler: Added constraintnote to %note.class;.
+#1998-08-22: maler: Changed htable to table in %illus.class;.
+# Added definitions to %illus.class;.
+#2000-03-07: maler: Added proto and example to %illus.class;.
+-->
+
+<!ENTITY % local.p.class "">
+<!ENTITY % p.class "p
+ %local.p.class;">
+
+<!ENTITY % local.list.class "">
+<!ENTITY % list.class "ulist|olist|slist|glist
+ %local.list.class;">
+
+<!ENTITY % local.speclist.class "">
+<!ENTITY % speclist.class "orglist|blist
+ %local.speclist.class;">
+
+<!ENTITY % local.note.class "">
+<!ENTITY % note.class "note|issue|wfcnote|vcnote
+ |constraintnote %local.note.class;">
+
+<!ENTITY % local.illus.class "">
+<!ENTITY % illus.class "eg|graphic|scrap|table|definitions
+ |proto|example
+ %local.illus.class;">
+
+<!-- ............................................................... -->
+<!-- Entities for classes of phrase-level elements ................. -->
+<!-- ............................................................... -->
+
+<!--
+#1997-12-29: maler: Added xspecref to %ref.class;.
+#1998-03-10: maler: Added %ednote.class;.
+# Added "local" entities for customization.
+#2000-03-07: maler: Added function, var, el, att, and attval to
+# %tech.class;.
+# Added sub, sup, and phrase to %emph.class;.
+-->
+
+<!ENTITY % local.annot.class "">
+<!ENTITY % annot.class "footnote
+ %local.annot.class;">
+
+<!ENTITY % local.termdef.class "">
+<!ENTITY % termdef.class "termdef|term
+ %local.termdef.class;">
+
+<!ENTITY % local.emph.class "">
+<!ENTITY % emph.class "emph|phrase|quote|sub|sup
+ %local.emph.class;">
+
+<!ENTITY % local.ref.class "">
+<!ENTITY % ref.class "bibref|specref|termref|titleref
+ |xspecref|xtermref
+ %local.ref.class;">
+
+<!ENTITY % local.loc.class "">
+<!ENTITY % loc.class "loc
+ %local.loc.class;">
+
+<!ENTITY % local.tech.class "">
+<!ENTITY % tech.class "kw|nt|xnt|code|function|var
+ |el|att|attval
+ %local.tech.class;">
+
+<!ENTITY % local.ednote.class "">
+<!ENTITY % ednote.class "ednote
+ %local.ednote.class;">
+
+<!-- ............................................................... -->
+<!-- Entities for mixtures of standalone elements .................. -->
+<!-- ............................................................... -->
+
+<!--
+#1997-09-30: maler: Created %p.mix; to eliminate p from self.
+#1997-09-30: maler: Added %speclist.class; to %obj.mix; and %p.mix;.
+#1997-09-30: maler: Added %note.class; to %obj.mix; and %p.mix;.
+#1997-10-16: maler: Created %entry.mix;. Note that some elements
+# left out here are still allowed in termdef,
+# which entry can contain through %p.pcd.mix;.
+#1997-11-28: maler: Added %p.class; to %statusobj.mix;.
+#1998-03-10: maler: Added %ednote.class; to all mixtures, except
+# %p.mix; and %statusobj.mix;, because paragraphs
+# and status paragraphs will contain ednote
+# through %p.pcd.mix;.
+#1998-03-23: maler: Added %termdef.mix; (broken out from
+# %termdef.pcd.mix;).
+#1998-05-14: maler: Removed %statusobj.mix; and all mentions of
+# %statusp.mix;.
+-->
+
+<!ENTITY % div.mix
+ "%p.class;|%list.class;|%speclist.class;|%note.class;
+ |%illus.class;|%ednote.class;">
+<!ENTITY % obj.mix
+ "%p.class;|%list.class;|%speclist.class;|%note.class;
+ |%illus.class;|%ednote.class;">
+<!ENTITY % p.mix
+ "%list.class;|%speclist.class;|%note.class;|%illus.class;">
+<!ENTITY % entry.mix
+ "%list.class;|note|eg|graphic|%ednote.class;">
+<!ENTITY % hdr.mix
+ "%p.class;|%list.class;|%ednote.class;">
+<!ENTITY % termdef.mix
+ "%note.class;|%illus.class;">
+
+<!-- ............................................................... -->
+<!-- Entities for mixtures of #PCDATA and phrase-level elements .... -->
+<!-- ............................................................... -->
+
+<!-- Note that %termdef.pcd.mix contains %note.class;
+ and %illus.class;, considered standalone elements. -->
+
+<!--
+#1997-09-30: maler: Added scrap and %note.class; to %termdef.pcd.mix;.
+#1997-11-28: maler: Added %loc.class; to %p.pcd.mix;.
+#1998-03-10: maler: Added %ednote.class; to all mixtures.
+#1998-03-23: maler: Moved some %termdef.pcd.mix; stuff out to
+# %termdef.mix;.
+#1998-05-14: maler: Removed %statusp.pcd.mix;.
+#1998-05-21: maler: Added constraint element to %eg.pcd.mix;.
+#1999-07-02: maler: Added %loc.class; to %head.pcd.mix;,
+# %label.pcd.mix;, %eg.pcd.mix;, %termdef.pcd.mix;,
+# %tech.pcd.mix; (net: all PCD mixes have it).
+# Removed unused %loc.pcd.mix;.
+-->
+
+<!ENTITY % p.pcd.mix
+ "#PCDATA|%annot.class;|%termdef.class;|%emph.class;
+ |%ref.class;|%tech.class;|%loc.class;|%ednote.class;">
+<!ENTITY % head.pcd.mix
+ "#PCDATA|%annot.class;|%emph.class;|%tech.class;
+ |%loc.class;|%ednote.class;">
+<!ENTITY % label.pcd.mix
+ "#PCDATA|%annot.class;|%termdef.class;|%emph.class;
+ |%tech.class;|%loc.class;|%ednote.class;">
+<!ENTITY % eg.pcd.mix
+ "#PCDATA|%annot.class;|%emph.class;|%loc.class;
+ |%ednote.class;|constraint">
+<!ENTITY % termdef.pcd.mix
+ "#PCDATA|term|%emph.class;|%ref.class;|%tech.class;
+ |%loc.class;|%ednote.class;">
+<!ENTITY % bibl.pcd.mix
+ "#PCDATA|%emph.class;|%ref.class;|%loc.class;|%ednote.class;">
+<!ENTITY % tech.pcd.mix
+ "#PCDATA|%loc.class;|%ednote.class;">
+
+<!-- ............................................................... -->
+<!-- Entities for customizable content models ...................... -->
+<!-- ............................................................... -->
+
+<!--
+#1998-03-10: maler: Added customization entities.
+#1998-05-14: maler: Allowed prevlocs and latestloc in either order.
+#1999-07-02: maler: Made version optional; added copyright element.
+#2000-03-07: maler: Allowed status and abstract in opposite order.
+-->
+
+<!ENTITY % spec.mdl
+ "header, front?, body, back?">
+
+<!ENTITY % header.mdl
+ "title, subtitle?, version?, w3c-designation, w3c-doctype,
+ pubdate, notice*, publoc, ((prevlocs, latestloc?) |
+ (latestloc, prevlocs?))?, authlist, copyright?,
+ ((status, abstract) | (abstract, status)), pubstmt?,
+ sourcedesc?, langusage, revisiondesc">
+
+<!ENTITY % pubdate.mdl
+ "day?, month, year">
+
+<!-- ............................................................... -->
+<!-- Entities for common attributes ................................ -->
+<!-- ............................................................... -->
+
+<!--
+#2000-03-07: maler: Added %argtypes;.
+-->
+
+<!-- argtypes:
+ Values for function prototype argument datatypes. -->
+<!ENTITY % argtypes
+ '(boolean
+ |expression
+ |location-set
+ |node-set
+ |number
+ |object
+ |point
+ |range
+ |string)'>
+
+<!-- key attribute:
+ Optionally provides a sorting or indexing key, for cases when
+ the element content is inappropriate for this purpose. -->
+<!ENTITY % key.att
+ 'key CDATA #IMPLIED'>
+
+<!-- def attribute:
+ Points to the element where the relevant definition can be
+ found, using the IDREF mechanism. %def.att; is for optional
+ def attributes, and %def-req.att; is for required def
+ attributes. -->
+<!ENTITY % def.att
+ 'def IDREF #IMPLIED'>
+<!ENTITY % def-req.att
+ 'def IDREF #REQUIRED'>
+
+<!-- ref attribute:
+ Points to the element where more information can be found,
+ using the IDREF mechanism. %ref.att; is for optional
+ ref attributes, and %ref-req.att; is for required ref
+ attributes. -->
+<!ENTITY % ref.att
+ 'ref IDREF #IMPLIED'>
+<!ENTITY % ref-req.att
+ 'ref IDREF #REQUIRED'>
+
+<!--
+#1998-03-23: maler: Added show and actuate attributes to href.
+# Added semi-common xml:space attribute.
+#1998-08-22: maler: Used new xlink:form and #IMPLIED features.
+#1999-07-02: maler: Reorganized XLink-related entities completely;
+# added xmlns:xlink attribute to the mix.
+#2000-03-07: maler: Updated XLink usage to February 2000 draft,
+# except that href still has no namespace prefix.
+-->
+
+<!-- xmlns:xlink and xlink:type attributes:
+ xmlns:xlink declares the association of the xlink prefix
+ with the namespace created by the XLink specification.
+ xlink:type identifies an element as an XLink "simple" linking
+ element. -->
+<!ENTITY % simple-xlink.att
+ 'xmlns:xlink CDATA #FIXED
+ "http://www.w3.org/1999/xlink"
+ xlink:type CDATA #FIXED "simple" '>
+
+<!-- href attributes:
+ The href attribute locates the remote-resource half of a
+ simple link; the element on which the href appears is the
+ local-resource half. Some elements are usable links only if
+ the author chooses to supply a functional href. The attribute
+ name should really be xlink:href, but is kept without the
+ prefix for now in order to be backwards-compatible. -->
+
+<!ENTITY % href.att
+ 'href CDATA #IMPLIED '>
+<!ENTITY % href-req.att
+ 'href CDATA #REQUIRED '>
+
+<!-- xlink:show and xlink:actuate attributes:
+ These attributes offer instructions to the display engine
+ about how to handle traversal to resource indicated by an
+ href locator. -->
+<!ENTITY % auto-embed.att
+ 'xlink:show CDATA #FIXED "embed"
+ xlink:actuate CDATA #FIXED "onLoad" '>
+<!ENTITY % user-replace.att
+ 'xlink:show CDATA #FIXED "replace"
+ xlink:actuate CDATA #FIXED "onRequest" '>
+<!ENTITY % user-new.att
+ 'xlink:show CDATA #FIXED "new"
+ xlink:actuate CDATA #FIXED "onRequest" '>
+
+<!-- xml:space attribute:
+ Indicates that the element contains whitespace that the
+ formatter or other application should retain, as appropriate
+ to its function. -->
+<!ENTITY % xmlspace.att
+ 'xml:space (default
+ |preserve) #FIXED "preserve" '>
+
+<!--
+#2000-03-07: maler: Added common diff attribute. Made %role.att;.
+-->
+
+<!-- diff attribute:
+ Indicates in what way the element has changed. When a value
+ is not provided, that subelement should inherit a value from
+ its parent. If the root element has no value supplied,
+ assume "off". -->
+<!ENTITY % diff.att
+ 'diff (chg
+ |add
+ |del
+ |off) #IMPLIED'>
+
+<!-- role attribute:
+ Extends the useful life of the DTD by allowing authors to
+ make a subtype of any element. No default. -->
+<!ENTITY % role.att
+ 'role NMTOKEN #IMPLIED'>
+
+<!-- Common attributes:
+ Every element has an ID attribute for links, a role
+ attribute, and a diff attribute. %common.att; is for
+ common attributes where the ID is optional, and
+ %common-idreq.att; is for common attributes where the
+ ID is required. -->
+<!ENTITY % common.att
+ 'id ID #IMPLIED
+ %role.att;
+ %diff.att;'>
+<!ENTITY % common-idreq.att
+ 'id ID #REQUIRED
+ %role.att;
+ %diff.att;'>
+
+<!-- ............................................................... -->
+<!-- Common elements ............................................... -->
+<!-- ............................................................... -->
+
+<!-- head: Title on divisions, productions, and the like -->
+<!ELEMENT head (%head.pcd.mix;)*>
+<!ATTLIST head %common.att;>
+
+<!-- ............................................................... -->
+<!-- Major specification structure ................................. -->
+<!-- ............................................................... -->
+
+<!--
+#1998-03-10: maler: Made spec content model easily customizable.
+#1999-07-02: maler: Added doctype atts and status att.
+#2000-03-07: maler: Added cr, issues, and dispcmts to w3c-doctype.
+-->
+
+<!ELEMENT spec (%spec.mdl;)>
+<!-- w3c-doctype attributes:
+ Indicates the type of document, so that the appropriate
+ stylesheet or workflow routing can be applied. Should
+ *not* generate any text (such as the "REC-" or "NOTE-"
+ prefix on the W3C designation content). No default. If
+ w3c-doctype is "other", other-doctype should be filled in.
+
+ status attribute:
+ Indicates the stage of review of the document. May affect
+ the stylesheet's treatment of ednotes (e.g., whether to
+ output them). No default. -->
+
+<!ATTLIST spec
+ %common.att;
+ w3c-doctype (cr
+ |dispcmts
+ |issues
+ |note
+ |other
+ |pr
+ |rec
+ |wd) #IMPLIED
+ other-doctype CDATA #IMPLIED
+ status (int-review
+ |ext-review
+ |final) #IMPLIED
+>
+
+<!ELEMENT front (div1+)>
+<!ATTLIST front %common.att;>
+
+<!ELEMENT body (div1+)>
+<!ATTLIST body %common.att;>
+
+<!--
+#1997-09-30: maler: Added inform-div1 to back content.
+-->
+
+<!ELEMENT back ((div1+, inform-div1*) | inform-div1+)>
+<!ATTLIST back %common.att;>
+
+<!ELEMENT div1 (head, (%div.mix;)*, div2*)>
+<!ATTLIST div1 %common.att;>
+
+<!--
+#1997-09-30: maler: Added inform-div1 declarations.
+#2000-03-07: maler: Added div5 level.
+-->
+
+<!-- inform-div1: Non-normative division in back matter -->
+<!ELEMENT inform-div1 (head, (%div.mix;)*, div2*)>
+<!ATTLIST inform-div1 %common.att;>
+
+<!ELEMENT div2 (head, (%div.mix;)*, div3*)>
+<!ATTLIST div2 %common.att;>
+
+<!ELEMENT div3 (head, (%div.mix;)*, div4*)>
+<!ATTLIST div3 %common.att;>
+
+<!ELEMENT div4 (head, (%div.mix;)*, div5*)>
+<!ATTLIST div4 %common.att;>
+
+<!ELEMENT div5 (head, (%div.mix;)*)>
+<!ATTLIST div5 %common.att;>
+
+<!-- ............................................................... -->
+<!-- Specification header .......................................... -->
+<!-- ............................................................... -->
+
+<!--
+#1998-03-10: maler: Made header content model easily customizable.
+-->
+
+<!ELEMENT header (%header.mdl;)>
+<!ATTLIST header %common.att;>
+
+<!-- Example of title: "Extensible Cheese Language (XCL)" -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title %common.att;>
+
+<!-- Example of subtitle: "A Cheesy Specification" -->
+<!ELEMENT subtitle (#PCDATA)>
+<!ATTLIST subtitle %common.att;>
+
+<!-- Example of version: "Version 666.0" -->
+<!ELEMENT version (#PCDATA)>
+<!ATTLIST version %common.att;>
+
+<!-- Example of w3c-designation: "WD-xcl-19991231" -->
+<!ELEMENT w3c-designation (#PCDATA)>
+<!ATTLIST w3c-designation %common.att;>
+
+<!-- Example of w3c-doctype: "W3C Working Draft" -->
+<!ELEMENT w3c-doctype (#PCDATA)>
+<!ATTLIST w3c-doctype %common.att;>
+
+<!--
+#1998-03-10: maler: Made pubdate content model easily customizable.
+-->
+
+<!ELEMENT pubdate (%pubdate.mdl;)>
+<!ATTLIST pubdate %common.att;>
+
+<!ELEMENT day (#PCDATA)>
+<!ATTLIST day %common.att;>
+
+<!ELEMENT month (#PCDATA)>
+<!ATTLIST month %common.att;>
+
+<!ELEMENT year (#PCDATA)>
+<!ATTLIST year %common.att;>
+
+<!--
+#1999-07-02: maler: Declared copyright element.
+-->
+
+<!ELEMENT copyright (%hdr.mix;)+>
+<!ATTLIST copyright %common.att;>
+
+<!-- Example of notice: "This draft is for public comment..." -->
+<!ELEMENT notice (%hdr.mix;)+>
+<!ATTLIST notice %common.att;>
+
+<!--
+#2000-03-07: maler: Broadened models of *loc to %p.pcd.mix;.
+-->
+
+<!ELEMENT publoc (%p.pcd.mix;)*>
+<!ATTLIST publoc %common.att;>
+
+<!ELEMENT prevlocs (%p.pcd.mix;)*>
+<!ATTLIST prevlocs %common.att;>
+
+<!ELEMENT latestloc (%p.pcd.mix;)*>
+<!ATTLIST latestloc %common.att;>
+
+<!-- loc (defined in "Phrase-level elements" below) -->
+
+<!ELEMENT authlist (author+)>
+<!ATTLIST authlist %common.att;>
+
+<!--
+#1997-09-30: maler: Made affiliation optional.
+#1998-03-10: maler: Made email optional.
+-->
+
+<!ELEMENT author (name, affiliation?, email?)>
+<!ATTLIST author %common.att;>
+
+<!ELEMENT name (#PCDATA)>
+<!ATTLIST name
+ %common.att;
+ %key.att;>
+
+<!ELEMENT affiliation (#PCDATA)>
+<!ATTLIST affiliation %common.att;>
+
+<!--
+#1999-07-02: maler: Added show/actuate attributes and default values.
+-->
+
+
+<!ELEMENT email (#PCDATA)>
+<!-- href attribute:
+ email functions as a hypertext reference through this
+ required attribute. Typically the reference would use
+ the mailto: scheme. E.g.:
+
+<email href="mailto:elm@arbortext.com">elm@arbortext.com</email>
+ -->
+
+<!ATTLIST email
+ %common.att;
+ %simple-xlink.att;
+ %href-req.att;
+ %user-new.att;>
+
+<!--
+#1998-05-15: maler: Changed status content from %statusobj.mix;
+# to plain %obj.mix;. statusp is obsolete.
+-->
+
+<!ELEMENT status (%obj.mix;)+>
+<!ATTLIST status %common.att;>
+
+<!ELEMENT abstract (%hdr.mix;)*>
+<!ATTLIST abstract %common.att;>
+
+<!ELEMENT pubstmt (%hdr.mix;)+>
+<!ATTLIST pubstmt %common.att;>
+
+<!ELEMENT sourcedesc (%hdr.mix;)+>
+<!ATTLIST sourcedesc %common.att;>
+
+<!ELEMENT langusage (language+)>
+<!ATTLIST langusage %common.att;>
+
+<!ELEMENT language (#PCDATA)>
+<!ATTLIST language %common.att;>
+
+<!ELEMENT revisiondesc (%hdr.mix;)+>
+<!ATTLIST revisiondesc %common.att;>
+
+<!-- ............................................................... -->
+<!-- Paragraph ..................................................... -->
+<!-- ............................................................... -->
+
+<!--
+#1997-09-30: maler: Changed from %obj.mix; to %p.mix;.
+#1997-12-29: maler: Changed order of %p.mix; and %p.pcd.mix;
+# references.
+#1997-12-29: maler: Changed order of %statusobj.mix; and
+# %statusp.pcd.mix; references.
+#1998-05-14: maler: Removed statusp declarations.
+-->
+
+<!ELEMENT p (%p.pcd.mix;|%p.mix;)*>
+<!ATTLIST p %common.att;>
+
+<!-- ............................................................... -->
+<!-- Regular lists ................................................. -->
+<!-- ............................................................... -->
+
+<!-- ulist: Unordered list, typically bulleted. -->
+<!ELEMENT ulist (item+)>
+<!-- spacing attribute:
+ Use "normal" to get normal vertical spacing for items;
+ use "compact" to get less spacing. The default is dependent
+ on the stylesheet. -->
+<!ATTLIST ulist
+ %common.att;
+ spacing (normal|compact) #IMPLIED>
+
+<!-- olist: Ordered list, typically numbered. -->
+<!ELEMENT olist (item+)>
+<!-- spacing attribute:
+ Use "normal" to get normal vertical spacing for items;
+ use "compact" to get less spacing. The default is dependent
+ on the stylesheet. -->
+<!ATTLIST olist
+ %common.att;
+ spacing (normal|compact) #IMPLIED>
+
+<!ELEMENT item (%obj.mix;)+>
+<!ATTLIST item %common.att;>
+
+<!-- slist: Simple list, typically with no mark. -->
+<!ELEMENT slist (sitem+)>
+<!ATTLIST slist %common.att;>
+
+<!ELEMENT sitem (%p.pcd.mix;)*>
+<!ATTLIST sitem %common.att;>
+
+<!-- glist: Glossary list, typically two-column. -->
+<!ELEMENT glist (gitem+)>
+<!ATTLIST glist %common.att;>
+
+<!ELEMENT gitem (label, def)>
+<!ATTLIST gitem %common.att;>
+
+<!ELEMENT label (%label.pcd.mix;)*>
+<!ATTLIST label %common.att;>
+
+<!ELEMENT def (%obj.mix;)*>
+<!ATTLIST def %common.att;>
+
+<!-- ............................................................... -->
+<!-- Special lists ................................................. -->
+<!-- ............................................................... -->
+
+<!-- blist: Bibliography list. -->
+<!ELEMENT blist (bibl+)>
+<!ATTLIST blist %common.att;>
+
+<!--
+#1999-07-02: maler: Added show/actuate attributes and default values.
+-->
+
+<!ELEMENT bibl (%bibl.pcd.mix;)*>
+<!-- href attribute:
+ bibl optionally functions as a hypertext reference to the
+ referred-to resource through this attribute. E.g.:
+
+ <bibl href="http://www.my.com/doc.htm">My Document</bibl>
+ -->
+<!ATTLIST bibl
+ %common.att;
+ %simple-xlink.att;
+ %href.att;
+ %user-replace.att;
+ %key.att;>
+
+<!-- orglist: Organization member list. -->
+<!ELEMENT orglist (member+)>
+<!ATTLIST orglist %common.att;>
+
+<!--
+#1997-09-30: maler: Added optional affiliation.
+-->
+
+<!ELEMENT member (name, affiliation?, role?)>
+<!ATTLIST member %common.att;>
+
+<!-- name (defined in "Specification header" above) -->
+<!-- affiliation (defined in "Specification header" above) -->
+
+<!ELEMENT role (#PCDATA)>
+<!ATTLIST role %common.att;>
+
+<!-- ............................................................... -->
+<!-- Notes ......................................................... -->
+<!-- ............................................................... -->
+
+<!ELEMENT note (%obj.mix;)+>
+<!ATTLIST note %common.att;>
+
+<!--
+#1998-05-14: maler: Declared issue element.
+#2000-03-07: maler: Added head, source, resolution, and status.
+-->
+
+<!ELEMENT issue (head?, source*, (%obj.mix;)+, resolution?)>
+<!-- status attribute:
+ Indicates whether the issue is open or closed. Note that
+ the lack of a resolution element does not necessarily mean
+ that the issue is still open. -->
+<!ATTLIST issue
+ id ID #REQUIRED
+ %role.att;
+ %diff.att;
+ status (open
+ |closed) "open"
+>
+
+<!ELEMENT source (%p.pcd.mix;)*>
+<!ATTLIST source
+ %common.att;>
+
+<!ELEMENT resolution (%obj.mix;)+>
+<!ATTLIST resolution %common.att;>
+
+<!-- wfcnote: Well-formedness constraint note. -->
+<!ELEMENT wfcnote (head, (%obj.mix;)+)>
+<!-- ID attribute:
+ wfcnote must have an ID so that it can be pointed to
+ from a wfc element in a production. -->
+<!ATTLIST wfcnote
+ %common-idreq.att;>
+
+<!-- vcnote: Validity constraint note. -->
+<!ELEMENT vcnote (head, (%obj.mix;)+)>
+<!-- ID attribute:
+ vcnote must have an ID so that it can be pointed to
+ from a vc element in a production. -->
+<!ATTLIST vcnote
+ %common-idreq.att;>
+
+<!--
+#1998-05-21: maler: Declared generic constraintnote element.
+-->
+
+<!-- constraintnote: Generic constraint note. -->
+<!ELEMENT constraintnote (head, (%obj.mix;)+)>
+<!-- ID attribute:
+ constraintnote must have an ID so that it can be
+ pointed to from a constraint element in a production. -->
+<!-- type attribute:
+ constraintnote must have a type value keyword so that
+ it can be correctly characterized in the specification. -->
+<!ATTLIST constraintnote
+ %common-idreq.att;
+ type NMTOKEN #REQUIRED>
+
+<!-- ............................................................... -->
+<!-- Basic display elements ........................................ -->
+<!-- ............................................................... -->
+
+<!--
+#1998-03-23: maler: Added xml:space attribute.
+-->
+
+<!-- eg: Example element, with whitespace respected. -->
+<!ELEMENT eg (%eg.pcd.mix;)*>
+<!ATTLIST eg
+ %common.att;
+ %xmlspace.att;>
+
+<!--
+#2000-03-07: maler: Removed the xml:attributes attribute.
+# Added %local.graphic.att;.
+-->
+
+<!-- graphic: Displayed graphic. Graphic data should be
+ displayed at the point where it is referenced. Not
+ actually conforming to XLink right now. -->
+<!ELEMENT graphic EMPTY>
+<!-- source attribute:
+ The graphic data must reside at the location pointed to. -->
+<!ENTITY % local.graphic.att "">
+<!ATTLIST graphic
+ %common.att;
+ %simple-xlink.att;
+ source CDATA #REQUIRED
+ %auto-embed.att;
+ alt CDATA #IMPLIED
+ %local.graphic.att;>
+
+<!--
+#2000-03-07: maler: Added proto element structure.
+-->
+
+<!-- proto: Function prototype, in the XPath/XPointer style. -->
+<!ELEMENT proto (arg*)>
+<!ATTLIST proto
+ %common.att;
+ name NMTOKEN #REQUIRED
+ return-type %argtypes; #REQUIRED
+>
+
+<!ELEMENT arg EMPTY>
+<!ATTLIST arg
+ %common.att;
+ type %argtypes; #REQUIRED
+ occur (opt|req) #IMPLIED
+>
+
+<!--
+#2000-03-07: maler: Added example element.
+-->
+
+<!ELEMENT example (head?, (%obj.mix;)+)>
+<!ATTLIST example %common.att;>
+
+<!-- ............................................................... -->
+<!-- EBNF .......................................................... -->
+<!-- ............................................................... -->
+
+<!--
+#1997-11-28: maler: Added prodgroup to scrap and defined it.
+#1998-05-21: maler: Added constraint to prod.
+#1999-07-02: maler: Added prodrecap to scrap; broadened scrap model.
+# Added headstyle attribute to scrap.
+-->
+
+<!-- scrap: Collection of EBNF language productions. -->
+<!ELEMENT scrap (head, (prodgroup | prod | bnf | prodrecap)+)>
+<!-- lang attribute:
+ The scrap can link to a description of the language used,
+ found in a language element in the header.
+ headstyle attribute:
+ Allows a scrap title to be suppressed from output. To be
+ used only when a scrap title directly next to a section
+ title is distracting or repetetive. -->
+<!ATTLIST scrap
+ %common.att;
+ lang IDREF #IMPLIED
+ headstyle (show|suppress) "show"
+>
+
+<!-- prodgroup: Sub-collection of productions, needed for
+ formatting reasons. -->
+<!ELEMENT prodgroup (prod+)>
+<!-- pcw<n> attributes:
+ Presentational attributes to control the width
+ of the "pseudo-table" columns used to output
+ groups of productions. -->
+<!ATTLIST prodgroup
+ %common.att;
+ pcw1 CDATA #IMPLIED
+ pcw2 CDATA #IMPLIED
+ pcw3 CDATA #IMPLIED
+ pcw4 CDATA #IMPLIED
+ pcw5 CDATA #IMPLIED
+>
+
+<!-- prod: EBNF language production. -->
+<!ELEMENT prod (lhs, (rhs, (com|wfc|vc|constraint)*)+)>
+<!-- ID attribute:
+ The production must have an ID so that cross-references
+ (specref) and mentions of nonterminals (nt) can link to
+ it. -->
+<!ATTLIST prod
+ %common-idreq.att;>
+
+<!-- lhs: Left-hand side of production. -->
+<!ELEMENT lhs (#PCDATA)>
+<!ATTLIST lhs %common.att;>
+
+<!-- rhs: Right-hand side of production; may have many
+ "right-hand sides," one to a line. -->
+<!ELEMENT rhs (#PCDATA|nt|xnt|com)*>
+<!ATTLIST rhs %common.att;>
+
+<!-- nt and xnt (defined in "Phrase-level elements" below) -->
+
+<!--
+#1997-11-28: maler: Added loc and bibref to com content.
+-->
+
+<!-- com: Production comment. -->
+<!ELEMENT com (#PCDATA|loc|bibref)*>
+<!ATTLIST com %common.att;>
+
+<!-- wfc: Reference to a well-formedness constraint; should
+ generate the head of the wfcnote pointed to. -->
+<!ELEMENT wfc EMPTY>
+<!-- def attribute:
+ Each well formedness tagline in a production must link to the
+ wfcnote that defines it. -->
+<!ATTLIST wfc
+ %def-req.att;
+ %common.att;>
+
+<!-- vc: Reference to a validity constraint; should generate
+ the head of the vcnote pointed to. -->
+<!ELEMENT vc EMPTY>
+<!-- def attribute:
+ Each validity tagline in a production must link to the vcnote
+ that defines it. -->
+<!ATTLIST vc
+ %def-req.att;
+ %common.att;>
+
+<!--
+#1998-05-21: maler: Declared generic constraint element.
+-->
+
+<!-- constraint: Reference to a generic constraint; should
+ generate the head of the constraintnote pointed to. -->
+<!ELEMENT constraint EMPTY>
+<!-- def attribute:
+ Each constraint tagline in a production must link to the
+ constraint note that defines it. -->
+<!ATTLIST constraint
+ %def-req.att;
+ %common.att;>
+
+<!--
+#1998-03-23: maler: Added xml:space attribute.
+-->
+
+<!-- bnf: Un-marked-up EBNF production, with whitespace
+ respected. -->
+<!ELEMENT bnf (%eg.pcd.mix;)*>
+<!ATTLIST bnf
+ %common.att;
+ %xmlspace.att;>
+
+<!--
+#1999-07-02: maler: Declared prodrecap.
+-->
+
+<!-- prodrecap: Reference to production or bnf that appears
+ in its "normative" form elsewhere in the spec; should
+ generate a copy of the original production, without
+ a production number next to it. -->
+<!ELEMENT prodrecap EMPTY>
+<!ATTLIST prodrecap
+ %common.att;
+ %ref-req.att;>
+
+<!-- ............................................................... -->
+<!-- Table ......................................................... -->
+<!-- ............................................................... -->
+
+<!--
+#1997-10-16: maler: Added table mechanism.
+#1997-11-28: maler: Added non-null system ID to entity declaration.
+# Added HTML table module.
+#1997-12-29: maler: IGNOREd SGML Open table model.
+#1998-03-10: maler: Removed SGML Open table model.
+# Merged html-tbl.mod file into main file.
+# Added %common.att; to all HTML table elements.
+#1998-05-14: maler: Replaced table model with full HTML 4.0 model.
+# Removed htable in favor of table.
+# Removed htbody in favor of tbody.
+-->
+
+<!ENTITY % cellhalign.att
+ 'align (left|center
+ |right|justify
+ |char) #IMPLIED
+ char CDATA #IMPLIED
+ charoff CDATA #IMPLIED'>
+
+<!ENTITY % cellvalign.att
+ 'valign (top|middle
+ |bottom
+ |baseline) #IMPLIED'>
+
+<!ENTITY % thtd.att
+ 'abbr CDATA #IMPLIED
+ axis CDATA #IMPLIED
+ headers IDREFS #IMPLIED
+ scope (row
+ |col
+ |rowgroup
+ |colgroup) #IMPLIED
+ rowspan NMTOKEN "1"
+ colspan NMTOKEN "1"'>
+
+<!ENTITY % width.att
+ 'width CDATA #IMPLIED'>
+
+<!ENTITY % span.att
+ 'span NMTOKEN "1"'>
+
+<!-- table: HTML-based geometric table model. -->
+<!ELEMENT table
+ (caption?, (col*|colgroup*), thead?, tfoot?, tbody+)>
+<!ATTLIST table
+ %common.att;
+ %width.att;
+ summary CDATA #IMPLIED
+ border CDATA #IMPLIED
+ frame (void|above
+ |below|hsides
+ |lhs|rhs
+ |vsides|box
+ |border) #IMPLIED
+ rules (none|groups
+ |rows|cols
+ |all) #IMPLIED
+ cellspacing CDATA #IMPLIED
+ cellpadding CDATA #IMPLIED>
+
+<!ELEMENT caption (%p.pcd.mix;)*>
+<!ATTLIST caption %common.att;>
+
+<!ELEMENT col EMPTY>
+<!ATTLIST col
+ %common.att;
+ %span.att;
+ %width.att;
+ %cellhalign.att;
+ %cellvalign.att;>
+
+<!ELEMENT colgroup (col)*>
+<!ATTLIST colgroup
+ %common.att;
+ %span.att;
+ %width.att;
+ %cellhalign.att;
+ %cellvalign.att;>
+
+<!ELEMENT thead (tr)+>
+<!ATTLIST thead
+ %common.att;
+ %cellhalign.att;
+ %cellvalign.att;>
+
+<!ELEMENT tfoot (tr)+>
+<!ATTLIST tfoot
+ %common.att;
+ %cellhalign.att;
+ %cellvalign.att;>
+
+<!ELEMENT tbody (tr)+>
+<!ATTLIST tbody
+ %common.att;
+ %cellhalign.att;
+ %cellvalign.att;>
+
+<!ELEMENT tr (th|td)+>
+<!ATTLIST tr
+ %common.att;
+ %cellhalign.att;
+ %cellvalign.att;>
+
+<!ELEMENT th (%p.pcd.mix;|%p.mix;)*>
+<!ATTLIST th
+ %common.att;
+ %thtd.att;
+ %cellhalign.att;
+ %cellvalign.att;>
+
+<!ELEMENT td (%p.pcd.mix;|%p.mix;)*>
+<!ATTLIST td
+ %common.att;
+ %thtd.att;
+ %cellhalign.att;
+ %cellvalign.att;>
+
+<!-- ............................................................... -->
+<!-- IDL structures for DOM specifications ......................... -->
+<!-- ............................................................... -->
+
+<!-- ............................................................... -->
+<!-- Specialized entities for classes .............................. -->
+
+<!ENTITY % idl-desc.class
+ "p|note">
+
+<!ENTITY % idl-tdef.class
+ "typedef|constant|exception|reference|group">
+
+<!ENTITY % idl-mod.class
+ "module|interface">
+
+<!ENTITY % idl-struct.class
+ "struct|enum|sequence|union|typename">
+
+<!ENTITY % idl-meth.class
+ "method|attribute">
+
+<!-- ............................................................... -->
+<!-- Specialized entities for mixtures ............................. -->
+
+<!-- Quick reference to content model mixtures:
+
+ desc tdef mod struct meth
+group x x x x x
+definitions, module x x x
+interface x x x
+typedef, case, component x
+-->
+
+<!ENTITY % idl-grp.mix
+ "%idl-desc.class;|%idl-tdef.class;|%idl-mod.class;
+ |%idl-struct.class;|%idl-meth.class;">
+
+<!ENTITY % idl-defn.mix
+ "%idl-desc.class;|%idl-tdef.class;|%idl-mod.class;">
+
+<!ENTITY % idl-intfc.mix
+ "%idl-desc.class;|%idl-tdef.class;|%idl-meth.class;">
+
+<!ENTITY % idl-type.mix
+ "%idl-struct.class;">
+
+<!-- ............................................................... -->
+<!-- Specialized entities for common attributes .................... -->
+
+<!-- name attribute:
+ Provides a name. Required. -->
+<!ENTITY % idl-name.att
+ 'name CDATA #REQUIRED'>
+
+<!-- type attribute:
+ Provides a type. Required. -->
+<!ENTITY % idl-type.att
+ 'type CDATA #REQUIRED'>
+
+<!-- ............................................................... -->
+<!-- Common IDL element ............................................ -->
+
+<!ELEMENT descr ((%obj.mix;)*)>
+<!ATTLIST descr %common.att;>
+
+<!-- ............................................................... -->
+<!-- IDL definition elements ....................................... -->
+
+<!-- definitions: Top-level element for definitions. -->
+<!ELEMENT definitions (%idl-defn.mix;)+>
+<!ATTLIST definitions %common.att;>
+
+<!-- group: Element used to group a set of definitions. -->
+
+<!ELEMENT group (descr, (%idl-grp.mix;)*)>
+<!ATTLIST group
+ %common.att;
+ %idl-name.att;>
+
+<!-- interface: Definition of an interface. -->
+<!ELEMENT interface (descr, (%idl-intfc.mix;)*)>
+<!ATTLIST interface
+ %common.att;
+ %idl-name.att;
+ inherits CDATA #IMPLIED>
+
+<!-- module: Definition of a module. -->
+<!ELEMENT module (descr, (%idl-defn.mix;)*)>
+<!ATTLIST module
+ %common.att;
+ %idl-name.att;>
+
+<!-- reference: Reference to some other declaration. -->
+<!ELEMENT reference EMPTY>
+<!ATTLIST reference
+ %common.att;
+ declaration IDREF #REQUIRED>
+
+<!-- typedef: Definition of a named type. -->
+<!ELEMENT typedef (descr, (%idl-type.mix;))>
+<!ATTLIST typedef
+ %common.att;
+ %idl-name.att;
+ array.size NMTOKEN #IMPLIED>
+
+<!-- struct: Declaration of a struct type. -->
+<!ELEMENT struct (descr, component+)>
+<!ATTLIST struct
+ %common.att;
+ %idl-name.att;>
+
+<!-- component: Declaration of a structural member. -->
+<!ELEMENT component (%idl-type.mix;)>
+<!ATTLIST component
+ %common.att;
+ %idl-name.att;>
+
+<!-- union: Declaration of a union type. -->
+<!ELEMENT union (descr, case+)>
+<!ATTLIST union
+ %common.att;
+ %idl-name.att;
+ switch.type CDATA #REQUIRED>
+
+<!ELEMENT case (descr, (%idl-type.mix;))>
+<!ATTLIST case
+ %common.att;
+ labels CDATA #REQUIRED>
+
+<!-- enum: Declaration of an enum type. -->
+<!ELEMENT enum (descr, enumerator+)>
+<!ATTLIST enum
+ %common.att;
+ %idl-name.att;>
+
+<!ELEMENT enumerator (descr)>
+<!ATTLIST enumerator
+ %common.att;
+ %idl-name.att;>
+
+<!-- sequence: Declaration of a sequence type (not named). -->
+<!ELEMENT sequence (sequence*)>
+<!ATTLIST sequence
+ %common.att;
+ %idl-type.att;
+ size NMTOKEN #IMPLIED>
+
+<!-- constant: Declaration of a named constant. -->
+<!ELEMENT constant (descr)>
+<!ATTLIST constant
+ %common.att;
+ %idl-name.att;
+ %idl-type.att;
+ value CDATA #REQUIRED>
+
+<!-- exception: Declaration of an exception. -->
+<!ELEMENT exception (descr, component*)>
+<!ATTLIST exception
+ %common.att;
+ %idl-name.att;>
+<!-- component (defined under struct, above)-->
+
+<!-- attribute: Declaration of an attribute (data member). -->
+<!ELEMENT attribute (descr)>
+<!ATTLIST attribute
+ %common.att;
+ %idl-name.att;
+ %idl-type.att;
+ readonly (yes
+ |no) "no">
+
+<!-- method: Declaration of a method. -->
+<!ELEMENT method (descr, parameters, returns, raises)>
+<!ATTLIST method
+ %common.att;
+ %idl-name.att;>
+
+<!ELEMENT parameters (param*)>
+<!ATTLIST parameters %common.att;>
+
+<!ELEMENT param (descr)>
+<!ATTLIST param
+ %common.att;
+ %idl-name.att;
+ %idl-type.att;
+ attr (in
+ |out
+ |inout) "inout">
+
+<!ELEMENT returns (descr)>
+<!ATTLIST returns
+ %common.att;
+ %idl-type.att;>
+
+<!ELEMENT raises (exception*)>
+<!-- exception (defined under constant, above)-->
+
+<!ELEMENT typename (#PCDATA)>
+<!ATTLIST typename %common.att;>
+
+<!-- ............................................................... -->
+<!-- Phrase-level elements ......................................... -->
+<!-- ............................................................... -->
+
+<!--
+#2000-03-07: maler: Added att and attval elements.
+-->
+
+<!-- att: Attribute name. -->
+<!ELEMENT att (%tech.pcd.mix;)*>
+<!ATTLIST att %common.att;>
+
+<!-- attval: Attribute value. -->
+<!ELEMENT attval (%tech.pcd.mix;)*>
+<!ATTLIST attval %common.att;>
+
+<!-- bibref: Reference to a bibliography list entry; should
+ generate, in square brackets, "key" on bibl. -->
+<!ELEMENT bibref EMPTY>
+<!-- ref attribute:
+ A bibliography reference must link to the bibl element that
+ describes the resource. -->
+<!ATTLIST bibref
+ %common.att;
+ %ref-req.att;>
+
+<!ELEMENT code (%tech.pcd.mix;)*>
+<!ATTLIST code %common.att;>
+
+<!--
+#1998-03-10: maler: Declared ednote and related elements.
+#1999-07-02: maler: Changed edtext content from #PCDATA to %p.pcd.mix;.
+-->
+
+<!-- ednote: Editorial note for communication among editors. -->
+<!ELEMENT ednote (name?, date?, edtext)>
+<!ATTLIST ednote %common.att;>
+
+<!ELEMENT date (#PCDATA)>
+<!ATTLIST date %common.att;>
+
+<!ELEMENT edtext (%p.pcd.mix;)*>
+<!ATTLIST edtext %common.att;>
+
+<!--
+#2000-03-07: maler: Added el element.
+-->
+
+<!-- el: Element type name (GI). -->
+<!ELEMENT el (%tech.pcd.mix;)*>
+<!ATTLIST el %common.att;>
+
+<!--
+#2000-03-07: maler: Expanded emph to %p.pcd.mix;.
+-->
+
+<!ELEMENT emph (%p.pcd.mix;)*>
+<!ATTLIST emph %common.att;>
+
+<!-- footnote: Both footnote content and call to footnote. -->
+<!ELEMENT footnote (%obj.mix;)+>
+<!ATTLIST footnote %common.att;>
+
+<!--
+#2000-03-07: maler: Added function and gave it content of
+# %tech.pcd.mix; instead of XPath's #PCDATA.
+-->
+
+<!ELEMENT function (%tech.pcd.mix;)*>
+<!ATTLIST function %common.att;>
+
+<!ELEMENT kw (%tech.pcd.mix;)*>
+<!ATTLIST kw %common.att;>
+
+<!--
+#1999-07-02: maler: Added show/actuate attributes and default values.
+-->
+
+<!-- loc: Generic link to a Web resource, similar to HTML's A. -->
+<!ELEMENT loc (#PCDATA)>
+<!-- href attribute:
+ The purpose of a loc element is to function as a A-like
+ hypertext link to a resource. (Ideally, the content of loc
+ will also mention the URI of the resource, so that readers of
+ the printed version will be able to locate the resource.) E.g.:
+
+<loc href="http://www.my.com/doc.htm">http://www.my.com/doc.htm</loc>
+ -->
+<!ATTLIST loc
+ %common.att;
+ %simple-xlink.att;
+ %href-req.att;
+ %user-replace.att;>
+
+<!-- nt: Mention of a nonterminal in text, along with a link to
+ the production in the current document that defines it. -->
+<!ELEMENT nt (#PCDATA)>
+<!-- def attribute:
+ The nonterminal must link to the production that defines
+ it. -->
+<!ATTLIST nt
+ %common.att;
+ %def-req.att;>
+
+<!--
+#2000-03-07: maler: Declared phrase.
+-->
+
+<!-- phrase: "Attribute hanger" for small bits of (e.g.) differenced
+ text in a paragraph or similar, when another element isn't handy.
+ Beware that its content model may allow more nested elements than
+ would normally be allowed in some contexts. -->
+<!ELEMENT phrase (%p.pcd.mix;)*>
+<!ATTLIST phrase %common.att;>
+
+<!--
+#1998-03-10: maler: Declared quote.
+-->
+
+<!-- quote: Scare quotes and other purely presentational quotes. -->
+<!ELEMENT quote (%p.pcd.mix;)*>
+<!ATTLIST quote %common.att;>
+
+<!-- specref: Reference to a div, olist item, prod, or issue
+ in the current document; should generate italic "[n.n],
+ Section Title" for div, "n" for numbered item, "[n]" for
+ production, or "Issue id" for issue. -->
+<!ELEMENT specref EMPTY>
+<!-- ref attribute:
+ The purpose of a specref element is to link to a div, item
+ in an olist, or production in the current spec. -->
+<!ATTLIST specref
+ %common.att;
+ %ref-req.att;>
+
+<!--
+#2000-03-07: maler: Added sub and sup.
+-->
+
+<!-- sub: Subscript. -->
+<!ELEMENT sub (#PCDATA)>
+<!ATTLIST sub %common.att;>
+
+<!-- sup: Superscript. -->
+<!ELEMENT sup (#PCDATA)>
+<!ATTLIST sup %common.att;>
+
+<!-- term: The term in text that is being defined in text. -->
+<!ELEMENT term (#PCDATA)>
+<!ATTLIST term %common.att;>
+
+<!-- termdef: Definition of a term in text. -->
+<!ELEMENT termdef (%termdef.pcd.mix;|%termdef.mix;)*>
+<!-- ID attribute:
+ A term definition must have an ID so that it can be linked
+ to from termref elements. -->
+<!-- term attribute:
+ The canonical form of the term or phrase being defined must
+ appear in this attribute, even if the term or phrase also
+ appears in the element content in identical form (e.g., in
+ the term element). -->
+<!ATTLIST termdef
+ %common-idreq.att;
+ term CDATA #REQUIRED>
+
+<!-- termref: Mention of a term, along with a link to the
+ definition in the current document. -->
+<!ELEMENT termref (#PCDATA)>
+<!-- ref attribute:
+ A term reference must link to the termdef element that
+ defines the term. -->
+<!ATTLIST termref
+ %common.att;
+ %def-req.att;>
+
+<!--
+#1999-07-02: maler: Added show/actuate attributes and default values.
+-->
+
+<!-- titleref: Citation of another document, which can also
+ link to that document if it is a Web resource. -->
+<!ELEMENT titleref (#PCDATA)>
+<!-- href attribute:
+ A title reference can optionally function as a hypertext
+ link to the resource with this title. E.g.:
+
+<loc href="http://www.my.com/doc.htm">http://www.my.com/doc.htm</loc>
+ -->
+
+<!ATTLIST titleref
+ %common.att;
+ %simple-xlink.att;
+ %href.att;
+ %user-new.att;>
+
+<!--
+#2000-03-07: maler: Added var.
+-->
+
+<!-- var: String standing for a variable value that the user
+ or system will supply. For example: "For each node
+ <var>x</var> in this node-set..." -->
+<!ELEMENT var (%tech.pcd.mix;)*>
+<!ATTLIST var %common.att;>
+
+<!--
+#1999-07-02: maler: Added show/actuate attributes and default values.
+-->
+
+<!-- xnt: Mention of a nonterminal in text, along with a link to
+ the production in another document that defines it. -->
+<!ELEMENT xnt (#PCDATA)>
+<!-- href attribute:
+ The nonterminal must hyperlink to a resource that serves
+ to define it (e.g., a production in a related XML
+ specification). E.g.:
+
+<xnt href="http://www.w3.org/TR/spec.htm#prod3">Name</xnt>
+ -->
+
+<!ATTLIST xnt
+ %common.att;
+ %simple-xlink.att;
+ %href-req.att;
+ %user-new.att;>
+
+<!--
+#1997-12-29: maler: Declared xspecref.
+#1999-07-02: maler: Added show/actuate attributes and default values.
+-->
+
+<!-- xspecref: Reference to a div, olist item, prod, or issue
+ in a related specification document; should generate
+ no special text. -->
+<!ELEMENT xspecref (#PCDATA)>
+<!-- href attribute:
+ The spec reference must hyperlink to the resource to
+ cross-refer to (e.g., a section in a related XML
+ specification). E.g.:
+
+<xspecref href="http://www.w3.org/TR/spec.htm#sec2">
+the section on constraints</xspecref>
+ -->
+
+<!ATTLIST xspecref
+ %common.att;
+ %simple-xlink.att;
+ %href-req.att;
+ %user-new.att;>
+
+<!--
+#1999-07-02: maler: Added show/actuate attributes and default values.
+-->
+
+<!-- termref: Mention of a term, along with a link to the
+ definition in a related document. -->
+<!ELEMENT xtermref (#PCDATA)>
+<!-- href attribute:
+ The term reference must hyperlink to the resource that
+ serves to define the term (e.g., a term definition in
+ a related XML specification). E.g.:
+
+<xtermref href="http://www.w3.org/TR/spec.htm#term5">
+entity
+</xtermref>
+ -->
+
+<!ATTLIST xtermref
+ %common.att;
+ %simple-xlink.att;
+ %href-req.att;
+ %user-new.att;>
+
+<!-- ............................................................... -->
+<!-- Unused elements for ADEPT ..................................... -->
+<!-- ............................................................... -->
+
+<!--
+#1997-09-30: maler: Added unusued elements.
+#1997-10-14: maler: Fixed div to move nested div to the mixture.
+#1998-05-14: maler: Added key-term, htable, and htbody.
+#1998-11-30: maler: Added para, listitem, itemizedlist, and orderedlist.
+-->
+
+<!-- The following elements are purposely declared but never
+ referenced. Declaring them allows them to be pasted from
+ an HTML document, an earlier version of an XMLspec document,
+ or a DocBook document into a document using this DTD in ADEPT.
+ The ATD Context Transformation mechanism will try to convert
+ them to the appropriate element for this DTD. While this
+ conversion will not work for all fragments, it does allow many
+ cases to work reasonably well. -->
+
+<!ELEMENT div
+ (head?, (%div.mix;|ul|ol|h1|h2|h3|h4|h5|h6|div)*)>
+<!ELEMENT h1 (%head.pcd.mix;|em|a)*>
+<!ELEMENT h2 (%head.pcd.mix;|em|a)*>
+<!ELEMENT h3 (%head.pcd.mix;|em|a)*>
+<!ELEMENT h4 (%head.pcd.mix;|em|a)*>
+<!ELEMENT h5 (%head.pcd.mix;|em|a)*>
+<!ELEMENT h6 (%head.pcd.mix;|em|a)*>
+<!ELEMENT pre (%eg.pcd.mix;|em)*>
+<!ELEMENT ul (item|li)*>
+<!ELEMENT ol (item|li)*>
+<!ELEMENT li (#PCDATA|%obj.mix;)*>
+<!ELEMENT em (#PCDATA)>
+<!ELEMENT a (#PCDATA)>
+
+<!ELEMENT key-term (#PCDATA)>
+<!ELEMENT htable
+ (caption?, (col*|colgroup*), thead?, tfoot?, tbody+)>
+<!ELEMENT htbody (tr)+>
+<!ELEMENT statusp (%p.pcd.mix;|%p.mix;)*>
+
+<!ELEMENT itemizedlist (listitem*)>
+<!ELEMENT orderedlist (listitem*)>
+<!ELEMENT listitem (para*)>
+<!ELEMENT para (#PCDATA)>
+
+<!-- ............................................................... -->
+<!-- Change history ................................................ -->
+<!-- ............................................................... -->
+
+<!--
+#1997-08-18: maler
+#- Did a major revision.
+#1997-09-10: maler
+#- Updated FPI.
+#- Removed namekey element and put key attribute on name element.
+#- Made statusp element and supporting entities.
+#- Added slist element with sitem+ content.
+#- Required head on scrap and added new bnf subelement.
+#- Added an xnt element and allowed it and nt in regular text and rhs.
+#- Removed the ntref element.
+#- Added back the com element to the content of rhs.
+#- Added a key attribute to bibl.
+#- Removed the ident element.
+#- Added a term element to be used inside termdef.
+#- Added an xtermref element parallel to termref.
+#- Beefed up DTD comments.
+#1997-09-12: maler
+#- Allowed term element in general text.
+#- Changed bibref to EMPTY.
+#- Added ref.class to termdef.pcd.mix.
+#1997-09-14: maler
+#- Changed main attribute of xtermref from def to href.
+#- Added termdef.class to label contents.
+#1997-09-30: maler
+#- Added character entity module and added new entities.
+#- Removed p from appearing directly in self; created %p.mix;.
+#- Added inform-div (non-normative division) element.
+#- Fixed xtermref comment to mention href, not ref.
+#- Extended orglist model to allow optional affiliation.
+#- Modified author to make affiliation optional.
+#- Added %speclist.class; and %note.class; to %obj.mix; and %p.mix;.
+#- Added %note.class; and %illus.class; to %termdef.pcd.mix;.
+#- Added unused HTML elements.
+#- Put empty system ID next to public ID in entity declarations.
+#1997-10-14: maler
+#- Fixed "unused" div content model to move nested div to mixture.
+#1997-10-16: maler
+#- Added SGML Open Exchange tables.
+#1997-11-28: maler
+#- Added support for prodgroup and its attributes.
+#- Added support for HTML tables.
+#- Added loc and bibref to content of com.
+#- Added loc to general p content models.
+#- Allowed p as alternative to statusp in status.
+#- Added non-null system IDs to external parameter entity declarations.
+#- (Modified the SGML Open table module to make it XML-compliant.)
+#- (Modified the character entity module.)
+#1997-12-29: maler
+#- Moved #PCDATA occurrences to come before GIs in content models.
+#- Removed use of the SGML Open table module.
+#- Added xspecref element.
+#- Ensured that all FPIs contain 4-digit year.
+#- (Modified the character entity module.)
+#1998-03-10: maler
+#- Merged the character entity and table modules into the main file.
+#- Added ldquo and rdquo entities.
+#- Added common attributes to prodgroup.
+#- Made the email element in header optional.
+#- Removed reference to the SGML Open table model.
+#- Added ednote element.
+#- Added quote element.
+#- Updated XLink usage to reflect 3 March 1998 WD.
+#- Added "local" entities to the class entities for customization.
+#- Parameterized several content models to allow for customization.
+#1998-03-23: maler
+#- Cleaned up some comments and removed some others.
+#- Added xml:space semi-common attribute to eg and bnf elements.
+#- Added show and embed attributes on all the uses of href.
+#- Added %common.att; to all HTML table elements.
+#- Added a real URI to the "typical invocation" comment.
+#1998-05-14: maler
+#- Fixed mdash, ldquo, and rdquo character entities.
+#- Switched to the full HTML 4.0 table model.
+#- Removed htable/htbody elements and replaced them with table/tbody.
+#- Added issue element to %note.class; and declared it.
+#- Allowed prevlocs and latestloc in either order.
+#- Added key-term, htable, htbody, and statusp as unused elements.
+#- Removed real statusp element in favor of plain p.
+#1998-05-21: maler
+#- Declared generic constraint and constraintnote elements.
+#- Added constraintnote to %note.class;.
+#- Added constraint to %eg.pcd.mix; and prod content model.
+#1998-08-22: maler
+#- Fixed %illus.class; to mention table instead of htable.
+#- Added definitions to %illus.class; for DOM model.
+#- Added DOM definitions element and its substructure.
+#- Updated XLink usage in %href.att; to use xlink:form and #IMPLIED.
+#- Added clarifying comments to href-using elements.
+#1998-11-30: maler
+#- Added new unused elements to support DocBook translation.
+#- Updated maler phone numbers.
+#1998-12-3: maler
+#- Fixed character entities with respect to escaping of ampersands.
+#- Added many more explanatory comments.
+#1999-07-02: maler
+#- Added %loc.class; to all PCD mixes that didn't already have it.
+#- Removed unused %loc.pcd.mix;.
+#- Made version in spec header optional.
+#- Added three new attributes to spec.
+#- Broadened content of edtext.
+#- Added optional copyright element to header.
+#- Reorganized XLink-related parameter entities; added xmlns:xlink.
+#- Changed edtext content from #PCDATA to %p.pcd.mix;.
+#- Added show/actuate atts and default values to all href elements.
+#- Changed versioning scheme from 8-digit dates to version numbers.
+#- Added w3c-doctype, other-doctype, status atts to spec element.
+#- Added prodrecap element inside scrap.
+#- Added headstyle attribute to scrap.
+#2000-03-07: maler
+#- Added proto element, its arg subelement, and the %argtypes; entity.
+#- Added function, var, sub, sup, phrase, el, att, attval elements.
+#- Expanded emph to %p.pcd.mix;.
+#- Allowed status and abstract to appear in the opposite order.
+#- Updated XLink usage to the latest WD, except for href and source.
+#- Removed the xml:attributes attribute from graphic.
+#- Added %local.graphic.att; to graphic.
+#- Added common diff attribute.
+#- Added div5 element.
+#- Broadened content models of publoc, prevlocs, and latestloc.
+#- Added head, source, resolution, and status attribute to issue.
+#- Added cr, issues, and dispcmts to w3c-doctype attribute on spec.
+#- Added example element.
+-->
+
+<!-- ............................................................... -->
+<!-- End of XML specification DTD .................................. -->
+<!-- ............................................................... -->
diff --git a/libxslt/tests/xmlspec/xmlspec.xsl b/libxslt/tests/xmlspec/xmlspec.xsl
new file mode 100644
index 0000000..3b426ae
--- /dev/null
+++ b/libxslt/tests/xmlspec/xmlspec.xsl
@@ -0,0 +1,2092 @@
+<?xml version="1.0"?>
+
+<!-- Version: $Id$ -->
+
+<!-- Stylesheet for XMLspec -->
+<!-- Author: Norman Walsh (Norman.Walsh@East.Sun.COM) -->
+<!-- Author: Chris Maden (crism@lexica.net) -->
+<!-- Author: Ben Trafford (ben@legendary.org) -->
+<!-- Author: Eve Maler (eve.maler@east.sun.com) -->
+<!-- Date Created: 1999.09.07 -->
+
+<!-- This stylesheet is copyright (c) 2000 by its authors. Free
+ distribution and modification is permitted, including adding to
+ the list of authors and copyright holders, as long as this
+ copyright notice is maintained. -->
+
+<!-- This stylesheet attempts to implement the XML Specification V2.1
+ DTD. Documents conforming to earlier DTDs may not be correctly
+ transformed. -->
+
+<!-- ChangeLog:
+
+ 25 Sep 2000: (Norman.Walsh@East.Sun.COM)
+ - Sync'd with Eve's version:
+ o Concatenated each inline element's output all on one line
+ to avoid spurious spaces in the output. (This is really an
+ IE bug, but...) (15 Sep 2000)
+ o Updated crism's email address in header (7 Sep 2000)
+ o Changed handling of affiliation to use comma instead of
+ parentheses (9 Aug 2000)
+
+ 14 Aug 2000: (Norman.Walsh@East.Sun.COM)
+
+ - Added additional.title param (for diffspec.xsl to change)
+ - Fixed URI of W3C home icon
+ - Made CSS stylesheet selection depend on the w3c-doctype attribute
+ of spec instead of the w3c-doctype element in the header
+
+ 26 Jul 2000: (Norman.Walsh@East.Sun.COM)
+
+ - Improved semantics of specref. Added xsl:message for unsupported
+ cases. (I'm by no means confident that I've covered the whole
+ list.)
+ - Support @role on author.
+ - Make lhs/rhs "code" in EBNF.
+ - Fixed bug in ID/IDREF linking.
+ - More effectively disabled special markup for showing @diffed
+ versions
+
+ 21 Jul 2000: (Norman.Walsh@East.Sun.COM)
+
+ - Added support for @diff change tracking, primarily through
+ the auxiliary stylesheet diffspec.xsl. However, it was
+ impractical to handle some constructions, such as DLs and TABLEs,
+ in a completely out-of-band manner. So there is some inline
+ support for @diff markup.
+
+ - Added $additional.css to allow downstream stylesheets to add
+ new markup to the <style> element.
+
+ - Added required "type" attribute to the <style> element.
+
+ - Fixed pervasive problem with nested <a> elements.
+
+ - Added doctype-public to xsl:output.
+
+ - Added $validity.hacks. If "1", then additional disable-output-escaping
+ markup may be inserted in some places to attempt to get proper,
+ valid HTML. For example, if a <glist> appears inside a <p> in the
+ xmlspec source, this creates a nested <dl> inside a <p> in the
+ HTML, which is not valid. If $validity.hacks is "1", then an
+ extra </p>, <p> pair is inserted around the <dl>.
+-->
+
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:saxon="http://icl.com/saxon"
+ exclude-result-prefixes="saxon"
+ version="1.0">
+
+ <xsl:param name="validity.hacks">1</xsl:param>
+ <xsl:param name="show.diff.markup">0</xsl:param>
+ <xsl:param name="additional.css"></xsl:param>
+ <xsl:param name="additional.title"></xsl:param>
+ <xsl:param name="called.by.diffspec">0</xsl:param>
+ <xsl:param name="show.ednotes">1</xsl:param>
+
+ <xsl:output method="html"
+ encoding="ISO-8859-1"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+ indent="no"/>
+
+ <xsl:strip-space elements="author"/>
+
+ <!-- not handled:
+ attribute: unhandled IDL stuff
+ case: unhandled IDL stuff
+ component: unhandled IDL stuff
+ constant: unhandled IDL stuff
+ copyright: boilerplate notice always used instead
+ definitions: unhandled IDL stuff
+ descr: unhandled IDL stuff
+ enum: unhandled IDL stuff
+ enumerator: unhandled IDL stuff
+ exception: unhandled IDL stuff
+ group: unhandled IDL stuff
+ interface: unhandled IDL stuff
+ method: unhandled IDL stuff
+ module: unhandled IDL stuff
+ param: unhandled IDL stuff
+ parameters: unhandled IDL stuff
+ raises: unhandled IDL stuff
+ reference: unhandled IDL stuff
+ returns: unhandled IDL stuff
+ sequence: unhandled IDL stuff
+ struct: unhandled IDL stuff
+ typedef: unhandled IDL stuff
+ typename: unhandled IDL stuff
+ union: unhandled IDL stuff
+
+ Warning!
+ Only handles statuses of NOTE, WD, and REC.
+ -->
+
+ <!-- Template for the root node. Creation of <html> element could
+ go here, but that doesn't feel right. -->
+ <xsl:template match="/">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- abstract: appears only in header -->
+ <!-- format as a second-level div -->
+ <!-- called in enforced order from header's template -->
+ <xsl:template match="abstract">
+ <div id="abstract">
+ <xsl:text>&#10;</xsl:text>
+ <h2>
+ <a name="abstract">Abstract</a>
+ </h2>
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- affiliation: follows a name in author and member -->
+ <!-- put it in parens with a leading space -->
+ <xsl:template match="affiliation">
+ <xsl:text>, </xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- arg: appears only in proto -->
+ <!-- argument in function prototype -->
+ <!-- output argument type, italicized as placeholder; separate the
+ list with commas and spaces -->
+ <xsl:template match="arg">
+ <xsl:if test="preceding-sibling::arg">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <var>
+ <xsl:value-of select="@type"/>
+ </var>
+ <xsl:if test="@occur = 'opt'">
+ <xsl:text>?</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- att: attribute name -->
+ <!-- used lots of places -->
+ <!-- format as monospaced code -->
+ <xsl:template match="att">
+ <code><xsl:apply-templates/></code>
+ </xsl:template>
+
+ <!-- attribute: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- attval: attribute name -->
+ <!-- used lots of places -->
+ <!-- format as quoted string -->
+ <xsl:template match="attval">
+ <xsl:text>"</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>"</xsl:text>
+ </xsl:template>
+
+ <!-- authlist: list of authors (editors, really) -->
+ <!-- called in enforced order from header's template, in <dl>
+ context -->
+ <xsl:template match="authlist">
+ <dt>
+ <xsl:text>Editor</xsl:text>
+ <xsl:if test="count(author) > 1">
+ <xsl:text>s</xsl:text>
+ </xsl:if>
+ <xsl:text>:</xsl:text>
+ </dt>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- author: an editor of a spec -->
+ <!-- only appears in authlist -->
+ <!-- called in <dl> context -->
+ <xsl:template match="author">
+ <dd>
+ <xsl:apply-templates/>
+ <xsl:if test="@role = '2e'">
+ <xsl:text> - Second Edition</xsl:text>
+ </xsl:if>
+ </dd>
+ </xsl:template>
+
+ <!-- back: back matter for the spec -->
+ <!-- make a <div> for neatness -->
+ <!-- affects numbering of div1 children -->
+ <xsl:template match="back">
+ <div class="back">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- bibl: bibliographic entry -->
+ <!-- only appears in blist -->
+ <!-- called with <dl> context -->
+ <!-- if there's a key, use it in the <dt>, otherwise use the ID -->
+ <!-- if there's an href, add a ref in parens at the end of the text -->
+ <xsl:template match="bibl">
+ <dt class="label">
+ <xsl:if test="@id">
+ <a name="{@id}"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@key">
+ <xsl:value-of select="@key"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dt>
+ <dd>
+ <xsl:apply-templates/>
+ <xsl:if test="@href">
+ <xsl:text> (See </xsl:text>
+ <a href="{@href}">
+ <xsl:value-of select="@href"/>
+ </a>
+ <xsl:text>.)</xsl:text>
+ </xsl:if>
+ </dd>
+ </xsl:template>
+
+ <!-- bibref: reference to a bibliographic entry -->
+ <!-- make a link to the bibl -->
+ <!-- if the bibl has a key, put it in square brackets; otherwise use
+ the bibl's ID -->
+ <xsl:template match="bibref">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="id(@ref)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:text>[</xsl:text>
+ <xsl:choose>
+ <xsl:when test="id(@ref)/@key">
+ <xsl:value-of select="id(@ref)/@key"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@ref"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>]</xsl:text>
+ </a>
+ </xsl:template>
+
+ <!-- blist: list of bibliographic entries -->
+ <!-- set up the list and process children -->
+ <xsl:template match="blist">
+ <dl>
+ <xsl:apply-templates/>
+ </dl>
+ </xsl:template>
+
+ <!-- bnf: un-marked-up BNF productions -->
+ <!-- preformatted within a table cell -->
+ <!-- scrap provides <table> context -->
+ <xsl:template match="bnf">
+ <tbody>
+ <tr>
+ <td>
+ <xsl:if test="@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <pre>
+ <xsl:apply-templates/>
+ </pre>
+ </td>
+ </tr>
+ </tbody>
+ </xsl:template>
+
+ <!-- body: the meat of the spec -->
+ <!-- create a TOC and then go to work -->
+ <!-- (don't forget the TOC for the back matter and a pointer to end
+ notes) -->
+ <xsl:template match="body">
+ <div class="toc">
+ <xsl:text>&#10;</xsl:text>
+ <h2>
+ <a name="contents">Table of Contents</a>
+ </h2>
+ <p class="toc">
+ <xsl:apply-templates mode="toc" select="div1"/>
+ </p>
+ <xsl:if test="../back">
+ <xsl:text>&#10;</xsl:text>
+ <h3>
+ <xsl:text>Appendi</xsl:text>
+ <xsl:choose>
+ <xsl:when test="count(../back/div1 | ../back/inform-div1) > 1">
+ <xsl:text>ces</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>x</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </h3>
+ <p class="toc">
+ <xsl:apply-templates mode="toc"
+ select="../back/div1 | ../back/inform-div1"/>
+ </p>
+ </xsl:if>
+ <xsl:if test="//footnote">
+ <p class="toc">
+ <a href="#endnotes">
+ <xsl:text>End Notes</xsl:text>
+ </a>
+ </p>
+ </xsl:if>
+ </div>
+ <hr/>
+ <div class="body">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- caption: see table -->
+
+ <!-- case: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- code: generic computer code -->
+ <!-- output as HTML <code> for monospaced formatting -->
+ <xsl:template match="code">
+ <code><xsl:apply-templates/></code>
+ </xsl:template>
+
+ <!-- col: see table -->
+
+ <!-- colgroup: see table -->
+
+ <!-- com: formal production comment -->
+ <!-- can appear in prod or rhs -->
+ <xsl:template match="com">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::*[1][name()='rhs']">
+ <td>
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <i>
+ <xsl:text>/* </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text> */</xsl:text>
+ </i>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <tr valign="baseline">
+ <td/><td/><td/><td/>
+ <td>
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <i>
+ <xsl:text>/* </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text> */</xsl:text>
+ </i>
+ </td>
+ </tr>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- this could probably be handled better, but given that rhs can
+ have arbitrary text and com mixed in, I don't feel like
+ spending enough time to figure out how -->
+ <xsl:template match="rhs/com">
+ <i>
+ <xsl:text>/* </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text> */</xsl:text>
+ </i>
+ </xsl:template>
+
+ <!-- component: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- constant: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- constraint: a note in a formal production -->
+ <!-- refers to a constraint note -->
+ <xsl:template match="constraint">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::*[1][name()='rhs']">
+ <td>
+ <xsl:if test="@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="id(@def)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:text>[Constraint: </xsl:text>
+ <xsl:apply-templates select="id(@def)/head" mode="text"/>
+ <xsl:text>]</xsl:text>
+ </a>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <tr valign="baseline">
+ <td/><td/><td/><td/>
+ <td>
+ <xsl:if test="@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="id(@def)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:text>[Constraint: </xsl:text>
+ <xsl:apply-templates select="id(@def)/head" mode="text"/>
+ <xsl:text>]</xsl:text>
+ </a>
+ </td>
+ </tr>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- constraintnote: note constraining a formal production -->
+ <!-- see also constraintnote/head -->
+ <xsl:template match="constraintnote">
+ <div class="constraint">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- copyright: notice for this document-->
+ <!-- right now, a boilerplate copyright notice is inserted by the
+ template for header; this may need to be changed -->
+
+ <!-- day: day of month of spec -->
+ <!-- only used in pudate; called directly from header template -->
+
+ <!-- def: glossary definition -->
+ <!-- already in <dl> context from glist -->
+ <xsl:template match="def">
+ <dd>
+ <xsl:apply-templates/>
+ </dd>
+ </xsl:template>
+
+ <!-- definitions: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- descr: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- div[n]: structural divisions -->
+ <!-- make an HTML div -->
+ <!-- see also div[n]/head -->
+ <xsl:template match="div1">
+ <div class="div1">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="div2">
+ <div class="div2">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="div3">
+ <div class="div3">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="div4">
+ <div class="div4">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="div5">
+ <div class="div5">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- ednote: editors' note -->
+ <xsl:template match="ednote">
+ <xsl:if test="$show.ednotes != 0">
+ <table border="1">
+ <xsl:attribute name="summary">
+ <xsl:text>Editorial note</xsl:text>
+ <xsl:if test="name">
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="name"/>
+ </xsl:if>
+ </xsl:attribute>
+ <tr>
+ <td align="left" valign="top" width="50%">
+ <b>
+ <xsl:text>Editorial note</xsl:text>
+ <xsl:if test="name">
+ <xsl:text>: </xsl:text>
+ <xsl:apply-templates select="name"/>
+ </xsl:if>
+ </b>
+ </td>
+ <td align="right" valign="top" width="50%">
+ <xsl:choose>
+ <xsl:when test="date">
+ <xsl:apply-templates select="date"/>
+ </xsl:when>
+ <xsl:otherwise>&#160;</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="left" valign="top">
+ <xsl:apply-templates select="edtext"/>
+ </td>
+ </tr>
+ </table>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="date">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- edtext: text of an editors' note -->
+ <!-- ednote is currently hidden -->
+
+ <!-- eg: a literal example -->
+ <!-- present as preformatted text -->
+ <xsl:template match="eg">
+ <table class="eg" cellpadding="5" border="1"
+ bgcolor="#99ffff" width="100%"
+ summary="Example">
+ <tr>
+ <td>
+ <xsl:if test="@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <pre>
+ <xsl:apply-templates/>
+ </pre>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <!-- el: an XML element -->
+ <!-- present as preformatted text, no markup -->
+ <!-- Chris's personal preference is to put pointy-brackets around
+ this, but he seems to be in the minority -->
+ <xsl:template match="el">
+ <code><xsl:apply-templates/></code>
+ </xsl:template>
+
+ <!-- email: an email address for an editor -->
+ <!-- only occurs in author -->
+ <xsl:template match="email">
+ <xsl:text> </xsl:text>
+ <a href="{@href}">
+ <xsl:text>&lt;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&gt;</xsl:text>
+ </a>
+ </xsl:template>
+
+ <!-- emph: in-line emphasis -->
+ <!-- equates to HTML <em> -->
+ <!-- the role attribute could be used for multiple kinds of
+ emphasis, but that would not be kind -->
+ <xsl:template match="emph">
+ <em><xsl:apply-templates/></em>
+ </xsl:template>
+
+ <!-- enum: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- enumerator: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- example: what it seems -->
+ <!-- block-level with title -->
+ <!-- see also example/head -->
+ <xsl:template match="example">
+ <div class="example">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- exception: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- footnote: format as endnote, actually -->
+ <xsl:template match="footnote">
+ <xsl:variable name="this-note-id">
+ <xsl:choose>
+ <xsl:when test="@id">
+ <xsl:value-of select="@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id(.)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <a name="FN-ANCH-{$this-note-id}" href="#{$this-note-id}">
+ <xsl:number level="any" format="[1]"/>
+ </a>
+ </xsl:template>
+
+ <!-- front: front matter for the spec -->
+ <!-- make a div for cleanliness -->
+ <xsl:template match="front">
+ <div class="front">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- function: name of a function -->
+ <!-- format as HTML <code> for monospaced presentation -->
+ <xsl:template match="function">
+ <code><xsl:apply-templates/></code>
+ </xsl:template>
+
+ <!-- gitem: glossary list entry -->
+ <!-- just pass children through for <dd>/<dt> formatting -->
+ <xsl:template match="gitem">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- glist: glossary list -->
+ <!-- create <dl> and handle children -->
+ <xsl:template match="glist">
+ <xsl:if test="$validity.hacks and local-name(..) = 'p'">
+ <xsl:text disable-output-escaping="yes">&lt;/p&gt;</xsl:text>
+ </xsl:if>
+ <dl>
+ <xsl:apply-templates/>
+ </dl>
+ <xsl:if test="$validity.hacks and local-name(..) = 'p'">
+ <xsl:text disable-output-escaping="yes">&lt;p&gt;</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- graphic: external illustration -->
+ <!-- reference external graphic file with alt text -->
+ <xsl:template match="graphic">
+ <img src="{@source}">
+ <xsl:if test="@alt">
+ <xsl:attribute name="alt">
+ <xsl:value-of select="@alt"/>
+ </xsl:attribute>
+ </xsl:if>
+ </img>
+ </xsl:template>
+
+ <!-- group: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- head: title for a variety of constructs -->
+
+ <!-- constraintnotes have different types, but they're
+ non-enumerated; nothing is done with them right now -->
+ <xsl:template match="constraintnote/head">
+ <p class="prefix">
+ <xsl:if test="../@id">
+ <a name="{../@id}"/>
+ </xsl:if>
+ <b><xsl:text>Constraint: </xsl:text><xsl:apply-templates/></b>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="div1/head">
+ <xsl:text>&#10;</xsl:text>
+ <h2>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:choose>
+ <xsl:when test="../@id">
+ <xsl:value-of select="../@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id(..)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </a>
+ <xsl:apply-templates select=".." mode="divnum"/>
+ <xsl:apply-templates/>
+ </h2>
+ </xsl:template>
+
+ <xsl:template match="div2/head">
+ <xsl:text>&#10;</xsl:text>
+ <h3>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:choose>
+ <xsl:when test="../@id">
+ <xsl:value-of select="../@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id(..)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </a>
+ <xsl:apply-templates select=".." mode="divnum"/>
+ <xsl:apply-templates/>
+ </h3>
+ </xsl:template>
+
+ <xsl:template match="div3/head">
+ <xsl:text>&#10;</xsl:text>
+ <h4>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:choose>
+ <xsl:when test="../@id">
+ <xsl:value-of select="../@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id(..)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </a>
+ <xsl:apply-templates select=".." mode="divnum"/>
+ <xsl:apply-templates/>
+ </h4>
+ </xsl:template>
+
+ <xsl:template match="div4/head">
+ <xsl:text>&#10;</xsl:text>
+ <h5>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:choose>
+ <xsl:when test="../@id">
+ <xsl:value-of select="../@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id(..)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </a>
+ <xsl:apply-templates select=".." mode="divnum"/>
+ <xsl:apply-templates/>
+ </h5>
+ </xsl:template>
+
+ <xsl:template match="div5/head">
+ <xsl:text>&#10;</xsl:text>
+ <h6>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:choose>
+ <xsl:when test="../@id">
+ <xsl:value-of select="../@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id(..)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </a>
+ <xsl:apply-templates select=".." mode="divnum"/>
+ <xsl:apply-templates/>
+ </h6>
+ </xsl:template>
+
+ <xsl:template match="example/head">
+ <xsl:text>&#10;</xsl:text>
+ <h5>
+ <xsl:text>Example: </xsl:text>
+ <xsl:apply-templates/>
+ </h5>
+ </xsl:template>
+
+ <xsl:template match="inform-div1/head">
+ <xsl:text>&#10;</xsl:text>
+ <h2>
+ <a>
+ <xsl:attribute name="name">
+ <xsl:choose>
+ <xsl:when test="../@id">
+ <xsl:value-of select="../@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id(..)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </a>
+ <xsl:apply-templates select=".." mode="divnum"/>
+ <xsl:apply-templates/>
+ <xsl:text> (Non-Normative)</xsl:text>
+ </h2>
+ </xsl:template>
+
+ <xsl:template match="issue/head">
+ <p class="prefix">
+ <b><xsl:apply-templates/></b>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="scrap/head">
+ <xsl:text>&#10;</xsl:text>
+ <h5>
+ <xsl:apply-templates/>
+ </h5>
+ </xsl:template>
+
+ <xsl:template match="vcnote/head">
+ <p class="prefix">
+ <xsl:if test="../@id">
+ <a name="{../@id}"/>
+ </xsl:if>
+ <b><xsl:text>Validity constraint: </xsl:text><xsl:apply-templates/></b>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="wfcnote/head">
+ <p class="prefix">
+ <xsl:if test="../@id">
+ <a name="{../@id}"/>
+ </xsl:if>
+ <b><xsl:text>Well-formedness constraint: </xsl:text><xsl:apply-templates/></b>
+ </p>
+ </xsl:template>
+
+ <!-- header: metadata about the spec -->
+ <!-- pull out information into standard W3C layout -->
+ <xsl:template match="header">
+ <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>
+ <xsl:text>&#10;</xsl:text>
+ <h1>
+ <xsl:apply-templates select="title"/>
+ <xsl:if test="version">
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="version"/>
+ </xsl:if>
+ </h1>
+ <xsl:if test="subtitle">
+ <xsl:text>&#10;</xsl:text>
+ <h2>
+ <xsl:apply-templates select="subtitle"/>
+ </h2>
+ </xsl:if>
+ <xsl:text>&#10;</xsl:text>
+ <h2>
+ <xsl:apply-templates select="w3c-doctype"/>
+ <xsl:text> </xsl:text>
+ <xsl:if test="pubdate/day">
+ <xsl:apply-templates select="pubdate/day"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates select="pubdate/month"/>
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="pubdate/year"/>
+ </h2>
+ <dl>
+ <xsl:apply-templates select="publoc"/>
+ <xsl:apply-templates select="latestloc"/>
+ <xsl:apply-templates select="prevlocs"/>
+ <xsl:apply-templates select="authlist"/>
+ </dl>
+ <p class="copyright">
+ <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">
+ <xsl:text>Copyright</xsl:text>
+ </a>
+ <xsl:text>&#xa0;&#xa9;&#xa0;</xsl:text>
+ <xsl:apply-templates select="pubdate/year"/>
+ <xsl:text>&#xa0;</xsl:text>
+ <a href="http://www.w3.org/">
+ <abbr title="World Wide Web Consortium">W3C</abbr>
+ </a>
+ <sup>&#xae;</sup>
+ <xsl:text> (</xsl:text>
+ <a href="http://www.lcs.mit.edu/">
+ <abbr title="Massachusetts Institute of Technology">MIT</abbr>
+ </a>
+ <xsl:text>, </xsl:text>
+ <a href="http://www.inria.fr/">
+ <abbr lang="fr"
+ title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr>
+ </a>
+ <xsl:text>, </xsl:text>
+ <a href="http://www.keio.ac.jp/">Keio</a>
+ <xsl:text>), All Rights Reserved. W3C </xsl:text>
+ <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>
+ <xsl:text>, </xsl:text>
+ <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ <xsl:text>, </xsl:text>
+ <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</a>
+ <xsl:text>, and </xsl:text>
+ <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</a>
+ <xsl:text> rules apply.</xsl:text>
+ </p>
+ </div>
+ <hr/>
+ <xsl:apply-templates select="notice"/>
+ <xsl:apply-templates select="abstract"/>
+ <xsl:apply-templates select="status"/>
+ </xsl:template>
+
+ <!-- inform-div1: non-normative back matter top-level division -->
+ <!-- treat like div1 except add "(Non-Normative)" to title -->
+ <xsl:template match="inform-div1">
+ <div class="div1">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- interface: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- issue: open issue before the Working Group -->
+ <!-- maintain an ID for linking to it -->
+ <!-- currently generates boilerplate head plus optional head child
+ element; this should probably be cleaned up to only use the
+ head if it's present -->
+ <xsl:template match="issue">
+ <div class="issue">
+ <p class="prefix">
+ <xsl:if test="@id">
+ <a name="{@id}"/>
+ </xsl:if>
+ <b><xsl:text>Issue (</xsl:text><xsl:value-of select="@id"/><xsl:text>):</xsl:text></b>
+ </p>
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- item: generic list item -->
+ <xsl:template match="item">
+ <li>
+ <xsl:apply-templates/>
+ </li>
+ </xsl:template>
+
+ <!-- kw: keyword -->
+ <!-- make it bold -->
+ <xsl:template match="kw">
+ <b><xsl:apply-templates/></b>
+ </xsl:template>
+
+ <!-- label: term for defintion in glossary entry -->
+ <!-- already in <dl> context from glist -->
+ <xsl:template match="label">
+ <dt class="label">
+ <xsl:if test="@id"><a name="{@id}"/></xsl:if>
+ <xsl:apply-templates/>
+ </dt>
+ </xsl:template>
+
+ <!-- language: -->
+ <!-- langusage: -->
+ <!-- identify language usage within a spec; not actually formatted -->
+
+ <!-- latestloc: latest location for this spec -->
+ <!-- called in a <dl> context from header -->
+ <xsl:template match="latestloc">
+ <dt>Latest version:</dt>
+ <dd>
+ <xsl:apply-templates/>
+ </dd>
+ </xsl:template>
+
+ <!-- lhs: left-hand side of formal productions -->
+ <!-- make a table row with the lhs and the corresponding other
+ pieces in this crazy mixed-up content model -->
+ <xsl:template match="lhs">
+ <tr valign="baseline">
+ <td>
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="../@id">
+ <a name="{../@id}"/>
+ </xsl:if>
+ <xsl:apply-templates select="ancestor::prod" mode="number"/>
+<!--
+ This could be done right here, but XT goes into deep space when the
+ node to be numbered isn't the current node and level="any":
+ <xsl:number count="prod" level="any" from="spec"
+ format="[1]"/>
+ -->
+ <xsl:text>&#xa0;&#xa0;&#xa0;</xsl:text>
+ </td>
+ <td>
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <code><xsl:apply-templates/></code>
+ </td>
+ <td>
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:text>&#xa0;&#xa0;&#xa0;::=&#xa0;&#xa0;&#xa0;</xsl:text>
+ </td>
+ <xsl:apply-templates
+ select="following-sibling::*[1][name()='rhs']"/>
+ </tr>
+ </xsl:template>
+
+ <!-- loc: a Web location -->
+ <!-- outside the header, it's a normal cross-reference -->
+ <xsl:template match="loc">
+ <a href="{@href}">
+ <xsl:apply-templates/>
+ </a>
+ </xsl:template>
+
+ <!-- member: member of an organization -->
+ <!-- appears only in orglist, which creates <ul> context -->
+ <xsl:template match="member">
+ <li>
+ <xsl:apply-templates/>
+ </li>
+ </xsl:template>
+
+ <!-- method: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- module: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- month: month of spec -->
+ <!-- only used in pudate; called directly from header template -->
+
+ <!-- name: name of an editor or organization member -->
+ <!-- only appears in author and member -->
+ <!-- just output text -->
+ <xsl:template match="name">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- note: a note about the spec -->
+ <xsl:template match="note">
+ <div class="note">
+ <p class="prefix">
+ <b>Note:</b>
+ </p>
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- notice: a front-matter advisory about the spec's status -->
+ <!-- make sure people notice it -->
+ <xsl:template match="notice">
+ <div class="notice">
+ <p class="prefix">
+ <b>NOTICE:</b>
+ </p>
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- nt: production non-terminal -->
+ <!-- make a link to the non-terminal's definition -->
+ <xsl:template match="nt">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="id(@def)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </a>
+ </xsl:template>
+
+ <!-- olist: an ordered list -->
+ <xsl:template match="olist">
+ <ol>
+ <xsl:apply-templates/>
+ </ol>
+ </xsl:template>
+
+ <!-- orglist: a list of an organization's members -->
+ <xsl:template match="orglist">
+ <ul>
+ <xsl:apply-templates/>
+ </ul>
+ </xsl:template>
+
+ <!-- p: a standard paragraph -->
+ <xsl:template match="p">
+ <p>
+ <xsl:if test="@id">
+ <xsl:attribute name="id">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@role">
+ <xsl:attribute name="class">
+ <xsl:value-of select="@role"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </p>
+ </xsl:template>
+
+ <!-- param: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- parameters: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- phrase: semantically meaningless markup hanger -->
+ <!-- role attributes may be used to request different formatting,
+ which isn't currently handled -->
+ <xsl:template match="phrase">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- prevlocs: previous locations for this spec -->
+ <!-- called in a <dl> context from header -->
+ <xsl:template match="prevlocs">
+ <dt>Previous versions:</dt>
+ <dd>
+ <xsl:apply-templates/>
+ </dd>
+ </xsl:template>
+
+ <!-- prod: a formal grammar production -->
+ <!-- if not in a prodgroup, needs a <tbody> -->
+ <!-- has a weird content model; makes a table but there are no
+ explicit rules; many different things can start a new row -->
+ <!-- process the first child in each row, and it will process the
+ others -->
+ <xsl:template match="prod">
+ <tbody>
+ <xsl:apply-templates
+ select="lhs |
+ rhs[preceding-sibling::*[1][name()!='lhs']] |
+ com[preceding-sibling::*[1][name()!='rhs']] |
+ constraint[preceding-sibling::*[1][name()!='rhs']] |
+ vc[preceding-sibling::*[1][name()!='rhs']] |
+ wfc[preceding-sibling::*[1][name()!='rhs']]"/>
+ </tbody>
+ </xsl:template>
+
+ <xsl:template match="prodgroup/prod">
+ <xsl:apply-templates
+ select="lhs |
+ rhs[preceding-sibling::*[1][name()!='lhs']] |
+ com[preceding-sibling::*[1][name()!='rhs']] |
+ constraint[preceding-sibling::*[1][name()!='rhs']] |
+ vc[preceding-sibling::*[1][name()!='rhs']] |
+ wfc[preceding-sibling::*[1][name()!='rhs']]"/>
+ </xsl:template>
+
+ <!-- prodgroup: group of formal productions -->
+ <!-- create one <tbody> for each group -->
+ <xsl:template match="prodgroup">
+ <tbody>
+ <xsl:apply-templates/>
+ </tbody>
+ </xsl:template>
+
+ <!-- prodrecap: reiteration of a prod -->
+ <!-- process the prod in another node that will never generate a
+ <tbody> or a number, plus links the lhs to the original
+ production -->
+ <xsl:template match="prodrecap">
+ <tbody>
+ <xsl:apply-templates select="id(@ref)" mode="ref"/>
+ </tbody>
+ </xsl:template>
+
+ <!-- proto: function prototype -->
+ <!-- type and name of the function, with arguments in parens -->
+ <xsl:template match="proto">
+ <p>
+ <em><xsl:value-of select="@return-type"/></em>
+ <xsl:text> </xsl:text>
+ <b><xsl:value-of select="@name"/></b>
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>)</xsl:text>
+ </p>
+ </xsl:template>
+
+ <!-- pubdate: date of spec -->
+ <!-- called directly from header -->
+
+ <!-- publoc: location of current version of spec -->
+ <!-- called from header in <dl> context -->
+ <xsl:template match="publoc">
+ <dt>This version:</dt>
+ <dd>
+ <xsl:apply-templates/>
+ </dd>
+ </xsl:template>
+
+ <!-- pubstmt: statement of publication -->
+ <!-- not currently output -->
+
+ <!-- quote: a quoted string or phrase -->
+ <!-- it would be nice to use HTML <q> elements, but browser support
+ is abysmal -->
+ <xsl:template match="quote">
+ <xsl:text>"</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>"</xsl:text>
+ </xsl:template>
+
+ <!-- raises: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- reference: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- resolution: resolution of an issue -->
+ <xsl:template match="resolution">
+ <p class="prefix">
+ <b>Resolution:</b>
+ </p>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- returns: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- revisiondesc: description of spec revision -->
+ <!-- used for internal tracking; not formatted -->
+
+ <!-- rhs: right-hand side of a formal production -->
+ <!-- make a table cell; if it's not the first after an LHS, make a
+ new row, too -->
+ <xsl:template match="rhs">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::*[1][name()='lhs']">
+ <td>
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <code><xsl:apply-templates/></code>
+ </td>
+ <xsltdebug/>
+ <xsl:apply-templates
+ select="following-sibling::*[1][name()='com' or
+ name()='constraint' or
+ name()='vc' or
+ name()='wfc']"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <tr valign="baseline">
+ <td/><td/><td/>
+ <td>
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <code><xsl:apply-templates/></code>
+ </td>
+ <xsl:apply-templates
+ select="following-sibling::*[1][name()='com' or
+ name()='constraint' or
+ name()='vc' or
+ name()='wfc']"/>
+ </tr>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- role: part played by a member of an organization -->
+ <xsl:template match="role">
+ <xsl:text> (</xsl:text>
+ <i><xsl:apply-templates/></i>
+ <xsl:text>) </xsl:text>
+ </xsl:template>
+
+ <!-- scrap: series of formal grammar productions -->
+ <!-- set up a <table> and handle children -->
+ <xsl:template match="scrap">
+ <xsl:apply-templates select="head"/>
+ <table class="scrap" summary="Scrap">
+ <xsl:apply-templates select="bnf | prod | prodgroup"/>
+ </table>
+ </xsl:template>
+
+ <!-- sequence: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- sitem: simple list item -->
+ <!-- just make one paragraph with <br>s between items -->
+ <xsl:template match="sitem[position() &gt; 1]">
+ <br/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- slist: simple list -->
+ <!-- using a <blockquote> to indent the list is very wrong, but it
+ works -->
+ <xsl:template match="slist">
+ <blockquote>
+ <p>
+ <xsl:apply-templates/>
+ </p>
+ </blockquote>
+ </xsl:template>
+
+ <!-- source: the source of an issue -->
+ <xsl:template match="source">
+ <p>
+ <b>Source</b>
+ <xsl:text>: </xsl:text>
+ <xsl:apply-templates/>
+ </p>
+ </xsl:template>
+
+ <!-- sourcedesc: description of spec preparation -->
+ <!-- used for tracking the source, but not formatted -->
+
+ <!-- spec: the specification itself -->
+ <xsl:template match="spec">
+ <html>
+ <xsl:if test="header/langusage/language">
+ <xsl:attribute name="lang">
+ <xsl:value-of select="header/langusage/language/@id"/>
+ </xsl:attribute>
+ </xsl:if>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+ <title>
+ <xsl:apply-templates select="header/title"/>
+ <xsl:if test="header/version">
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="header/version"/>
+ </xsl:if>
+ <xsl:if test="$additional.title != ''">
+ <xsl:text> -- </xsl:text>
+ <xsl:value-of select="$additional.title"/>
+ </xsl:if>
+ </title>
+ <xsl:call-template name="css"/>
+ </head>
+ <body>
+ <xsl:apply-templates/>
+ <xsl:if test="//footnote">
+ <hr/>
+ <div class="endnotes">
+ <xsl:text>&#10;</xsl:text>
+ <h3>
+ <a name="endnotes">
+ <xsl:text>End Notes</xsl:text>
+ </a>
+ </h3>
+ <dl>
+ <xsl:apply-templates select="//footnote" mode="notes"/>
+ </dl>
+ </div>
+ </xsl:if>
+ </body>
+ </html>
+ </xsl:template>
+
+ <!-- specref: reference to another part of teh current specification -->
+ <xsl:template match="specref">
+ <xsl:variable name="target" select="id(@ref)[1]"/>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="id(@ref)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with(local-name($target), 'div')">
+ <b><xsl:apply-templates select="id(@ref)" mode="divnum"/><xsl:apply-templates select="id(@ref)/head" mode="text"/></b>
+ </xsl:when>
+ <xsl:when test="starts-with(local-name($target), 'inform-div')">
+ <b><xsl:apply-templates select="id(@ref)" mode="divnum"/><xsl:apply-templates select="id(@ref)/head" mode="text"/></b>
+ </xsl:when>
+ <xsl:when test="local-name($target) = 'vcnote'">
+ <b><xsl:text>[VC: </xsl:text><xsl:apply-templates select="id(@ref)/head" mode="text"/><xsl:text>]</xsl:text></b>
+ </xsl:when>
+ <xsl:when test="local-name($target) = 'prod'">
+ <b>
+ <xsl:text>[PROD: </xsl:text>
+ <xsl:apply-templates select="$target" mode="number-simple"/>
+ <xsl:text>]</xsl:text>
+ </b>
+ </xsl:when>
+ <xsl:when test="local-name($target) = 'label'">
+ <b>
+ <xsl:text>[</xsl:text>
+ <xsl:value-of select="$target"/>
+ <xsl:text>]</xsl:text>
+ </b>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:text>Unsupported specref to </xsl:text>
+ <xsl:value-of select="local-name($target)"/>
+ <xsl:text> [</xsl:text>
+ <xsl:value-of select="@ref"/>
+ <xsl:text>] </xsl:text>
+ <xsl:text> (Contact stylesheet maintainer).</xsl:text>
+ </xsl:message>
+ <b>???</b>
+ </xsl:otherwise>
+ </xsl:choose>
+ </a>
+ </xsl:template>
+
+ <!-- status: the status of the spec -->
+ <xsl:template match="status">
+ <div id="status">
+ <xsl:text>&#10;</xsl:text>
+ <h2>
+ <a name="status">Status of this Document</a>
+ </h2>
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- struct: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- sub: subscript -->
+ <xsl:template match="sub">
+ <sub>
+ <xsl:apply-templates/>
+ </sub>
+ </xsl:template>
+
+ <!-- subtitle: secondary title of spec -->
+ <!-- handled directly within header -->
+
+ <!-- sup: superscript -->
+ <xsl:template match="sup">
+ <sup>
+ <xsl:apply-templates/>
+ </sup>
+ </xsl:template>
+
+ <!-- table: the HTML table model adopted wholesale -->
+ <!-- tbody: -->
+ <!-- td: -->
+ <xsl:template
+ match="caption | col | colgroup | table | tbody | td | tfoot | th | thead | tr">
+ <xsl:copy>
+ <xsl:for-each select="@*">
+ <!-- Wait: some of these aren't HTML attributes after all... -->
+ <xsl:if test="local-name(.) != 'diff'">
+ <xsl:copy>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- term: the actual mention of a term within a termdef -->
+ <xsl:template match="term">
+ <b><xsl:apply-templates/></b>
+ </xsl:template>
+
+ <!-- termdef: sentence or phrase defining a term -->
+ <xsl:template match="termdef">
+ <xsl:text>[</xsl:text>
+ <a name="{@id}" title="{@term}">
+ <xsl:text>Definition</xsl:text>
+ </a>
+ <xsl:text>: </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>]</xsl:text>
+ </xsl:template>
+
+ <!-- termref: reference to a defined term -->
+ <xsl:template match="termref">
+ <a title="{id(@def)/@term}">
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="id(@def)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </a>
+ </xsl:template>
+
+ <!-- tfoot: see table -->
+ <!-- th: see table -->
+ <!-- thead: see table -->
+
+ <!-- title: title of the specification -->
+ <!-- called directly within header -->
+
+ <!-- titleref: reference to the title of any work -->
+ <!-- if a URL is given, link it -->
+ <xsl:template match="titleref">
+ <xsl:choose>
+ <xsl:when test="@href">
+ <a href="{@href}">
+ <cite>
+ <xsl:apply-templates/>
+ </cite>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <cite>
+ <xsl:apply-templates/>
+ </cite>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- tr: see table -->
+
+ <!-- typedef: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- typename: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- ulist: unordered list -->
+ <xsl:template match="ulist">
+ <ul>
+ <xsl:apply-templates/>
+ </ul>
+ </xsl:template>
+
+ <!-- union: -->
+ <!-- IDL stuff isn't handled yet -->
+
+ <!-- var: a variable -->
+ <xsl:template match="var">
+ <var>
+ <xsl:apply-templates/>
+ </var>
+ </xsl:template>
+
+ <!-- vc: validity check reference in a formal production -->
+ <xsl:template match="vc">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::*[1][name()='rhs']">
+ <td>
+ <xsl:if test="@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="id(@def)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:text>[VC: </xsl:text>
+ <xsl:apply-templates select="id(@def)/head" mode="text"/>
+ <xsl:text>]</xsl:text>
+ </a>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <tr valign="baseline">
+ <td/><td/><td/><td/>
+ <td>
+ <xsl:if test="@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="id(@def)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:text>[VC: </xsl:text>
+ <xsl:apply-templates select="id(@def)/head" mode="text"/>
+ <xsl:text>]</xsl:text>
+ </a>
+ </td>
+ </tr>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- vcnote: validity check note after a formal production -->
+ <xsl:template match="vcnote">
+ <div class="constraint">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- version: version of this spec -->
+ <!-- called directly from header -->
+
+ <!-- w3c-designation: canonical name for this spec -->
+ <!-- not used for formatting -->
+
+ <!-- w3c-doctype: type of document the specification is -->
+ <!-- used by header template to select CSS stylesheet for output
+ HTML -->
+
+ <!-- wfc: well-formedness check reference in a formal production -->
+ <xsl:template match="wfc">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::*[1][name()='rhs']">
+ <td>
+ <xsl:if test="@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="id(@def)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:text>[WFC: </xsl:text>
+ <xsl:apply-templates select="id(@def)/head" mode="text"/>
+ <xsl:text>]</xsl:text>
+ </a>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <tr valign="baseline">
+ <td/><td/><td/><td/>
+ <td>
+ <xsl:if test="@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="id(@def)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:text>[WFC: </xsl:text>
+ <xsl:apply-templates select="id(@def)/head" mode="text"/>
+ <xsl:text>]</xsl:text>
+ </a>
+ </td>
+ </tr>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- wfcnote: well-formedness check note after formal production -->
+ <xsl:template match="wfcnote">
+ <div class="constraint">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <!-- xnt: external non-terminal -->
+ <!-- xspecref: external specification reference -->
+ <!-- xtermref: external term reference -->
+ <!-- just link to URI provided -->
+ <xsl:template match="xnt | xspecref | xtermref">
+ <a href="{@href}">
+ <xsl:apply-templates/>
+ </a>
+ </xsl:template>
+
+ <!-- year: year of spec -->
+ <!-- only used in pudate; called directly from header template -->
+
+ <!-- Silly HTML elements used for pasting stuff in; shouldn't ever
+ show up in a spec, but they're easy to handle and you just
+ never know. -->
+ <xsl:template match="a|div|em|h1|h2|h3|h4|h5|h6|li|ol|pre|ul">
+ <xsl:copy>
+ <xsl:for-each select="@*">
+ <xsl:copy>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:for-each>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- legacy XML spec stuff -->
+ <xsl:template match="htable">
+ <table summary="HTML Table">
+ <xsl:for-each select="@*">
+ <xsl:copy>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:for-each>
+ <xsl:apply-templates/>
+ </table>
+ </xsl:template>
+ <xsl:template match="htbody">
+ <tbody>
+ <xsl:for-each select="@*">
+ <xsl:copy>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:for-each>
+ <xsl:apply-templates/>
+ </tbody>
+ </xsl:template>
+ <xsl:template match="key-term">
+ <b><xsl:apply-templates/></b>
+ </xsl:template>
+ <xsl:template match="statusp">
+ <p>
+ <xsl:apply-templates/>
+ </p>
+ </xsl:template>
+
+ <!-- legacy DocBook stuff -->
+ <xsl:template match="itemizedlist">
+ <ul>
+ <xsl:apply-templates/>
+ </ul>
+ </xsl:template>
+ <xsl:template match="listitem">
+ <li>
+ <xsl:apply-templates/>
+ </li>
+ </xsl:template>
+ <xsl:template match="orderedlist">
+ <ol>
+ <xsl:apply-templates/>
+ </ol>
+ </xsl:template>
+ <xsl:template match="para">
+ <p>
+ <xsl:apply-templates/>
+ </p>
+ </xsl:template>
+
+ <!-- mode: divnum -->
+ <xsl:template mode="divnum" match="div1">
+ <xsl:number format="1 "/>
+ </xsl:template>
+
+ <xsl:template mode="divnum" match="back/div1 | inform-div1">
+ <xsl:number count="div1 | inform-div1" format="A "/>
+ </xsl:template>
+
+ <xsl:template mode="divnum"
+ match="front/div1 | front//div2 | front//div3 | front//div4 | front//div5"/>
+
+ <xsl:template mode="divnum" match="div2">
+ <xsl:number level="multiple" count="div1 | div2" format="1.1 "/>
+ </xsl:template>
+
+ <xsl:template mode="divnum" match="back//div2">
+ <xsl:number level="multiple" count="div1 | div2 | inform-div1"
+ format="A.1 "/>
+ </xsl:template>
+
+ <xsl:template mode="divnum" match="div3">
+ <xsl:number level="multiple" count="div1 | div2 | div3"
+ format="1.1.1 "/>
+ </xsl:template>
+
+ <xsl:template mode="divnum" match="back//div3">
+ <xsl:number level="multiple"
+ count="div1 | div2 | div3 | inform-div1" format="A.1.1 "/>
+ </xsl:template>
+
+ <xsl:template mode="divnum" match="div4">
+ <xsl:number level="multiple" count="div1 | div2 | div3 | div4"
+ format="1.1.1.1 "/>
+ </xsl:template>
+
+ <xsl:template mode="divnum" match="back//div4">
+ <xsl:number level="multiple"
+ count="div1 | div2 | div3 | div4 | inform-div1"
+ format="A.1.1.1 "/>
+ </xsl:template>
+
+ <xsl:template mode="divnum" match="div5">
+ <xsl:number level="multiple"
+ count="div1 | div2 | div3 | div4 | div5" format="1.1.1.1.1 "/>
+ </xsl:template>
+
+ <xsl:template mode="divnum" match="back//div5">
+ <xsl:number level="multiple"
+ count="div1 | div2 | div3 | div4 | div5 | inform-div1"
+ format="A.1.1.1.1 "/>
+ </xsl:template>
+
+ <!-- mode: notes -->
+ <xsl:template mode="notes" match="footnote">
+ <xsl:variable name="this-note-id">
+ <xsl:choose>
+ <xsl:when test="@id">
+ <xsl:value-of select="@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id(.)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <dt>
+ <a name="{$this-note-id}" href="#FN-ANCH-{$this-note-id}">
+ <xsl:number level="any" format="[1]"/>
+ </a>
+ </dt>
+ <dd>
+ <xsl:apply-templates/>
+ </dd>
+ </xsl:template>
+
+ <!-- mode: number -->
+ <xsl:template mode="number" match="prod">
+ <xsl:text>[</xsl:text>
+ <xsl:apply-templates select="." mode="number-simple"/>
+ <xsl:text>]</xsl:text>
+ </xsl:template>
+
+ <xsl:template mode="number" match="prod[@diff='add']">
+ <xsl:text>[</xsl:text>
+ <xsl:apply-templates select="preceding::prod[not(@diff='add')][1]"
+ mode="number-simple"/>
+<!--
+ Once again, this could be done right here, but XT won't hear of it.
+ <xsl:number level="any" count="prod[not(@diff='add')]"/>
+ -->
+ <xsl:number level="any" count="prod[@diff='add']"
+ from="prod[not(@diff='add')]" format="a"/>
+ <xsl:text>]</xsl:text>
+ </xsl:template>
+
+ <!-- mode: number-simple -->
+ <xsl:template mode="number-simple" match="prod">
+ <xsl:number level="any" count="prod[not(@diff='add')]"/>
+ </xsl:template>
+
+ <!-- mode: ref -->
+ <xsl:template match="lhs" mode="ref">
+ <tr valign="baseline">
+ <td/>
+ <td>
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="../@id">
+ <a name="{../@id}"/>
+ </xsl:if>
+ <code><xsl:apply-templates/></code>
+ </td>
+ <td>
+ <xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
+ <xsl:attribute name="class">
+ <xsl:text>diff-</xsl:text>
+ <xsl:value-of select="ancestor-or-self::*/@diff"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:text>&#xa0;&#xa0;&#xa0;::=&#xa0;&#xa0;&#xa0;</xsl:text>
+ </td>
+ <xsl:apply-templates
+ select="following-sibling::*[1][name()='rhs']"/>
+ </tr>
+ </xsl:template>
+
+ <xsl:template mode="ref" match="prod">
+ <xsl:apply-templates select="lhs" mode="ref"/>
+ <xsl:apply-templates
+ select="rhs[preceding-sibling::*[1][name()!='lhs']] |
+ com[preceding-sibling::*[1][name()!='rhs']] |
+ constraint[preceding-sibling::*[1][name()!='rhs']] |
+ vc[preceding-sibling::*[1][name()!='rhs']] |
+ wfc[preceding-sibling::*[1][name()!='rhs']]"/>
+ </xsl:template>
+
+ <!-- mode: text -->
+ <!-- most stuff processes just as text here, but some things should
+ be hidden -->
+ <xsl:template mode="text" match="ednote | footnote"/>
+
+ <!-- mode: toc -->
+ <xsl:template mode="toc" match="div1">
+ <xsl:apply-templates select="." mode="divnum"/>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:apply-templates select="head" mode="text"/>
+ </a>
+ <br/>
+ <xsl:apply-templates select="div2" mode="toc"/>
+ </xsl:template>
+
+ <xsl:template mode="toc" match="div2">
+ <xsl:text>&#xa0;&#xa0;&#xa0;&#xa0;</xsl:text>
+ <xsl:apply-templates select="." mode="divnum"/>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:apply-templates select="head" mode="text"/>
+ </a>
+ <br/>
+ <xsl:apply-templates select="div3" mode="toc"/>
+ </xsl:template>
+
+ <xsl:template mode="toc" match="div3">
+ <xsl:text>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;</xsl:text>
+ <xsl:apply-templates select="." mode="divnum"/>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:apply-templates select="head" mode="text"/>
+ </a>
+ <br/>
+ <xsl:apply-templates select="div4" mode="toc"/>
+ </xsl:template>
+
+ <xsl:template mode="toc" match="div4">
+ <xsl:text>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;</xsl:text>
+ <xsl:apply-templates select="." mode="divnum"/>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:apply-templates select="head" mode="text"/>
+ </a>
+ <br/>
+ <xsl:apply-templates select="div5" mode="toc"/>
+ </xsl:template>
+
+ <xsl:template mode="toc" match="div5">
+ <xsl:text>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;</xsl:text>
+ <xsl:apply-templates select="." mode="divnum"/>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:apply-templates select="head" mode="text"/>
+ </a>
+ <br/>
+ </xsl:template>
+
+ <xsl:template mode="toc" match="inform-div1">
+ <xsl:apply-templates select="." mode="divnum"/>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="target" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:apply-templates select="head" mode="text"/>
+ </a>
+ <xsl:text> (Non-Normative)</xsl:text>
+ <br/>
+ <xsl:apply-templates select="div2" mode="toc"/>
+ </xsl:template>
+
+ <xsl:template name="css">
+ <style type="text/css">
+ <xsl:text>
+code { font-family: monospace; }
+
+div.constraint,
+div.issue,
+div.note,
+div.notice { margin-left: 2em; }
+
+dt.label { display: run-in; }
+
+li p { margin-top: 0.3em;
+ margin-bottom: 0.3em; }
+ </xsl:text>
+ <xsl:value-of select="$additional.css"/>
+ </style>
+ <link rel="stylesheet" type="text/css">
+ <xsl:attribute name="href">
+ <xsl:text>W3C-</xsl:text>
+ <xsl:choose>
+ <xsl:when test="/spec/@w3c-doctype='wd'">WD</xsl:when>
+ <xsl:when test="/spec/@w3c-doctype='rec'">REC</xsl:when>
+ <xsl:when test="/spec/@w3c-doctype='pr'">REC</xsl:when>
+ <xsl:when test="/spec/@w3c-doctype='cr'">REC</xsl:when>
+ <xsl:otherwise>NOTE</xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>.css</xsl:text>
+ </xsl:attribute>
+ </link>
+ </xsl:template>
+
+ <xsl:template name="href.target">
+ <xsl:param name="target" select="."/>
+
+ <xsl:text>#</xsl:text>
+
+ <xsl:choose>
+ <xsl:when test="$target/@id">
+ <xsl:value-of select="$target/@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id($target)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:transform>