<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="xmlspec-extended.xsl"?>
<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification Version 2.8//EN"
                      "xmlspec.dtd" [
<!ENTITY year "2005">
<!ENTITY month "February">
<!ENTITY day "8">
<!ENTITY MM "02">
<!ENTITY DD "08">
<!ENTITY MMDD "&MM;&DD;">
<!ENTITY XMLCore-IPR "http://www.w3.org/2002/08/xmlcore-IPR-statements">
<!ENTITY internalXmlid "http://www.w3.org/XML/Group/&year;/xmlcore/xmlid/xml-id">
<!ENTITY externalXmlid "http://www.w3.org/TR/&year;/CR-xml-id-&year;&MMDD;/">
<!ENTITY xmlid "&externalXmlid;">
<!-- DTD Extensions -->
<!ENTITY % local.list.class "|options-list">
<!ELEMENT options-list (item+)>
<!ATTLIST options-list
diff (chg | add | del | off) #IMPLIED
role NMTOKEN #IMPLIED
id ID #IMPLIED
spacing (normal | compact) #IMPLIED
>
<!ATTLIST resolution
href CDATA #IMPLIED
>
]>
<spec w3c-doctype="cr">
<header>
<title>xml:id</title>
<version>Version 1.0</version>
<w3c-designation>xml-id-&year;&MMDD;</w3c-designation>
<w3c-doctype>W3C Candidate Recommendation</w3c-doctype>
<pubdate>
<day>&day;</day>
<month>&month;</month>
<year>&year;</year>
</pubdate>
<publoc>
<loc href="&xmlid;">&xmlid;</loc>
</publoc>
<altlocs>
<loc href="&xmlid;CR-xml-id-&year;&MMDD;.xml">XML</loc>
</altlocs>
<latestloc>
<loc href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</loc>
</latestloc>
<prevlocs>
<loc href="http://www.w3.org/TR/2004/WD-xml-id-20041109/">http://www.w3.org/TR/2004/WD-xml-id-20041109/</loc>
</prevlocs>
<authlist>
<author>
<name>Jonathan Marsh</name>
<affiliation>Microsoft</affiliation>
<email href="mailto:jmarsh@microsoft.com">jmarsh@microsoft.com</email>
</author>
<author>
<name>Daniel Veillard</name>
<affiliation>Invited Expert</affiliation>
<email href="mailto:daniel@veillard.com">daniel@veillard.com</email>
</author>
<author>
<name>Norman Walsh</name>
<affiliation>Sun Microsystems</affiliation>
<email href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</email>
</author>
</authlist>
<status>
<p><emph>This section describes the status of this document at the
time of its publication. Other documents may supersede this document.
A list of current W3C publications and the latest revision of this
technical report can be found in the
<loc href="http://www.w3.org/TR/">W3C technical reports index</loc> at
http://www.w3.org/TR/.</emph></p>

<p>This document has been developed by the
<loc href="http://www.w3.org/XML/Core/">W3C XML Core Working Group</loc> as
part of the <loc href="http://www.w3.org/XML/Activity">XML
Activity</loc>.
Publication as a Candidate Recommendation does not imply endorsement
by the W3C Membership. This is a draft document and may be updated,
replaced or obsoleted by other documents at any time. It is
inappropriate to cite this document as other than work in progress.
</p>

<p>This document is based upon the
<loc href="http://www.w3.org/TR/2004/WD-xml-id-20041109/">xml:id
Last Call Working Draft</loc>
published on 9 November 2004. The current draft contains
clarifications, editorial improvements, and minor bug fixes in response to
Last Call comments. The significant changes in this draft are:</p>

<ulist>
<item>
<p>Added <specref ref="extensibility"/></p>
</item>
<item>
<p>Added <specref ref="with-relax-ng-validation"/></p>
</item>
<item>
<p>Added <specref ref="id-avn"/>.
   (This appendix gives a longer and more complete discussion of a topic
    only mentioned in the Last Call draft.)
</p></item>
<item>
<p>Changed the term 'ID assignment' to 'ID type assignment'
</p></item>
<item>
<p>Made more explicit the connection between XML versions and Namespace
   versions for the purpose of identifying a valid NCName.
</p></item>
<item>
<p>Clarified the scope of <att>xml:id</att> with respect to application processing
   and when application processing occurs.
</p></item>
<item>
<p>Clarified <specref ref="conformance"/>
to be consistent with QA guidelines.
</p></item>
<item>
<p>Informed readers that <specref ref="impact"/>
   will be removed before <att>xml:id</att>
   becomes a recommendation (in order to avoid issues of independent
   evolution of other specifications).
</p></item>
<item>
<p>Added a note about the impact of <att>xml:id</att> on C14N processing.
</p></item>
</ulist>

<p>Please send review comments about this Candidate Recommendation to
<loc href="mailto:public-xml-id@w3.org">public-xml-id@w3.org</loc>
(<loc href="http://lists.w3.org/Archives/Public/public-xml-id/">archive</loc>).
We expect that sufficient feedback
to determine its future will have been received by 10 March 2005.</p>

<p>The XML Core Working Group will advance the specification to
Proposed Recommendation when the following exit criteria have been
met:</p>

<ulist>
<item>
<p>There are at least two interoperable implementations of the
specification. For the purpose of this CR, two implementations will be
considered interoperable if they report the same xml:id attributes
with the same types for all tests in the test suite.</p>
<p>It is possible that some implementations will not be able to detect
some errors (for example, if they have no access to declarations).
For tests of error conditions, either both
implementations will report the same error, or at least one will fail
to report the error. </p>
</item>
<item>
<p>A minimum of one month of the CR period must have elapsed. This
is to ensure that enough time is given for any major errors to
be caught.</p>
</item>
</ulist>

<p>Any feedback on implementation and use of this specification would
be very welcome. To the extent possible, please provide a separate
email message for each distinct comment.</p>

<p>The XML Core Working Group has released a public
<loc href="http://www.w3.org/XML/Test/xml-id/Overview.html">test
suite</loc> for xml:id along with an
<loc href="http://www.w3.org/XML/2005/01/xml-id-implementation.html">implementation report</loc>.</p>

<p>The patent policy for this document is the <loc
href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
2004 W3C Patent Policy</loc>. 
Patent disclosures relevant
to this specification may be found on the 
<loc href="http://www.w3.org/2004/01/pp-impl/18796/status">XML Core
Working Group's public IPR disclosure page</loc>.
An individual who has actual knowledge of
a patent which the individual believes contains Essential Claim(s) with
respect to this specification should disclose the information in
accordance with <loc
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
6 of the W3C Patent Policy</loc>.
</p>
</status>
<abstract>
<p>This document defines the meaning of the attribute
<att>xml:id</att> as an ID attribute in XML documents and defines
processing of this attribute to identify IDs in the absence of
validation, without fetching external resources, and without relying
on an internal subset.
</p>
</abstract>
<langusage>
<language id="EN">English</language>
</langusage>
<revisiondesc>
<slist>
<sitem>July 17, 2003: First Working Draft.</sitem>
<sitem>March 17, 2004: Second internal Working Draft.</sitem>
</slist>
</revisiondesc>
</header>
<body>
<div1 id="intro">
<head>Introduction</head>

<p><bibref ref="XML"/> and <bibref ref="XML11"/> provide a mechanism
for annotating elements with unique identifiers. This mechanism
consists of declaring the type of an attribute as "ID", after which
the parser will validate that</p>

<ulist>
<item><p>the ID value matches the allowed lexical
form,</p></item>
<item><p>the value is unique within the XML document, and that</p></item>
<item><p>each element has at most a single unique identifier</p>
</item>
</ulist>

<p>Declarations in either the
internal or external subset of an XML document can declare attributes
to be of type ID.
However, some specifications, notably
<bibref ref="SOAP"/>, forbid an internal subset, and processing 
the external subset is optional for conformant XML
processors, leaving no guarantee that all consumers of the XML
document will be able to successfully recognize the identifiers.</p>

<p>Identifiers can be declared through external mechanisms as well. Of
particular interest is <bibref ref="XMLSchemas"/> which provides a
type "xs:ID" with the same uniqueness and validity constraints as XML.
However, there are no guarantees that consumers will have the
"correct" schema available, nor that they will process it if they
do.</p>

<p>A mechanism allowing unique element identifiers to be recognized by
all conformant <loc href="http://www.w3.org/TR/REC-xml/#dt-xml-proc">XML
processors</loc>, whether they validate or not, is
desirable in making XML sub-resource linking robust.
This specification allows authors to identify elements with IDs
that can be recognized by any processor without regard to how, or if,
any internal or external declarations are available.
</p>

<p>An additional problem is that DTD-based and XML Schema-based
identifiers are exposed through different conceptual mechanisms - the
<emph role="infoset-property">attribute type</emph> infoset property,
and the <emph role="infoset-property">type definition</emph> family of
properties respectively. A uniform mechanism for recognizing
identifiers is desirable.</p>

<p>This specification provides such a mechanism: it describes the
semantics of <att>xml:id</att> attributes. This specification has been
designed to be a separate layer in processing and to be compatible
with existing validation technologies. Implementors are encouraged to
support <att>xml:id</att> processing and to make
<termref def="dt-id-assignment">ID type assignment</termref> the default
behavior of their processors.
</p>

<p>It has been a guiding principle in the design of this specification
that the result of <att>xml:id</att> processing should be the same
as if an appropriate declaration has been seen and used by the processor.</p>

</div1>
<div1 id="terminology">
<head>Terminology</head>
<p>
<termdef id="dt-must" term="Must, May, etc.">The key words 
<term>must</term>, <term>must not</term>, <term>required</term>,
<term>shall</term>, <term>shall not</term>, <term>should</term>, 
<term>should not</term>, <term>recommended</term>, <term>may</term>, 
and <term>optional</term> in this specification are to be interpreted 
as described in <bibref ref="RFC2119"/>.</termdef>
</p>

<p><termdef id="dt-xml-id-proc" term="xml:id processor">An
<term>xml:id processor</term> is a software module that works in
conjunction with an <loc href="http://www.w3.org/TR/REC-xml/#dt-xml-proc">XML
processor</loc> to provide access to the IDs in an XML document.</termdef>
</p>

<p><termdef id="dt-xml-id-error" term="xml:id error">An
<term>xml:id error</term> is a non-fatal error that occurs when an
<termref def="dt-xml-id-proc">xml:id processor</termref> finds that
a document has violated the constraints of this specification.</termdef>
</p>

<p>Validation is the process of comparing an XML document (or part of
an XML document) against a grammar or set of rules to determine if the
actual structure of the document satisfies the constraints of the
grammar or the rules. Some validation technologies also perform type
assignment, determining not only if the document satisfies the
specified constraints but also determining, for example, which
(elements and/or) attributes are of type “ID”.</p>

<p>Although often performed together, validation and type assignment
are not the same process. A non-validating XML 1.0 processor, for
example, can perform type assignment using only declarations from the
internal subset, without ever having any information about the
structural validity of the document.</p>

<p><termdef id="dt-id-assignment" term="ID type assignment">The
process of <term>ID type assignment</term> causes an <att>xml:id</att>
attribute value to be an ID.</termdef> This is often achieved by changing the
type of the attribute to be "ID" in the infoset or PSVI, but that is
not the only possible mechanism.</p>

<note>
<p>Application-level processing of IDs, including which elements can
actually be addressed by which ID values, is beyond the scope of this
specification.</p>
</note>

</div1>

<div1 id="syntax">
<head>Syntax</head>
<p>Per <bibref ref="XMLNS"/> (and <bibref ref="XMLNS11"/>), prefixes
beginning “xml” are reserved for use by XML and XML-related
specifications. This specification licenses the use of the attribute
“xml:id” for use as a common syntax for identifiers in XML with the
semantics specified herein.</p>

<p>Authors of XML documents are encouraged to name their ID attributes
"xml:id" to increase the interoperability of these identifiers on the
Web.</p>

<p>In namespace-aware XML processors, the "xml" prefix is bound to the
namespace name <code>http://www.w3.org/XML/1998/namespace</code> as
described in Namespaces in XML <bibref ref="XMLNS"/> (and <bibref
ref="XMLNS11"/>). Note that <att>xml:id</att> can be still used by
non-namespace-aware XML processors.</p>
</div1>

<div1 id="processing">
<head>Processing <att>xml:id</att> Attributes</head>

<p>Each <att>xml:id</att> attribute is processed in the following
way:</p>

<olist>
<item>
<p>The attribute's value is normalized according to the rules for
<loc href="http://www.w3.org/TR/REC-xml/#AVNormalize">attribute-value
normalization</loc> on attributes of type ID. For more details, see
<specref ref="id-avn"/>.</p>
<p>The infoset
<emph role="infoset-property">normalized value</emph> property is updated
with the normalized value.</p>
</item>
<item>
<p><termref def="dt-id-assignment">ID type assignment</termref> is
performed with the normalized value.</p>
</item>
</olist>

<p>An <att>xml:id</att> processor
<termref def="dt-must">must</termref> assure that the following
constraints hold for all <att>xml:id</att> attributes:</p>

<ulist>
<item>
<p>The normalized value of the attribute is an
<code>NCName</code> according to the
<titleref>Namespaces in XML</titleref>
Recommendation which has the same version as
the document in which this attribute occurs
(<loc href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</loc>
for XML 1.0, or
<loc href="http://www.w3.org/TR/xml-names11/#NT-NCName">NCName</loc>
for XML 1.1).</p>
</item>
<item>
<p>The declared type of the attribute, if it has one, is “ID”.
All declarations for <att>xml:id</att> attributes
<termref def="dt-must">must</termref>
specify “ID” as the type of the attribute.</p>
</item>
</ulist>

<p>An <att>xml:id</att> processor
<termref def="dt-must">should</termref> assure that the following
constraints hold:</p>

<ulist>
<item>
<p>The values of all <att>xml:id</att> attributes and all attributes
of type “ID” within a document are unique.</p>
</item>
</ulist>

<p>An <termref def="dt-xml-id-error">xml:id error</termref> occurs
for any <att>xml:id</att> attribute that does not satisfy the
constraints.</p>

<p>The <att>xml:id</att> processor performs 
<termref def="dt-id-assignment">ID type assignment</termref> on all
<att>xml:id</att> attributes, even those that do not satisfy
the enumerated constraints.</p>

<p>An <att>xml:id</att> processor
<termref def="dt-must">should</termref> update the
<emph role="infoset-property">references</emph> infoset property, and/or
other appropriate referential properties to reflect the results of ID
assignment.
</p>

<p>Many validation technologies impose the constraint that an XML
element can have at most one attribute of type ID. That constraint is
<emph>not</emph> imposed by <att>xml:id</att> processing.</p>

<p>This specification defines xml:id processing, but it is up to the
application to determine when such processing occurs. Users of
applications that provide facilities for modifying XML documents may
reasonably expect xml:id processing to occur whenever a change is
made to an ID value.</p>

</div1>

<div1 id="inform">
<head>Informing the Application</head>

<p><termref def="dt-id-assignment">ID type assignment</termref> may be
performed when <att>xml:id</att> attributes are processed.
If ID type assignment
occurs, then the <termref def="dt-xml-id-proc">xml:id processor</termref>
<termref def="dt-must">must</termref> report the assigned
<att>xml:id</att> attributes
to the application. How this is reported is implementation
dependent.</p>

<ulist>
<item id="Attribute_type">
<p>For applications that operate conceptually on the Infoset, an
<att>xml:id</att> processor can use the
<emph role="infoset-property">attribute type</emph> Infoset
property:</p>

<p>The <att>xml:id</att> processor <termref
def="dt-must">may</termref> report the results of ID type assignment in a
DTD compatible manner by setting the <emph
role="infoset-property">attribute type</emph> infoset property of the
attribute to ID.</p>
</item>

<item id="type_definition">
<p>For applications that operate conceptually on the PSVI, an
<att>xml:id</att> processor can use the
<emph role="infoset-property">type definition</emph> family
of PSVI properties:</p>

<p>The <att>xml:id</att> processor <termref def="dt-must">may</termref>
report the results of ID type assignment
in an XML Schema compatible manner by setting the PSVI
<emph role="infoset-property">type definition</emph> property of the
attribute to <code>xs:ID</code>.</p>
</item>

<item id="other_mechanisms">
<p>For applications that operate on data models defined in other ways,
the mechanisms are implementation dependent:</p>

<p>The <att>xml:id</att> processor <termref def="dt-must">may</termref>
report the results of ID type assignment in some other way.</p>
</item>
</ulist>

<p>The key requirement is that the application be made aware of the results
of ID type assignment.</p>

</div1>

<div1 id="errors">
<head>Errors</head>

<p>A violation of the constraints in this specification results in an
<termref def="dt-xml-id-error">xml:id error</termref>.
Such errors are not fatal, but <termref def="dt-must">must</termref>
be reported by the
<termref def="dt-xml-id-proc">xml:id processor</termref>
to the application invoking it.</p>

</div1>

<div1 id="conformance">
<head>Conformance</head>

<div2 id="xmlid-conformance">
<head>Conformance to xml:id</head>

<p>Conformance to <att>xml:id</att> for applications that rely on
<loc href="http://www.w3.org/TR/2004/REC-xml-20040204/#dt-xml-proc">XML
processors</loc> using validation technologies consists in the
use of the <att>xml:id</att> construct as explained in
<specref ref="processing"/> and by conformance to both the constraints
of this specification and the rules of the validation technology.</p>

<p>Conformance to <att>xml:id</att> for applications that rely on
non-validating
<loc href="http://www.w3.org/TR/2004/REC-xml-20040204/#dt-xml-proc">XML
processors</loc> is defined by the recognition of <att>xml:id</att>
attributes as explained in 
<specref ref="processing"/> and by conformance to the constraints
of this specification.</p>

<p>Conformance to constraints that
“<termref def="dt-must">must</termref>” be assured is mandatory.
It is recommended that applications assure the other constraints as well.
This specification defines no simply optional constraints.</p>

<p>A document is conformant to this specification if it generates no
<termref def="dt-xml-id-error">xml:id errors</termref>.
</p>

</div2>

<div2 id="infoset">
<head>XML Information Set Conformance</head>
<p>This specification conforms to the <bibref ref="XMLIS"/>.
The following information items <termref def="dt-must">must</termref> 
be present in the input infosets to enable correct processing:</p>
<ulist>
<item>
<p>
<emph role="info-item">Element Information Items</emph> with
<emph role="infoset-property">attributes</emph> property.</p>
</item>
<item>
<p>
<emph role="info-item">Attribute Information Items</emph> with
<emph role="infoset-property">namespace name</emph>,
<emph role="infoset-property">local name</emph> and
<emph role="infoset-property">normalized value</emph> properties.</p>
</item>
</ulist>
<p>In addition, the following properties might be present in the output infoset:</p>
<ulist>
<item>
<p>
<emph role="infoset-property">attribute type</emph> properties on <emph role="info-item">Attribute Information Items</emph>.</p>
</item>
</ulist>
</div2>
</div1>

<div1 id="extensibility">
<head>Extensibility</head>

<p>This specification is not extensible. There are no provisions for application
designers to alter the name of the <att>xml:id</att> attribute, the set of
attribute values that are considered IDs, the location(s) where they can
occur, or make any other extensions.</p>
</div1>

</body>
<back>
<div1 id="references">
<head>References</head>
<blist>
<bibl id="RFC2119" key="IETF RFC 2119" href="http://www.ietf.org/rfc/rfc2119.txt">
<titleref href="http://www.ietf.org/rfc/rfc2119.txt">RFC 2119: Key 
words for use in RFCs to Indicate Requirement Levels</titleref>.
Internet Engineering Task Force, 1997.
</bibl>
<bibl id="XML" key="XML 1.0" href="http://www.w3.org/TR/REC-xml/">
Tim Bray, Jean Paoli, C.M. Sperberg-McQueen, et. al., editors.
<titleref href="http://www.w3.org/TR/REC-xml/">Extensible Markup 
Language (XML) 1.0 (Third Edition).</titleref>
World Wide Web Consortium, 2004.
</bibl>
<bibl id="XML11" key="XML 1.1" href="http://www.w3.org/TR/xml11/">
Tim Bray, Jean Paoli, C.M. Sperberg-McQueen, et. al., editors.
<titleref href="http://www.w3.org/TR/xml11/">Extensible Markup 
Language (XML) 1.1.</titleref>
World Wide Web Consortium, 2004.
</bibl>
<bibl id="XMLIS" key="XML Information Set" href="http://www.w3.org/TR/xml-infoset/">
John Cowan and Richard Tobin, editors.
<titleref href="http://www.w3.org/TR/xml-infoset/">XML Information Set (Second Edition).</titleref>
World Wide Web Consortium, 2004.
</bibl>
<bibl id="XMLNS" key="Namespaces in XML" href="http://www.w3.org/TR/REC-xml-names/">
Tim Bray, Dave Hollander, and Andrew Layman, editors.
<titleref href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</titleref>.
World Wide Web Consortium, 1999.
</bibl>
<bibl id="XMLNS11" key="Namespaces in XML 1.1" href="http://www.w3.org/TR/xml-names11/">
Tim Bray, Dave Hollander, Andrew Layman, and Richard Tobin, editors.
<titleref href="http://www.w3.org/TR/xml-names11/">Namespaces in XML 1.1</titleref>.
World Wide Web Consortium, 2004.
</bibl>
</blist>
</div1>
<inform-div1>
<head>References</head>
<blist>
<bibl id="XMLSchemas" key="XML Schemas" href="http://www.w3.org/TR/xmlschema-1/">
Henry S. Thompson, David Beech, Murray Maloney, Noah Mendelsohn, editors.
<titleref href="http://www.w3.org/TR/xmlschema-1/">XML Schema Part 1: 
Structures.</titleref>
World Wide Web Consortium, 2001.
</bibl>
<bibl id="SOAP" key="SOAP" href="http://www.w3.org/TR/soap12-part1/">Martin
Gudgin, Marc Hadley, Noah Mendelsohn, et. al., editors.
<titleref href="http://www.w3.org/TR/soap12-part1/">SOAP Version 1.2 Part 1:
Messaging Framework</titleref>. World Wide Web Consortium, 2003.
</bibl>
</blist>
</inform-div1>

<inform-div1 id="impact">
<head>Impacts on Other Standards</head>

<p>This appendix is informative for use during development of xml:id.
It will be removed before xml:id becomes a Recommendation.</p>

<ulist>
<item>
<p><emph>XPath 1.0:</emph> The id() function only recognizes IDs
declared in the DTD. If <att>xml:id</att> processing is performed before
the document is provided to the XPath 1.0 processor, and if ID type assignment is
performed by setting the
<emph role="infoset-property">attribute type</emph> infoset property,
XPath 1.0 will recognize <att>xml:id</att> attributes as IDs.
An erratum to XPath 1.0 would be required to allow
Schema-declared IDs to be included in the results of this function.</p>
</item>
<item>
<p><emph>XPath 2.0:</emph> No change required. The id() function
recognizes both DTD- and Schema-declared identifiers, and as such
would also recognize <att>xml:id</att> attributes identified with a
minimally conforming schema processor.</p>
</item>
<item>
<p><emph>Fragment Identifiers</emph> and the <emph>XPointer Framework:</emph>
No change required. Barename
fragment identifiers and the element() scheme recognize both DTD- and
Schema-declared identifiers, and as such would also recognize
<att>xml:id</att> attributes identified with a minimally conforming
schema processor.</p>
</item>
<item>
<p><emph>DOM:</emph> To the extent that a DOM instance is constructed from
an Infoset or PSVI, no change is required. The <att>xml:id</att> processorʼs
ID type assignment of <att>xml:id</att> attributes will be visible to the
DOM construction process.</p>
</item>
<item>
<p><emph>CSS:</emph> To the extent that a CSS operates on a tree constructed from
an Infoset or PSVI, no change is required. The <att>xml:id</att> processorʼs
ID type assignment of <att>xml:id</att> attributes will be visible to the
construction process.</p>
</item>
<item>
<p><emph>Canonicalization:</emph> The
<loc href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">Canonical XML
Version 1.0</loc> specification
<loc href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#DocSubsets">describes
a process</loc> whereby attributes in
the <att>xml:</att> namespace are inherited in a canonicalized document.
While this produces a reasonable result with <att>xml:lang</att> or
<att>xml:space</att> attributes, processing <att>xml:id</att> attributes
in this way is likely to produce documents that contain
<termref def="dt-xml-id-error">xml:id errors</termref>, specifically
<att>xml:id</att> attribute values that are not unique.</p>
<p>This is an apparent flaw in the design of Canonical XML. The
<loc href="http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/">Exclusive
XML Canonicalization Version 1.0</loc> specification does not have this
feature and may be more appropriate for documents containing IDs.</p>
</item>
</ulist>
</inform-div1>
<inform-div1 id="validation-technologies">
<head>Validation Technologies</head>

<p>This appendix describes how <att>xml:id</att> processing interacts with
selected validation technologies.</p>

<div2 id="with-dtd-validation">
<head>With DTD Validation</head>

<p>DTD authors are encouraged to use <att>xml:id</att> attributes
exclusively in their DTDs to indicate element identifiers.</p>

<p>The following DTD fragment illustrates a sample
declaration for the <att>xml:id</att> attribute:</p>

<eg>&lt;!ATTLIST someElement
    xml:id     ID          #IMPLIED
&gt;</eg>

<p>DTD authors are encouraged to declare attributes named
<att>xml:id</att> with the type <code>ID</code>.
A document that uses <att>xml:id</att> attributes that have a declared
type other than <code>ID</code> will always generate xml:id errors.</p>

<p>Consumers of documents validated using properly declared
<att>xml:id</att> attributes can recognize IDs through the <emph
role="infoset-property">attribute type</emph> property.</p>
</div2>

<div2 id="with-schema-validation">
<head>With XML Schema Validation</head>

<p>XML Schema authors are encouraged to use <att>xml:id</att>
attributes exclusively in to indicate element identifiers.</p>

<p>The following XML Schema fragment for the XML namespace illustrates a
sample declaration for the <att>xml:id</att> attribute:</p>

<eg><![CDATA[<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.w3.org/XML/1998/namespace">

    <xs:attribute name="id" type="xs:ID"/>

</xs:schema>]]></eg>

<p>XML Schema authors are encouraged to declare attributes named
<att>xml:id</att> with the type <code>xs:ID</code>.
A document that uses <att>xml:id</att> attributes that have a declared
type other than <code>xs:ID</code> will always generate xml:id errors.</p>

<p>Consumers of documents validating the <att>xml:id</att> attributes
against an appropriate schema for the XML namespace can recognize IDs
through the <emph role="infoset-property">type definition</emph>
family of PSVI properties.</p>

<p>Applications can recognize <att>xml:id</att> attributes as IDs by
conceptually using a <loc
href="http://www.w3.org/TR/xmlschema-1/#key-minimallyConforming">Minimally
Conforming Schema Processor</loc> and the schema above.</p>

<p>Note that the effects of a Minimally Conforming Schema Processor,
processing the above schema, are approximated by simply looking for
attributes named <att>xml:id</att>, ensuring the value of such
attributes has the correct lexical form (<loc
href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</loc>),
and the value is unique within the document.</p>

</div2>

<div2 id="with-relax-ng-validation">
<head>With RELAX NG Validation</head>

<p>RELAX NG Grammar authors are encouraged to use <att>xml:id</att>
attributes exclusively in their schemas to indicate element
identifiers.</p>

<p>The following RELAX NG fragment illustrates a
sample declaration for the <att>xml:id</att> attribute:</p>

<eg><![CDATA[<optional xmlns="http://relaxng.org/ns/structure/1.0"
              datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <attribute name="xml:id">
    <data type="ID"/>
  </attribute>
</optional>]]></eg>

<p>RELAX NG Grammar authors are encouraged to declare attributes named
<att>xml:id</att> with the type <code>xs:ID</code>.
A document that uses <att>xml:id</att> attributes that have a declared
type other than <code>xs:ID</code> will always generate xml:id errors.</p>

</div2>
</inform-div1>

<inform-div1 id="id-avn">
<head>Attribute Value Normalization on IDs</head>

<p>Parsers are required to
<loc href="http://www.w3.org/TR/REC-xml/#AVNormalize">normalize</loc>
all attribute values. Normalization expands character references, expands
entity references, and cleans up line end characters. Attributes of
type ID are subject to additional normalization rules: removing leading
and trailing whitespace and replacing sequences of spaces with a single
space.</p>

<p>The xml:id processor has to assure that both kinds of normalization
are performed all attributes named <att>xml:id</att>. In particular,
the parser may not have performed the additional normalization
required for attributes of type ID because the attribute may not be
declared or may be declared as an ID.</p>

<p>Consider the following document:</p>

<eg><![CDATA[<!DOCTYPE doc [
<!ATTLIST doc xml:id ID #IMPLIED>
]>
<doc xml:id="  one
">
<para xml:id="  two
"></para>
</doc>]]></eg>

<p>The initial value of <att>xml:id</att> on <el>doc</el> will be
“one” because the parser knew that it was an ID. The initial value
on <el>para</el> will be “  two ”. Because the parser didn't know it
was an ID, it will not have performed the additional normalizations
required.</p>

<p>After xml:id processing, the value of the <att>xml:id</att> attributes
on <el>doc</el> and <el>para</el> will be “one” and “two”, respectively.
These properly normalized values will be stored in the
<emph role="infoset-property">normalized value</emph> property in the
infoset. Performing xml:id processing changes the infoset if there
are incompletely normalized <att>xml:id</att> attributes.</p>

<note>
<p>For interoperability, document producers <termref
def="dt-must">should</termref> use fully normalized values that are
legal <code>NCNames</code> in
<att>xml:id</att> attributes.</p>
</note>

</inform-div1>

</back>
</spec>
