<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="xmlspec-ie.xsl"?>
<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification Version 2.0//EN"
                      "xmlspec.dtd" [
	<!ENTITY year "2003">
	<!ENTITY month "November">
	<!ENTITY MM "11">
	<!ENTITY day "10">
	<!ENTITY DD "10">
	<!ENTITY MMDD "&MM;&DD;">
	<!ENTITY includensuri "http://www.w3.org/2003/XInclude">
	<!ENTITY XMLCore-IPR "http://www.w3.org/2002/08/xmlcore-IPR-statements">
	<!ENTITY internalXInclude "http://www.w3.org/XML/Group/&year;/&MM;/WD-xinclude-&year;&MMDD;">
	<!ENTITY externalXInclude "http://www.w3.org/TR/&year;/WD-xinclude-&year;&MMDD;">
	<!--ENTITY XInclude "&externalXInclude;"-->
	<!ENTITY XInclude "&externalXInclude;">
	<!-- DTD Extensions -->
	<!ENTITY copy "&#169;">
	<!-- copyright sign, U+00A9 ISOnum -->
	<!ENTITY reg "&#174;">
	<!-- registered sign = registered trade mark sign,
                                  U+00AE ISOnum -->
]>
<spec w3c-doctype="wd">
<header>
	<title>XML Inclusions (XInclude)</title>
	<version>Version 1.0</version>
	<w3c-designation>xinclude-&year;&MMDD;</w3c-designation>
	<w3c-doctype>W3C Working Draft</w3c-doctype>
	<pubdate>
		<day>&day;</day>
		<month>&month;</month>
		<year>&year;</year>
	</pubdate>
	<publoc>
		<loc href="&XInclude;">&XInclude;</loc>
	</publoc>
	<altlocs>
		<loc href="&XInclude;/WD-xinclude-&year;&MMDD;.xml">XML</loc>
	</altlocs>
	<latestloc>
		<loc href="http://www.w3.org/TR/xinclude/">http://www.w3.org/TR/xinclude/</loc>
	</latestloc>
	<prevlocs>
		<loc href="http://www.w3.org/TR/2002/CR-xinclude-20020917/">http://www.w3.org/TR/2002/CR-xinclude-20020917/</loc>
	</prevlocs>
	<authlist>
		<author>
			<name>Jonathan Marsh</name>
			<affiliation>Microsoft</affiliation>
			<email href="mailto:jmarsh@microsoft.com">jmarsh@microsoft.com</email>
		</author>
		<author>
			<name>David Orchard</name>
			<affiliation>BEA Systems</affiliation>
			<email href="mailto:dorchard@bea.com">dorchard@bea.com</email>
		</author>
	</authlist>
	<abstract>
		<p>This document specifies a processing model and syntax for general 
		purpose inclusion.  Inclusion is accomplished by merging a 
		number of XML information sets into a single composite infoset.  
		Specification of the XML documents (infosets) to be merged and 
		control over the merging process is expressed in XML-friendly 
		syntax (elements, attributes, URI references).</p>
	</abstract>
	<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 is a <loc href="http://www.w3.org/Consortium/Process-20010208/tr.html#last-call">Last Call Working Draft (WD)</loc> of the W3C. This document has been produced 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>, which invites comment on this specification.  
                The Last Call period begins &day;&#32;&month;&#32;2003 and ends 31 December 2003.</p>
		<p>The W3C members and the public are invited to send comments to the public mailing list <loc href="mailto:www-xml-xinclude-comments@w3.org">www-xml-xinclude-comments@w3.org</loc> (<loc href="http://lists.w3.org/Archives/Public/www-xml-xinclude-comments/">archive</loc>).</p>
		<p>This document is based upon the <loc href="http://www.w3.org/TR/2002/CR-xinclude-20020917/">XInclude Candidate Recommendation</loc> published on 17 September 2002.  Feedback received during that review resulted in substantive changes in the support for XPointer and fragment identifiers and in additional support for content negotiation.  
                Known implementations are documented in the <loc href="http://www.w3.org/XML/2002/09/xinclude-implementation">XInclude Implementation Report</loc>.  
                A <loc href="http://www.w3.org/XML/Test/XInclude/">test suite</loc> is also available. Depending on the results of this Last Call and associated implementation
                experience, the XML Core WG may consider bypassing a second Candidate Recommendation period and request transition to Proposed Recommendation.</p>
		<p>Documentation of intellectual property possibly relevant to this specification  may be found at the <loc href="http://www.w3.org/2002/08/xmlcore-IPR-statements">Working Group's public IPR disclosure page</loc>.</p>

<p>Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p>

	</status>
	<langusage>
		<language id="EN">English</language>
	</langusage>
	<revisiondesc>
		<slist>
			<sitem>February 28, 2000: First Working Draft.</sitem>
		</slist>
	</revisiondesc>
</header>

<body>

<div1 id="intro">

	<head>Introduction</head>
	
	<p>Many programming languages provide an inclusion mechanism to 
	facilitate modularity.  Markup languages also often have need of 
	such a mechanism.  This specification introduces a generic mechanism
	for merging XML documents (as represented by their information sets)
	for use by applications that need such a facility.  The syntax 
	leverages existing XML constructs - elements, attributes, and URI 
	references.</p>

	<div2 id="rel-xlink">

		<head>Relationship to XLink</head>
		
		<p>XInclude differs from the linking features described in the 
		<bibref ref="XLink"/>, specifically links with the 
		attribute value <code>show="embed"</code>.  Such links provide
		a media-type independent syntax for indicating that a resource
		is to be embedded graphically within the display of the document.
		XLink does not specify a specific processing model, but simply
		facilitates the detection of links and recognition of associated 
		metadata by a higher level application.</p>

		<p>XInclude, on the other hand, specifies a media-type specific
		(XML into XML) transformation.  It defines a specific processing
		model for merging information sets.  XInclude processing occurs
		at a low level, often by a generic XInclude processor which makes 
		the resulting information set available to higher level 
		applications.</p>

		<p>Simple information item inclusion as described in this specification 
		differs from transclusion, which preserves contextual 
		information such as style.</p>
	</div2>
	

	<div2 id="rel-extent">

		<head>Relationship to XML External Entities</head>
	
		<p>There are a number of differences between XInclude and
		<bibref ref="XML"/> external entities which make them 
		complementary technologies.</p>
	
		<p>Processing of external entities (as with the rest of DTDs)
		occurs at parse time.  XInclude operates on information sets 
		and thus is orthogonal to parsing.</p>
	
		<p>Declaration of external entities requires a DTD or internal subset.
		This places a set of dependencies on inclusion, for instance, the syntax
		for the DOCTYPE declaration requires that the document element be named - 
		orthogonal to inclusion in many cases.  Validating parsers
		must have a complete content model defined.  XInclude is orthogonal 
		to validation and the name of the document element.</p>

		<p>External entities provide a level of indirection - the external
		entity must be declared and named, and separately invoked.
		XInclude uses direct references.  Applications which generate 
		XML output incrementally can benefit from not having to pre-declare 
		inclusions.</p>

		<p>Failure to load an external entity is normally a fatal error. 
		XInclude allows the author to provide default content that will be 
		used if the remote resource cannot be loaded.</p>

		<p>The syntax for an internal subset is cumbersome to many authors
		of simple well-formed XML documents.  XInclude syntax is based on
		familiar XML constructs.</p>
	</div2>

	<div2 id="rel-dtd">
		
		<head>Relationship to DTDs</head>

		<p>XInclude defines no relationship to DTD validation.  XInclude
		describes an infoset-to-infoset transformation and not a change
		in XML 1.0 parsing behavior.  XInclude does not define a
		mechanism for DTD validation of the resulting infoset.</p>
	</div2>

	<div2 id="rel-xsd">

		<head>Relationship to XML Schemas</head>

		<p>XInclude defines no relationship to the augmented infosets
		produced by applying an XML schema.  Such an augmented infoset
		can be supplied as the input infoset, or such augmentation might
		be applied to the infoset resulting from the inclusion.</p>
	</div2>
	
	<div2 id="rel-inc">

		<head>Relationship to Grammar-Specific Inclusions</head>

		<p>Special-purpose inclusion mechanisms have been introduced
		into specific XML grammars.  XInclude provides a generic mechanism 
		for recognizing and processing inclusions, and as such can offer
		a simpler overall authoring experience, greater performance, and 
		less code redundancy.</p>
	</div2>
</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-infoset" term="infoset">The term <term>information 
	set</term> refers to the output of an XML processor, expressed as a 
	collection of information items and properties as defined by the 
	<bibref ref="XMLIS"/>	specification.</termdef>  In this document 
	the term <emph>infoset</emph> is used as a synonym for 
	<emph>information set</emph>.</p>

	<p><termdef id="dt-error" term="fatal error">The term <term>fatal 
	error</term> refers to the presence of factors that prevent normal 
	processing from continuing.</termdef>&#32;
	<termdef id="dt-resource-error" term="resource error">The term 
	<term>resource error</term> refers to a failure of an attempt to
	fetch a resource from a URL.</termdef>  XInclude 
	processors <termref def="dt-must">must</termref> stop processing 
	when encountering errors other than 
	<termref def="dt-resource-error">resource errors</termref>, which
	<termref def="dt-must">must</termref> be handled as described in 
	<specref ref="fallback"/>.</p>
</div1>

<div1 id="syntax">

	<head>Syntax</head>
	
	<p>XInclude defines a namespace associated with the URI 
	<code>&includensuri;</code>. The XInclude namespace contains two 
	elements with the local names <code>include</code> and 
	<code>fallback</code>.  For convenience, within this specification 
	these elements are referred to as <code>xi:include</code> and 
	<code>xi:fallback</code> respectively.</p>
	
	<p>The namespace has changed during the development of XInclude. 
	Implementations <termref def="dt-must">should</termref> recognize 
	and provide a diagnostic for <code>include</code> elements in the 
	old namespace <code>http:www.w3.org/2001/XInclude</code>.</p>
	
	<p>The following (non-normative) XML schema <bibref ref="XMLSchemas"/>
	illustrates the content model of the <code>xi</code> namespace:</p>
	
	<eg><![CDATA[
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xi="http://www.w3.org/2003/XInclude"
           targetNamespace="http://www.w3.org/2003/XInclude"
           finalDefault="extension">

  <xs:element name="include" type="xi:includeType" />

  <xs:complexType name="includeType" mixed="true">
    <xs:choice minOccurs='0' maxOccurs='unbounded' >
      <xs:element ref='xi:fallback' />
      <xs:any namespace='##other' processContents='lax' />
      <xs:any namespace='##local' processContents='lax' />
    </xs:choice>
    <xs:attribute name="href" use="optional" type="xs:anyURI"/>
    <xs:attribute name="parse" use="optional" default="xml"
                  type="xi:parseType" />
    <xs:attribute name="xpointer" use="optional" ype="xs:string"/>
    <xs:attribute name="encoding" use="optional" type="xs:string"/>
    <xs:attribute name="accept" use="optional" type="xs:string"/>
    <xs:attribute name="accept-language" use="optional" type="xs:string"/>
    <xs:attribute name="accept-charset" use="optional" type="xs:string"/>
    <xs:anyAttribute namespace="##other" processContents="lax"/>
  </xs:complexType>

  <xs:simpleType name="parseType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="xml"/>
      <xs:enumeration value="text"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:element name="fallback" type="xi:fallbackType" />

  <xs:complexType name="fallbackType" mixed="true">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="xi:include"/>
      <xs:any namespace="##other" processContents="lax"/>
      <xs:any namespace="##local" processContents="lax"/>
    </xs:choice>
    <xs:anyAttribute namespace="##other" processContents="lax" />
  </xs:complexType>

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

	<div2 id="include_element">
	
		<head>xi:include Element</head>
	
		<p>The <code>xi:include</code> element has the following 
		attributes:</p>
		
		<glist>
			<gitem>
				<label>href</label>
				<def>
					<p>A URI reference indicating the location of the resource 
	          to include.  The <att>href</att> attribute 
	          is optional; the absence of this attribute is the same as
	          specifying <att>href=""</att>, that is, the reference is to the
	          same document.  If the <att>href</att> attribute is absent, the
	          <att>xpointer</att> attribute <termref def="dt-must">must</termref>
	          be present.</p>
			     <note>
			     	<p>For interoperability, fragment identifiers <termref def="dt-must">should
			     	not</termref> be used; the interpretation and application of media-specific
		          fragment identifiers in creating info-items is not guaranteed to
		          be supported across implementations.</p>
		       </note>
				</def>
			</gitem>
			<gitem>
				<label>parse</label>
				<def>
					<p>An enumeration specifying whether to include the 
					resource as parsed XML or as text.  The parse attribute allows 
					XInclude to give the author of the including document priority 
					over the server of the included document in terms of how to 
					process the included content.  A value of "xml" indicates 
					that the resource <termref def="dt-must">must</termref> be 
					parsed as XML and the infosets merged.  A value of "text" 
					indicates that the resource <termref def="dt-must">must</termref> 
					be included as the character information items.  This attribute
					is optional.  When omitted, the value of "xml" is implied (even 
					in the absence of a default value declaration).  Values other 
					than "xml" and "text" are a <termref def="dt-error">fatal 
					error</termref>.</p>
					<note>
						<p>For interoperability between validating and non-validating 
	       			systems, whitespace should not appear in the parse attribute.</p>
					</note>
				</def>
			</gitem>
			<gitem>
				<label>xpointer</label>
				<def>
					<p>When <att>parse="xml"</att>, the XPointer (see <bibref ref="XPCore"/>) 						contained in the <att>xpointer</att> attribute is evaluated to identify 
					a portion of the resource to include. This attribute is optional; when 
					omitted, the entire resource is included.  The <att>xpointer</att> 
					attribute has no effect when <att>parse="text"</att>. If the 
					<att>xpointer</att> attribute is absent, the <att>href</att> attribute 
					<termref def="dt-must">must</termref> be present.</p>
				</def>
			</gitem>
			<gitem>
				<label>encoding</label>
				<def>
					<p>When <att>parse="text"</att>, it is sometimes impossible to
					correctly detect the encoding of the text resource.  The 
					<att>encoding</att>	attribute specifies how the resource is to 
					be translated.  The value of this attribute is an EncName as 
					defined in XML 1.0 specification, section 4.3.3, rule [81].  
					The <att>encoding</att> attribute has no effect when 
					<att>parse="xml"</att>.</p>
				</def>
			</gitem>
			<gitem>
				<label>accept</label>
				<def>
					<p>The value of the <att>accept</att> attribute may be used by 
					the XInclude processor to aid in content negotiation. When the
					XInclude processor fetches a resource via HTTP, it 
					<termref def="dt-must">should</termref> include the 
					value of the <att>accept</att> attribute, if one exists, in 
					the HTTP request as an <code>Accept</code> header as 
					described in section 14.1 of <bibref ref="RFC2616"/>.</p>
				</def>
			</gitem>
			<gitem>
				<label>accept-charset</label>
				<def>
					<p>The value of the <att>accept-charset</att> attribute may be used by 
					the XInclude processor to aid in content negotiation. When the
					XInclude processor fetches a resource via HTTP, it 
					<termref def="dt-must">should</termref> include the 
					value of the <att>accept-charset</att> attribute, if one exists, in 
					the HTTP request as an <code>Accept-Charset</code> header as 
					described in section 14.2 of <bibref ref="RFC2616"/>.</p>
				</def>
			</gitem>
			<gitem>
				<label>accept-language</label>
				<def>
					<p>The value of the <att>accept-language</att> attribute may be used by 
					the XInclude processor to aid in content negotiation. When the
					XInclude processor fetches a resource via HTTP, it 
					<termref def="dt-must">should</termref> include the 
					value of the <att>accept-language</att> attribute, if one exists, in 
					the HTTP request as an <code>Accept-Language</code> header as 
					described in section 14.4 of <bibref ref="RFC2616"/>.</p>
				</def>
			</gitem>
		</glist>
		
		<p>Attributes other than those listed above <termref def="dt-must">may</termref> 
		be placed on the <code>xi:include</code> element.  Unprefixed 
		attribute names are reserved for future versions of this specification, 
		and <termref def="dt-must">must</termref> be ignored by XInclude 1.0 
		processors.</p>
		
		<p>The <emph role="infoset-property">children</emph> property of the 
		<code>xi:include</code> element <termref def="dt-must">may</termref> 
		include a single <code>xi:fallback</code> element; the appearance of 
		more than one <code>xi:fallback</code> element, an 
		<code>xi:include</code> element, or any other element from the 
		XInclude namespace is a <termref def="dt-error">fatal error</termref>.
		Other content (text, processing instructions, comments, elements not 
		in the XInclude namespace, descendants of child elements) is not 
		constrained by this specification and is ignored by the XInclude 
		processor, that is, it has no effect on include processing, and does 
		not appear in the <emph role="infoset-property">children</emph> 
		properties of the result infoset. Such content might be used by 
		applications analyzing a pre-inclusion infoset, or be made available 
		to an application post-inclusion through means other than the normal 
		infoset properties.</p>
		
		<p>The following (non-normative) DTD fragment illustrates a sample 
  		declaration for the <code>xi:include</code> element:</p>
  		
		<eg>&lt;!ELEMENT xi:include (xi:fallback?)&gt;
&lt;!ATTLIST xi:include
    xmlns:xi        CDATA       #FIXED    "&includensuri;"
    href            CDATA       #IMPLIED
    parse           (xml|text)  "xml"
    xpointer        CDATA       #IMPLIED
    encoding        CDATA       #IMPLIED
    accept          CDATA       #IMPLIED
    accept-charset  CDATA       #IMPLIED
    accept-language CDATA       #IMPLIED
&gt;</eg>
	</div2>

	<div2 id="fallback_element">
	
		<head>xi:fallback Element</head>
	
		<p>The <code>xi:fallback</code> element appears as a child
		of an <code>xi:include</code> element.  It provides a mechanism
		for recovering from missing resources.  When a 
		<termref def="dt-resource-error">resource error</termref> is 
		encountered, the <code>xi:include</code> element is replaced 
		with the contents of the <code>xi:fallback</code> element.  
		If the <code>xi:fallback</code> element is empty, the 
		<code>xi:include</code> element is removed from the result.
		If the <code>xi:fallback</code> element is missing, a
		<termref def="dt-resource-error">resource error</termref> results 
		in a <termref def="dt-error">fatal error</termref>.</p>
		<p>The <code>xi:fallback</code> element can appear only as a 
		child of an <code>xi:include</code> element.  It is a
		<termref def="dt-error">fatal error</termref> for an <code>xi:fallback</code>
		element to appear in a document anywhere other than as the direct child
		of the <code>xi:include</code> (before inclusion processing on 
		the contents of the element.)</p>

		<p>Attributes <termref def="dt-must">may</termref> 
		be placed on the <code>xi:fallback</code> element.  Unprefixed 
		attribute names are reserved for future versions of this specification, 
		and <termref def="dt-must">must</termref> be ignored by XInclude 1.0 
		processors.</p>

		<p>The following (non-normative) DTD fragment illustrates a sample 
		declaration for the <code>xi:fallback</code> element:</p>

		<eg>&lt;!ELEMENT xi:fallback ANY&gt;
&lt;!ATTLIST xi:fallback
    xmlns:xi   CDATA   #FIXED   "&includensuri;"
&gt;</eg>
	</div2>
</div1>

<div1 id="processing">

	<head>Processing Model</head>
	
	<p>Inclusion as defined in this document is a specific type of 
	<bibref ref="XMLIS"/> transformation.</p>
	
	<p><termdef id="dt-source-infoset" term="source infoset">The 
	input for the inclusion transformation consists of a <term>source 
	infoset</term>.</termdef>&#32;<termdef id="dt-result-infoset" 
	term="result infoset">The output, called the <term>result 
	infoset</term>, is a new infoset which merges the source infoset 
	with the infosets of resources identified by URI references 
	appearing in <code>xi:include</code> elements.</termdef>  Thus a 
	mechanism to resolve URIs and return the identified resources as 
	infosets is assumed.  Well-formed XML entities that do not have 
	defined infosets (e.g. an external entity with multiple 
	top-level elements) are outside the scope of this specification, 
	either for use as a <termref def="dt-source-infoset">source 
	infoset</termref> or the <termref def="dt-result-infoset">result 
	infoset</termref>.</p>
	
	<p><code>xi:include</code> elements in the source infoset serve
	as inclusion transformation instructions.
	<termdef id="dt-top-level-included-items" term="top-level included items">The 
	information items located by the <code>xi:include</code> element
	are called the <term>top-level included items</term></termdef>.  
	<termdef id="dt-included-items" term="included items">The 
	<termref def="dt-top-level-included-items">top-level included items</termref>
	together with their attributes, namespaces, and descendants, 
	are called the <term>included items</term></termdef>.  The 
	<termref def="dt-result-infoset">result infoset</termref> is 
	essentially a copy of the <termref def="dt-source-infoset">source 
	infoset</termref>, with each <code>xi:include</code> element
	and its descendants replaced by its corresponding
	<termref def="dt-included-items">included items</termref>.</p>
	
	<div2 id="include-location">
		
		<head>The Include Location</head>
		
		<p>The value of the <att>href</att> attribute (or the empty string
		if no attribute appears) is interpreted as an 
		<termref def="dt-IRI">IRI reference</termref>.  The base URI for 
		relative IRIs is the base URI of the <code>xi:include</code> 
		element as specified in <bibref ref="XMLBase"/>.  
		<termdef id="dt-include-location" term="include location">The 
		IRI resulting from resolution of the normalized value of the 
		<code>href</code> attribute to absolute IRI form is called the 
		<term>include location</term>.</termdef></p>
		
		<div3 id="content-negotiation">
		
			<head>Using XInclude with Content Negotiation</head>
			
			<p>The use of a mechanism like HTTP <bibref ref="RFC2616"/> content
			negotiation introduces an additional level of potential complexity 
			into the use of XInclude. Developers who use XInclude in situations 
			where content negotiation is likely or possible should be aware of 
			the possibility that they will be including content that may differ 
			structurally from the content they expected, even if that content 
			is XML.  For example, a single URI may variously return a raw XML 
			representation of the resource, an XSL-FO <bibref ref="XSL-FO"/> 
			representation, or an XHTML <bibref ref="XHTML"/> representation, 
			as well as versions in different character encodings or languages.</p>
			
			<p>Authors whose XInclude processing depends on the receipt of 
			a particular vocabulary of XML should use the <att>accept</att>,
			<att>accept-charset</att>, and <att>accept-language</att> attributes
			to increase the probability that the resource is provided in the
			expected format.</p>
		</div3>
	</div2>
	
	<div2 id="xml-included-items">
		
		<head>Included Items when <att>parse="xml"</att></head>
		
		<p>When <att>parse="xml"</att>, the 
		<termref def="dt-include-location">include location</termref> is 
		dereferenced, the resource is fetched, and an infoset is created by 
		parsing the resource as if the media type were application/xml 
		(including character encoding determination).</p>
		
		<note>
			<p>The specifics of how an infoset is created are intentionally 
			unspecified, to allow for flexibility by implementations and to 
			avoid defining a particular processing model for components of 
			the XML architecture.  Particulars of whether DTD or XML schema 
			validation are performed, for example, are not constrained by 
			this specification.</p>
		</note>
		
		<note>
			<p>The character encodings of the including and included 
			resources can be different.  This does not affect the resulting 
			infoset, but might need to be taken into account during any 
			subsequent serialization.</p>
		</note>
		
		<p>Resources that are unavailable for any reason (for example the 
		resource doesn't exist, connection difficulties or security 
		restrictions prevent it from being fetched, the URI scheme isn't 
		a fetchable one, the resource is in an unsupported encoding, or the 
		resource is determined through implementation-specific mechanisms 
		not to be XML) 
		result in a <termref def="dt-resource-error">resource error</termref>. 
		Resources that contain non-well-formed XML result in a
		<termref def="dt-error">fatal error</termref>.</p>
		
		<note>
			<p>The distinction between a resource error and a fatal error 
			is somewhat implementation-dependent.  Consider an include 
			location returning an HTML document, perhaps as an error page.  
			One processor might determine that no infoset can be created 
			from the resource (by examining the media type, for example) 
			and raise a resource error, enabling fallback behavior.  
			Another processor with no such heuristics might attempt to 
			parse the non-XML resource as XML and encounter a 
			well-formedness (fatal) error.</p>
		</note>
		
		<p><termdef id="dt-acquired-infoset" term="acquired infoset">
		<code>xi:include</code> elements in this infoset are recursively 
		processed to create the <term>acquired infoset</term>.</termdef></p>
		
		<p>If an <att>xpointer</att> attribute is present, the value is
		evaluated to identify a portion of the  
		<termref def="dt-acquired-infoset">acquired infoset</termref> 
		as the target for inclusion.  XPointers of the forms described in 
		<bibref ref="XPCore"/> and <bibref ref="XPElement"/>&#x20;
		<termref def="dt-must">must</termref> be supported.  XInclude 
		processors optionally support other forms of XPointer such as 
		that described in <bibref ref="XPointer"/>.  A syntax error in
		the XPointer is a <termref def="dt-resource-error">resource error</termref>.
		</p>
		
		<p>The <bibref ref="XPointer"/> is not specified in terms of the 
		<bibref ref="XMLIS"/>, but instead is based on the 
		<bibref ref="XPath"/> Data Model, because the XML Information Set 
		had not yet been developed.  The mapping between XPath node 
		locations and information items is straightforward.  However, 
		xpointer() assumes that all entities have been expanded.  Thus 
		it is a <termref def="dt-error">fatal error</termref> to attempt 
		to resolve an xpointer() scheme on a document that contains 
		<emph role="infoitem">Unexpanded Entity Reference Information 
		Items</emph>.</p>
		
		<p>The set of <termref def="dt-top-level-included-items">top-level 
		included items</termref> is derived from the 
		<termref def="dt-acquired-infoset">acquired infoset</termref> as 
		follows.</p>
		
		<div3 id="docii">
			
			<head>Document Information Items</head>
			
			<p>An XPointer might identify a <emph role="info-item">document information 
			item</emph> (for instance, no specified <att>xpointer</att> attribute, 
			or an XPointer specifically locating the document root.)  In 
			this case, the set of <termref def="dt-top-level-included-items">top-level 
			included items</termref> is the <emph role="infoset-property">children</emph>
			of the <termref def="dt-acquired-infoset">acquired infoset's</termref> 
			document information item, except for the  <emph role="info-item">document 
			type declaration information item</emph> child, if one exists.</p>
			
			<note>
				<p>The XML Information Set specification does not provide for 
				preservation of white space outside the document element.  
				XInclude makes no further provision to preserve this white 
				space.</p>
			</note>

		</div3>

		<div3 id="multiple-nodes">

			<head>Multiple Nodes</head>
	
			<p>An XPointer might identify a subresource that consists of 
			more than a single node.  In this case the set of 
			<termref def="dt-top-level-included-items">top-level included 
			items</termref> is the set of information items from the 
			<termref def="dt-acquired-infoset">acquired infoset</termref> 
			corresponding to the nodes referred to by the XPointer, in the 
			order in which they appear in the acquired infoset.</p>
		</div3>
		
		<div3 id="ranges">
		
			<head>Range Locations</head>
		
			<p>An XPointer might identify a location set that represents a 
			range or a set of ranges.</p>
			
			<p>Each range corresponds to a set of information items in the 
			<termref def="dt-acquired-infoset">acquired infoset</termref>. 
			<termdef term="selected" id="dt-selected">An information item is 
			said to be <term>selected</term> by a range if it occurs after 
			(in document order) the starting point of the range and before 
			the ending point of the range.</termdef>&#32;
			<termdef term="partially selected" id="dt-partially-selected">An 
			information item is said to be <term>partially selected</term> by 
			a range if it contains only the starting point of the range, or 
			only the ending point of the range.</termdef>  By definition, a 
			character information item cannot be 
			<termref def="dt-partially-selected">partially selected</termref>.</p>
			
			<p>The set of <termref def="dt-top-level-included-items">top-level 
			included  items</termref> is the union, in document order with 
			duplicates removed, of the information items either 
			<termref def="dt-selected">selected</termref> or 
			<termref def="dt-partially-selected">partially selected</termref> 
			by the range.  The <emph role="infoset-property">children</emph> 
			property of <termref def="dt-selected">selected</termref> 
			information items is not modified.  The 
			<emph role="infoset-property">children</emph> property of 
			<termref def="dt-partially-selected">partially selected</termref> 
			information items is the set of information items that are in 
			turn either <termref def="dt-selected">selected</termref> or
			<termref def="dt-partially-selected">partially selected</termref>,
			and so on.</p>
		</div3>
		
		<div3 id="points">
			
			<head>Point Locations</head>
			
			<p>An XPointer might identify a location set that represents 
			a point.  In this case the set of <termref def="dt-included-items">included 
			items</termref> is empty.</p>
		</div3>
		
		<div3 id="elements">
		
			<head>Element, Comment, and Processing Instruction Information Items</head>
		
			<p>An XPointer might identify an element node, a
			comment node, or a processing instruction node, respectively
			representing an <emph role="info-item">element information item</emph>,
			a <emph role="info-item">comment information item</emph>, or a 
			<emph role="info-item">processing instruction information item</emph>. 
			In this case the set of <termref def="dt-top-level-included-items">top-level
			included items</termref> consist of the information item corresponding 
			to the element, comment, or processing instruction node in the 
			<termref def="dt-acquired-infoset">acquired infoset</termref>.</p>
		</div3>
		
		<div3 id="attributes">

			<head>Attribute and Namespace Declaration Information Items</head>

			<p>An XPointer might identify an attribute node or
			a namespace node.  An include location identifying such a node is a 
			<termref def="dt-error">fatal error</termref>.</p>
		</div3>
		
		<div3 id="loops">
			
			<head>Inclusion Loops</head>
			
			<p>When recursively processing an <code>xi:include</code> 
			element, it is a <termref def="dt-error">fatal error</termref> to process 
			another <code>xi:include</code> element 
			with an <termref def="dt-include-location">include location</termref>
			that has already been processed in the inclusion chain.</p>
			
			<p>In other words, the following are all legal:</p>
			
			<ulist>
				<item>
					<p>An <code>xi:include</code> element 
					<termref def="dt-must">may</termref> reference the document 
					containing the include element, when <att>parse="text"</att>.</p>
				</item>
				<item>
					<p>An <code>xi:include</code> element 
					<termref def="dt-must">may</termref> identify a different 
					part of the same local resource.</p>
				</item>
				<item>
					<p>Two non-nested <code>xi:include</code> elements 
          	<termref def="dt-must">may</termref> identify a resource which 
          	itself contains an <code>xi:include</code> element.</p>
				</item>
			</ulist>
			
			<p>The following are illegal:</p>
			
			<ulist>
				<item>
					<p>An <code>xi:include</code> element pointing to itself or any 
					ancestor thereof, when <att>parse="xml"</att>.</p>
				</item>
				<item>
					<p>An <code>xi:include</code> element pointing to any include
					element or ancestor thereof which has already been processed 
					at a higher level.</p>
				</item>
			</ulist>
		</div3>
	</div2>
	
	<div2 id="text-included-items">
		
		<head>Included Items when <att>parse="text"</att></head>
		
		<p>When <att>parse="text"</att>, the <termref def="dt-include-location">include 
		location</termref> is dereferenced and the resource is fetched 
		and transformed to a set of character information items.  This 
		feature facilitates the inclusion of working XML examples, as 
		well as other text-based formats.</p>
		
		<p>Resources that are unavailable for any reason (for example 
		the resource doesn't exist, connection difficulties or security 
		restrictions prevent it from being fetched, the URI scheme isn't 
		a fetchable one, the resource is in an unsupported encoding, or 
		a syntax error in a fragment identifier) result in a 
		<termref def="dt-resource-error">resource error</termref>.</p>
		
		<p>The encoding of such a resource is determined by:</p>
		
		<ulist>
			<item>
				<p>external encoding information, if available, otherwise</p>
			</item>
			<item>
				<p>if the media type of the resource is <code>text/xml</code>,
				<code>application/xml</code>, or matches the conventions
				<code>text/*+xml</code> or <code>application/*+xml</code> as described
				in XML Media Types <bibref ref="RFC3023"/>, the encoding is
					recognized as specified in XML 1.0, otherwise</p>
			</item>
			<item>
				<p>the value of the <att>encoding</att> attribute if one
				exists, otherwise</p>
			</item>
			<item>
				<p>UTF-8.</p>
			</item>
		</ulist>
		
		<p>Byte sequences outside the range allowed by the encoding are a 
		<termref def="dt-error">fatal error</termref>.  Characters that are not 
		permitted in XML documents also are a
		<termref def="dt-error">fatal error</termref>.</p>
				
		<p>Each character obtained from the transformation of the resource is
		represented in the <termref def="dt-top-level-included-items">top-level 
		included items</termref> as a <emph role="info-item">character 
		information item</emph> with the 
		<emph role="infoset-property">character code</emph> set to the 
		character code in ISO 10646 encoding, and 
		the <emph role="infoset-property">element content whitespace</emph> set 
		to false.</p>
		
		<p>The <bibref ref="CharMod"/> discusses normalization of included text.</p>
	</div2>
	
	<div2 id="fallback">
	
		<head>Fallback Behavior</head>
		
		<p>XInclude processors <termref def="dt-must">must</termref> perform 
		fallback behavior in the event of a 
		<termref def="dt-resource-error">resource error</termref>, as follows:</p>
		
		<p>If the <emph role="infoset-property">children</emph> of the
		<code>xi:include</code> element information item in the 
		<termref def="dt-source-infoset">source infoset</termref> contain
		exactly one <code>xi:fallback</code> element, the
		<termref def="dt-top-level-included-items">top-level included items</termref> 
		consist of the information items corresponding to the result of performing 
		XInclude processing on the <emph role="infoset-property">children</emph> 
		of the <code>xi:fallback</code> element.  It is a 
		<termref def="dt-error">fatal error</termref> if there is zero or more than 
		one <code>xi:fallback</code> element.</p>
		
		<note>
			<p>Fallback content is not dependent on the value of the 
			<code>parse</code> attribute.  The <code>xi:fallback</code> 
			element can contain markup even when <code>parse="text"</code>.
			Likewise, it can contain a simple string when <code>parse="xml"</code>.</p>
		</note>
	</div2>
		
	<div2 id="creating-result">
		
		<head>Creating the Result Infoset</head>
		
		<p>The result infoset is a copy of the source infoset,
		with each <code>xi:include</code> element processed as follows:</p>

		<p>The information item for the <code>xi:include</code> element is 
		found. <termdef id="dt-include-parent" term="include parent">The
		<emph role="infoset-property">parent</emph> property of this item 
		refers to an information item called the <term>include parent</term>.</termdef>
		The <emph role="infoset-property">children</emph> property of the 
		<termref def="dt-include-parent">include parent</termref>
		is modified by replacing the <code>xi:include</code> element 
		information item with the <termref def="dt-top-level-included-items">top-level 
		included items</termref>. The <emph role="infoset-property">parent</emph> 
		property of each included item is set to the
		<termref def="dt-include-parent">include parent</termref>.</p>

		<p>It is a fatal error to attempt to replace an <code>xi:include</code> 
		element appearing as the document (top-level) element in the source 
		infoset with something other than a list of zero or more comments, 
		zero or more processing instructions, and one element.</p>
		
		<p>Each <termref def="dt-top-level-included-items">top-level included 
		item</termref> is assigned an extension property 
		<emph role="infoset-property">included</emph> with
		the Boolean value "true".  Information items which were not processed 
		as <termref def="dt-top-level-included-items">top-level included 
		items</termref> will have no value for the 
		<emph role="infoset-property">included</emph> property.
		This property might be used by applications which require knowledge of where
		inclusion has been performed.</p>

		<p>The <termref def="dt-included-items">included items</termref> will all 
		appear in the result infoset.  This includes <emph role="infoitem">Unexpanded
		Entity Reference Information Items</emph> if they are present.</p>

		<p>Intra-document references within <code>xi:include</code> elements 
		<termref def="dt-must">must</termref> be resolved against the 
		source infoset.  The effect of this is that the order in which 
		<code>xi:include</code> elements are processed does not affect the result.</p>
		
		<p>In the following example, the second include always points to 
		the first <code>xi:include</code> element and not to itself,
		regardless of the order in which the includes are processed.  Thus
		the result of this inclusion is two copies of <code>something.xml</code>,
		and does not produce an inclusion loop error.</p>
		
		<eg>&lt;x xmlns:xi="&includensuri;"&gt;
  &lt;xi:include href="something.xml"/&gt;
  &lt;xi:include xpointer="xmlns(xi=&includensuri;)xpointer(x/xi:include[1])"
              parse="xml"/&gt;
&lt;/x&gt;</eg>
		
		<div3 id="unparsed-entities">
			
			<head>Unparsed Entities</head>
			
			<p>Any <emph role="info-item">unparsed entity information 
			item</emph> appearing in the <emph role="infoset-property">references</emph> 
			property of an attribute on the <termref def="dt-included-items">included
			items</termref> or any descendant thereof is added to the 
			<emph role="infoset-property">unparsed entities</emph> 
			property of the <termref def="dt-result-infoset">result infoset</termref>'s
			<emph role="info-item">document information item</emph>, if 
			it is not a duplicate of an existing member.  Duplicates do not appear
			in the result infoset.</p>
		
			<p>Unparsed entity items with the same
			<emph role="infoset-property">name</emph>,
			<emph role="infoset-property">system identifier</emph>,
			<emph role="infoset-property">public identifier</emph>,
			<emph role="infoset-property">declaration base URI</emph>,
			<emph role="infoset-property">notation name</emph>, and
			<emph role="infoset-property">notation</emph> are
			considered to be duplicate.  An application 
			<termref def="dt-must">may</termref> also be able to detect that 
			unparsed entities are duplicate through other means.  For instance, 
			the URI resulting from combining the system identifier
			and the declaration base URI is the same.</p>
			
			<p>It is a <termref def="dt-error">fatal error</termref> to 
			include unparsed entity items with the same name, but which are not 
			determined to be duplicates.</p>
		</div3>
		
		<div3 id="notations">
		
			<head>Notations</head>
		
			<p>Any <emph role="info-item">notation information item</emph>
			appearing in the <emph role="infoset-property">references</emph> 
			property of an attribute in the <termref def="dt-included-items">included
			items</termref> or any descendant thereof is added to the 
			<emph role="infoset-property">notations</emph> property of the 
			<termref def="dt-result-infoset">result infoset</termref>'s
			<emph role="info-item">document information item</emph>, if 
			it is not a duplicate of an existing member.  Likewise,
			any notation referenced by an unparsed entity added as described
			in <specref ref="unparsed-entities"/>, is added unless it is
			a duplicate.  Duplicates do not appear in the result infoset.</p>
			
			<p>Notation items with the same
			<emph role="infoset-property">name</emph>,
			<emph role="infoset-property">system identifier</emph>,
			<emph role="infoset-property">public identifier</emph>, and
			<emph role="infoset-property">declaration base URI</emph> are
			considered to be duplicate.  An application <termref def="dt-must">may</termref>
			also be able to detect that notations are duplicate through other means.  For
			instance, the URI resulting from combining the system identifier
			and the declaration base URI is the same.</p>
			
			<p>It is a <termref def="dt-error">fatal error</termref> to 
			include notation items with the same name, but which are not 
			determined to be duplicates.</p>
		</div3>

		<div3 id="references-property">

			<head><emph role="infoset-property">references</emph> property fixup</head>
			
			<p>During inclusion, an <emph role="info-item">attribute information 
			item</emph> whose <emph role="infoset-property">attribute type</emph> 
			property is IDREF or IDREFS has a <emph role="infoset-property">references</emph>
			property with zero or more element values from the source or included 
			infosets.  These values <termref def="dt-must">must</termref> be 
			adjusted to correspond to element values that occur in the result 
			infoset.  During this process, XInclude also corrects inconsistencies 
			between the <emph role="infoset-property">references</emph>
			property and the <emph role="infoset-property">attribute type</emph> 
			property, which might arise in the following circumstances:</p>
			
			<ulist>
				<item>
					<p>A document fragment contains an IDREF pointing to an element 
					in the included document but outside the part being included.  
					In this case there is no element in the result infoset that 
					corresponds to the element value in the original 
					<emph role="infoset-property">references</emph> property.</p>
				</item>
				<item>
					<p>A document or document fragment is not self-contained.  
					That is, it contains IDREFs which do not refer to an element within
					that document or document fragment, with the intention that these 
					references will be realized after inclusion.  In this case, 
					the value of the <emph role="infoset-property">references</emph> 
					property is unknown or has no value.</p>
				</item>
				<item>
					<p>The result infoset has ID clashes - that is, more than one
					attribute with <emph role="infoset-property">attribute type</emph>
					ID with the same <emph role="infoset-property">normalized value</emph>.
					In this case, attributes with <emph role="infoset-property">attribute 
					type</emph> IDREF or IDREFS with the same <emph role="infoset-property">
					normalized value</emph> might have different values for their
         		<emph role="infoset-property">references</emph> properties.</p>
				</item>
			</ulist>
			
			<p>In resolving these inconsistencies, XInclude takes the 
			<emph role="infoset-property">attribute type</emph> property as 
			definitive.  In the result infoset, the value of the
			<emph role="infoset-property">references</emph> property of an
			<emph role="info-item">attribute information item</emph>
			whose <emph role="infoset-property">attribute type</emph> property
			is IDREF or IDREFS is adjusted as follows:</p>
			
			<p>For each token in the <emph role="infoset-property">normalized 
			value</emph> property, the <emph role="infoset-property">references</emph>
			property contains an <emph role="info-item">element information 
			item</emph> with the same properties as the 
			<emph role="info-item">element information item</emph> in the result
			infoset with an attribute with <emph role="infoset-property">attribute 
			type</emph> ID and <emph role="infoset-property">normalized
			value</emph> equal to the token.  The order of the elements in 
			the <emph role="infoset-property">references</emph> property is 
			the same as the order of the tokens appearing in the 
			<emph role="infoset-property">normalize value</emph>.  If for any of the
			token values, no element or more than one element is found, the 
			<emph role="infoset-property">references</emph> property has no value.</p>
		</div3>
		
		<div3 id="namespaces">
			
			<head>Namespace Fixup</head>
			
			<p>The <emph role="infoset-property">in-scope namespaces</emph> 
			property ensures that namespace scope is preserved through inclusion.  
			However, after inclusion, the <emph role="infoset-property">namespace
			attributes</emph> property might not provide the full list of 
			namespace declarations necessary to interpret qualified names in 
			attribute or element content in the result. It is therefore not 
			recommended that XInclude processors expose 
			<emph role="infoset-property">namespace attributes</emph> in the 
			result. If this is unavoidable, the implementation 
			<termref def="dt-must">may</termref> add 
			<emph role="infoitem">Attribute Information Items</emph> to the
			<emph role="infoset-property">namespace attributes</emph> property 
			in order to approximate the information conveyed by 
			<emph role="infoset-property">in-scope namespaces</emph>.</p>
		</div3>
		
		<div3 id="base">
		
			<head>Base URI</head>
		
			<p>The base URI property of the acquired infoset is not changed as 
			a result of merging the infoset, and remains unchanged after merging.
			Thus relative URI references in the included infoset resolve to the same
			URI despite being included into a document with a potentially
			different base URI in effect.  <att>xml:base</att> attributes are added
			to the result infoset to indicate this fact.</p>
			
			<p>Each <emph role="infoitem">Element Information Item</emph> in 
			the <termref def="dt-top-level-included-items">top-level included 
			items</termref> which has a different <emph role="infoset-property">base 
			URI</emph> than its <termref def="dt-include-parent">include parent</termref> 
			has an <emph role="infoitem">Attribute Information Item</emph> added to its
			<emph role="infoset-property">attributes</emph> property.  If an
			<att>xml:base</att> attribute information item is already present, it
			is replaced by the new attribute.  This attribute has the following 
			properties:</p>
			
			<olist>
				<item>
					<p>A <emph role="infoset-property">namespace name</emph> of 
					<code>http://www.w3.org/XML/1998/namespace</code>.</p>
				</item>
				<item>
					<p>A <emph role="infoset-property">local name</emph> of 
					<code>base</code>.</p>
				</item>
				<item>
					<p>A <emph role="infoset-property">prefix</emph> of 
					<code>xml</code>.</p>
				</item>
				<item>
					<p>A <emph role="infoset-property">normalized value</emph> 
					equal to either the <emph role="infoset-property">base 
					URI</emph> of the element, or an equivalent URI reference 
					relative to the <emph role="infoset-property">base URI</emph> 
					of the include parent.  The circumstances in which a relative 
					URI is desirable, and how to compute such a relative URI, 
					are implementation-dependent.</p>
				</item>
				<item>
					<p>A <emph role="infoset-property">specified</emph> flag 
					indicating that this attribute was actually specified in the 
					start-tag of its element.</p>
				</item>
				<item>
					<p>An <emph role="infoset-property">attribute type</emph> of 
					<code>CDATA</code>.</p>
				</item>
				<item>
					<p>A <emph role="infoset-property">references</emph> property 
					with no value.</p>
				</item>
				<item>
					<p>An <emph role="infoset-property">owner element</emph> of the 
					information item of the element.</p>
				</item>
			</olist>
			
			<note>
				<p>The <code>xml:lang</code> and <code>xml:space</code> attributes 
				are not treated specially by XInclude.</p>
			</note>
		</div3>
		
		<div3 id="properties">
		
			<head>Properties Preserved by the Infoset</head>
			
			<p>As an infoset transformation, XInclude operates on the logical 
			structure of XML documents, not on their text serialization.  All 
			properties of an information item described in <bibref ref="XMLIS"/> 
			other than those specifically modified by this specification are 
			preserved during inclusion.  Extension properties such as 
			<bibref ref="XMLSchemas"/> Post Schema Validation Infoset (PSVI) 
			properties are discarded by default.  However, an XInclude 
			processor <termref def="dt-must">may</termref>, at user option, 
			preserve these properties in the resulting infoset if they 
			are correct according to the specification describing the 
			semantics of the extension properties.</p>
			
			<p>For instance, the PSVI <emph role="infoset-property">validity</emph>
			property describes the conditions of ancestors and descendants.  
			Modification 	of ancestors and descendants during the XInclude 
			process can render the value of this property inaccurate.  By 
			default, XInclude strips this property, but by user option the 
			property could be recalculated to obtain a semantically accurate 
			value.  Precisely how this is accomplished is outside the scope 
			of this specification.</p>
		</div3>
	</div2>
</div1>

<div1 id="IRIs">

	<head>Internationalized Resource Identifiers (IRIs)</head>

	<p>Work is currently in progress to produce an RFC defining
	Internationalized Resource Identifiers (IRIs).  Since this work is not
	yet complete, in this section we give a syntactic definition of IRIs
	for the purposes of this specification.  We expect to issue an erratum
	replacing this section with a reference to the RFC when it is
	published.</p>
	
	<p>For a more general definition and discussion of IRIs see 
	<bibref ref="IRIdraft"/>	(work in progress).</p>
	
	<p>URI references are restricted to a subset of the ASCII characters;
	IRI references allow some of the disallowed ASCII characters as well
	as most Unicode characters from #xA0 onwards.</p>

	<p><termdef id="dt-addchar" term="additional characters">The 
	<term>additional characters</term> allowed in IRIs are:</termdef></p>

	<ulist>
		<item>
			<p>space #x20</p>
			<note>
				<p>Authors are advised to avoid unescaped spaces, as XML 
				Schema has <loc href="http://www.w3.org/TR/xmlschema-2/#anyURI-lexical-representation">identified</loc> 
				them as an interoperability risk.</p>
			</note>
		</item>
		<item>
			<p>the delimiters <kw>&lt;</kw> #x3C, <kw>&gt;</kw> #x3E and 
			<kw>"</kw> #x22</p>
		</item>
		<item>
			<p>the unwise characters <kw>{</kw> #x7B, <kw>}</kw> #x7D, 
			<kw>|</kw> #x7C, <kw>\</kw> #x5C, <kw>^</kw> #x5E and 
			<kw>`</kw> #x60</p>
		</item>
		<item>
			<p>the Unicode plane 0 characters #xA0 - #xD7FF, #xF900-#xFDCF, 
			#xFDF0-#xFFEF</p>
		</item>
		<item>
			<p>the Unicode plane 1-14 characters #x10000-#x1FFFD ... 
			#xE000-#xEFFD</p>
		</item>
	</ulist>
	
	<p><termdef id="dt-IRI" term="IRI reference">An <term>IRI reference</term> 
	is a string that can be converted to	a URI reference by escaping all 
	additional characters as follows:</termdef></p>

	<olist>
		<item>
			<p>Each additional character is converted to UTF-8 
			<bibref ref="Unicode32"/> as one or more bytes.</p>
		</item>
		<item>
			<p>The resulting bytes are escaped with the URI escaping 
			mechanism (that is, converted to %HH, 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>
</div1>

<div1 id="conformance">

	<head>Conformance</head>

	<div2 id="markup">

		<head>Markup Conformance</head>

		<p>An <emph role="info-item">element information item</emph> conforms
		to this specification if it meets the structural requirements for 
		include elements defined in this specification.  This specification
		imposes no particular constraints on DTDs or XML schemas; conformance 
		applies only to elements and attributes.</p>
	</div2>
	
	<div2 id="application">
	
		<head>Application Conformance</head>
	
		<p>An application conforms to XInclude if it:</p>

		<ulist>
			<item>
				<p>supports <bibref ref="XML"/>, <bibref ref="XMLNS"/>, 
				the <bibref ref="XMLIS"/>, <bibref ref="XMLBase"/>, the 
				<bibref ref="XPCore"/>, and the <bibref ref="XPElement"/></p>
			</item>
			<item>
				<p>stops processing when a <termref def="dt-error">fatal 
				error</termref> is encountered.</p>
			</item>
			<item>
				<p>observes the mandatory conditions 
				(<termref def="dt-must">must</termref>) set forth in this 
				specification, and for any optional conditions
				(<termref def="dt-must">should</termref> and 
				<termref def="dt-must">may</termref>) it chooses to observe, 
				observes them in the way prescribed</p>
			</item>
			<item>
				<p>performs markup conformance testing according to all the
				conformance constraints appearing in this specification.</p>
			</item>
		</ulist>
		
		<p>Support for the <bibref ref="XPointer"/> is not mandatory for 
		full XInclude conformance.  Authors are advised that use of 
		xpointer() and other XPointer schemes than element() might not be 
		supported by all XInclude implementations.</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">Document Information Items</emph> with
				<emph role="infoset-property">children</emph> and
				<emph role="infoset-property">base URI</emph> properties.</p>
			</item>
			<item>
				<p><emph role="info-item">Element Information Items</emph> with
				<emph role="infoset-property">namespace name</emph>,
				<emph role="infoset-property">local name</emph>,
				<emph role="infoset-property">children</emph>,
				<emph role="infoset-property">attributes</emph>,
				<emph role="infoset-property">base URI</emph> and
				<emph role="infoset-property">parent</emph> properties.</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>Additionally, XInclude processing might generate the following 
		kinds of information items in the result:</p>
		
		<ulist>
			<item>
				<p>
					<emph role="info-item">Character Information Items</emph> with
             <emph role="infoset-property">character code</emph>,
             <emph role="infoset-property">element content whitespace</emph> and
             <emph role="infoset-property">parent</emph> properties.</p>
			</item>
		</ulist>
		
		<p>XInclude also extends the infoset with the Boolean property
		<emph role="infoset-property">included</emph>, which 
		<termref def="dt-must">may</termref> appear on the following
		types of information items in the result:</p>
		
		<ulist>
			<item>
				<p><emph role="info-item">Element Information Items</emph>.</p>
			</item>
			<item>
				<p><emph role="info-item">Processing Instruction Information Items</emph>.</p>
			</item>
			<item>
				<p><emph role="info-item">Comment Information Items</emph>.</p>
			</item>
			<item>
				<p><emph role="info-item">Character Information Items</emph>.</p>
			</item>
		</ulist>
	</div2>
</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="RFC2279" key="IETF RFC 2279" href="http://www.ietf.org/rfc/rfc2279.txt">
			<titleref href="http://www.ietf.org/rfc/rfc2279.txt">RFC 2279: UTF-8, 
			a transformation format of ISO 10646</titleref>.
			Internet Engineering Task Force, 1998.
		</bibl>
			
		<bibl id="RFC2396" key="IETF RFC 2396" href="http://www.ietf.org/rfc/rfc2396.txt">
			<titleref href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396: 
			Uniform Resource Identifiers</titleref>. Internet Engineering 
			Task Force, 1995.
		</bibl>
		
		<bibl id="RFC2732" key="IETF RFC 2732" href="http://www.ietf.org/rfc/rfc2732.txt">
			<titleref href="http://www.ietf.org/rfc/rfc2732.txt">RFC 2732: 
			Format for Literal IPv6 Addresses in URL's</titleref>.
			Internet Engineering Task Force, 1999.
		</bibl>
		
		<bibl id="RFC3023" key="IETF RFC 3023" href="http://www.ietf.org/rfc/rfc3023.txt">
			<titleref href="http://www.ietf.org/rfc/rfc3023.txt">RFC 3023: 
			XML Media Types</titleref>.
			Internet Engineering Task Force, 2001.
		</bibl>
		
		<bibl id="Unicode32" key="Unicode 3.2">
			The Unicode Consortium
			<titleref>The Unicode Standard, Version 3.2.0</titleref> is 
			defined by <titleref>The Unicode Standard, Version 3.0</titleref>
			(Reading, MA, Addison-Wesley, 2000. ISBN 0-201-61633-5), as amended 
			by the <titleref>Unicode Standard Annex #27: Unicode 3.1</titleref> 
			(see <loc href="http://www.unicode.org/reports/tr27/">http://www.unicode.org/reports/tr27</loc>) 
			and by the <titleref>Unicode Standard Annex #28: Unicode 
			3.2</titleref> (<loc href="http://www.unicode.org/reports/tr28/">http://www.unicode.org/reports/tr28</loc>).
		</bibl>
		
		<bibl id="XML" key="XML 1.0" href="http://www.w3.org/TR/REC-xml">
			Tim Bray, Jean Paoli, C.M. Sperberg-McQueen, and Eve Maler, editors.
			<titleref href="http://www.w3.org/TR/REC-xml">Extensible Markup 
			Language (XML) 1.0 (Second Edition).</titleref>
			World Wide Web Consortium, 1998.
		</bibl>
		
		<bibl id="XMLBase" key="XML Base" href="http://www.w3.org/TR/xmlbase/">
			Jonathan Marsh, editor.
			<titleref href="http://www.w3.org/TR/xmlbase/">XML Base</titleref>.
			World Wide Web Consortium, 1999.
		</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</titleref>.
			World Wide Web Consortium, 1999.
		</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="XPCore" key="XPointer Framework" href="http://www.w3.org/TR/xptr-framework/">
			Paul Grosso, Eve Maler, Jonathan Marsh, Norman Walsh, editors.
			<titleref href="http://www.w3.org/TR/xptr-framework/">XPointer Framework</titleref>.
			World Wide Web Consortium, 2002.
		</bibl>
		
		<bibl id="XPElement" key="XPointer element() scheme" href="http://www.w3.org/TR/xptr-element/">
			Paul Grosso, Eve Maler, Jonathan Marsh, Norman Walsh, editors.
			<titleref href="http://www.w3.org/TR/xptr-element/">XPointer element() 
			Scheme</titleref>.
			World Wide Web Consortium, 2002.
		</bibl>
	</blist>
</div1>

<inform-div1>

	<head>References</head>

	<blist>
	
		<bibl id="RFC2616" key="IETF RFC 2616" href="http://www.ietf.org/rfc/rfc2616.txt">
			<titleref href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616: 
			Hypertext Transfer Protocol -- HTTP/1.1</titleref>.
			Internet Engineering Task Force, 1999.
		</bibl>
		
		<bibl id="XInclude-note" key="XML Inclusion Proposal" href="http://www.w3.org/TR/1999/NOTE-xinclude-19991123">
			Jonathan Marsh, David Orchard, editors. 
			<titleref href="http://www.w3.org/TR/1999/NOTE-xinclude-19991123">XML 
			Inclusion Proposal (XInclude).</titleref>
			World Wide Web Consortium, 1999.
		</bibl>
		
		<bibl id="XLink" key="XML Linking Language" href="http://www.w3.org/TR/xlink/">
			Steve DeRose, Eve Maler, David Orchard, and Ben Trafford, editors. 
			<titleref href="http://www.w3.org/TR/xlink/">XML Linking Language (XLink).</titleref>
			World Wide Web Consortium, 2000.
		</bibl>
		
		<bibl id="XPointer" key="XPointer xpointer() Scheme" href="http://www.w3.org/TR/xptr-xpointer/">
			Steve DeRose, Ron Daniel, Eve Maler, editors.
			<titleref href="http://www.w3.org/TR/xptr-xpointer/">XPointer 
			xpointer() Scheme</titleref>.
			World Wide Web Consortium, 2002.
		</bibl>
		
		<bibl id="XPath" key="XPath 1.0" href="http://www.w3.org/TR/xpath">
			James Clark, Steve DeRose, editors.
			<titleref href="http://www.w3.org/TR/xpath">XML Path Language (XPath) 
			Version 1.0.</titleref>
			World Wide Web Consortium, 1999.
		</bibl>
		
		<bibl id="IRIdraft" key="IRI draft">
			<titleref>Internationalized Resource Identifiers (IRIs)</titleref>.
			Available at <loc href="http://www.w3.org/International/iri-edit/draft-duerst-iri-02.txt">http://www.w3.org/International/iri-edit/draft-duerst-iri-02.txt</loc>
		</bibl>
		
		<bibl id="CharMod" key="Character Model" href="http://www.w3.org/TR/charmod/">
			Martin J. D&#xFC;rst, Fran&#xE7;ois Yergeau, Misha Wolf, Asmus Freytag, Tex Texin.
			<titleref href="http://www.w3.org/TR/charmod/">Character Model for the 
			World Wide Web 1.0</titleref>.
			World Wide Web Consortium, 2001.
		</bibl>
		
		<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="XPointer-CR" key="XPointer" href="http://www.w3.org/TR/2001/CR-xptr-20010911/">
			Steve DeRose, Ron Daniel, Eve Maler, editors.
			<titleref href="http://www.w3.org/TR/2001/CR-xptr-20010911/">XML Pointer 
			Language (XPointer) Candidate Recommendation</titleref>.
			World Wide Web Consortium, 2001.
		</bibl>
		
		<bibl id="XSL-FO" key="XSL-FO" href="http://www.w3.org/TR/xsl/">
			Sharon Adler <emph>et al</emph>.
			<titleref href="http://www.w3.org/TR/xsl/">Extensible Stylesheet 
			Language (XSL)</titleref>.
			World Wide Web Consortium, 2001.
		</bibl>
		
		<bibl id="XHTML" key="XHTML" href="http://www.w3.org/TR/xhtml1/">
			Steven Pemberton <emph>et al</emph>.
			<titleref href="http://www.w3.org/TR/xhtml1/">XHTML 1.0 The Extensible 
			HyperText Markup Language (Second Edition)</titleref>.
			World Wide Web Consortium, 2002.
		</bibl>
	</blist>
</inform-div1>

<inform-div1 id="examples">

	<head>Examples</head>
	
	<div2 id="basic-example">

		<head>Basic Inclusion Example</head>

		<p>The following XML document contains an <code>xi:include</code> element 
		which points to an external document.  Assume the base URI of this document is
		<code>http://www.example.org/document.xml</code>.</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2003/XInclude">
  <p>120 Mz is adequate for an average home user.</p>
  <xi:include href="disclaimer.xml"/>
</document>]]></eg>
		
		<p>disclaimer.xml contains:</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<disclaimer>
  <p>The opinions represented herein represent those of the individual
  and should not be interpreted as official policy endorsed by this
  organization.</p>
</disclaimer>]]></eg>
		
		<p>The infoset resulting from resolving inclusions on this document
		is the same as that of the following document:</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2003/XInclude">
  <p>120 Mz is adequate for an average home user.</p>
  <disclaimer xml:base="http://www.example.org/disclaimer.xml">
  <p>The opinions represented herein represent those of the individual
  and should not be interpreted as official policy endorsed by this
  organization.</p>
</disclaimer>
</document>]]></eg>
	</div2>
	
	<div2 id="text-example">
	
		<head>Textual Inclusion Example</head>
	
		<p>The following XML document includes a "working example" into
		a document.</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2003/XInclude">
  <p>This document has been accessed
  <xi:include href="count.txt" parse="text"/> times.</p>
</document>]]></eg>
		
		<p>where count.txt contains:</p>
		
		<eg><![CDATA[324387]]></eg>
		
		<p>The infoset resulting from resolving inclusions on this document
		is the same as that of the following document:</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2003/XInclude">
  <p>This document has been accessed
  324387 times.</p>
</document>]]></eg>
	</div2>
	
	<div2 id="xml-as-text-example">
	
		<head>Textual Inclusion of XML Example</head>
	
		<p>The following XML document includes a "working example" into
		a document.</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2003/XInclude">
  <p>The following is the source of the "data.xml" resource:</p>
  <example><xi:include href="data.xml" parse="text"/></example>
</document>]]></eg>
		
		<p>data.xml contains:</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<data>
  <item><![CDATA[Brooks & Shields]]]]><![CDATA[></item>
</data>]]></eg>
		
		<p>The infoset resulting from resolving inclusions on this document
		is the same as that of the following document:</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2003/XInclude">
  <p>The following is the source of the "data.xml" resource:</p>
  <example>&lt;?xml version='1.0'?&gt;
&lt;data&gt;
  &lt;item&gt;&lt;![CDATA[Brooks &amp; Shields]]&gt;&lt;/item&gt;
&lt;/data&gt;</example>
</document>]]></eg>
	</div2>
	
	<div2 id="range-example">
	
		<head>Range Inclusion Example</head>
		
		<p>The following illustrates the results of including a range
		specified by an XPointer.  Assume the base URI of the document
		is <code>http://www.example.com/document.xml</code>.</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<document>
  <p>The relevant excerpt is:</p>
  <quotation>
    <include xmlns="http://www.w3.org/2003/XInclude"
       href="source.xml" xpointer="xpointer(string-range(chapter/p[1],'Sentence 2')/
             range-to(string-range(chapter/p[2]/i,'3.',1,2)))"/>
  </quotation>
</document>]]></eg>
		
		<p>source.xml contains:</p>
		
		<eg><![CDATA[<chapter>
  <p>Sentence 1.  Sentence 2.</p>
  <p><i>Sentence 3.  Sentence 4.</i>  Sentence 5.</p>
</chapter>]]></eg>
		
		<p>The infoset resulting from resolving inclusions on this document
		is the same as that of the following document:</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<document>
  <p>The relevant excerpt is:</p>
  <quotation>
    <p xml:base="http://www.example.com/source.xml">Sentence 2.</p>
  <p xml:base="http://www.example.com/source.xml"><i>Sentence 3.</i></p>
  </quotation>
</document>]]></eg>
	</div2>
	
	<div2 id="fallback-example">
	
		<head>Fallback Example</head>
	
		<p>The following XML document relies on the fallback mechanism to
		succeed in the event that the resources <code>example.txt</code> and
		<code>fallback-example.txt</code> are not available..</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<div>
  <xi:include href="example.txt" parse="text">
    <xi:fallback><xi:include href="fallback-example.txt" parse="text">
        <xi:fallback><a href="mailto:bob@example.org">Report error</a></xi:fallback>
      </xi:include></xi:fallback>
  </xi:include>
</div>]]></eg>
		
		<p>If neither <code>example.txt</code> nor <code>fallback-example.txt</code>
		are available, the result would be:</p>
		
		<eg><![CDATA[<?xml version='1.0'?>
<div>
  <a href="mailto:bob@example.org">Report error</a>
</div>]]></eg>
	</div2>
</inform-div1>

</back>

</spec>
