<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xmlspec-ie.xsl"?>
<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification Version 2.0//EN"
                      "xmlspec.dtd" [
<!ENTITY year "2002">
<!ENTITY month "September">
<!ENTITY MM "09">
<!ENTITY day "17">
<!ENTITY DD "17">
<!ENTITY MMDD "&MM;&DD;">
<!ENTITY includensuri "http://www.w3.org/2001/XInclude">
<!ENTITY XMLCore-IPR "http://www.w3.org/2002/08/xmlcore-IPR-statements">
<!ENTITY internalXInclude "http://www.w3.org/XML/Group/&year;/&MM;/CR-xinclude-&year;&MMDD;">
<!ENTITY externalXInclude "http://www.w3.org/TR/&year;/CR-xinclude-&year;&MMDD;">
<!ENTITY XInclude "&externalXInclude;">
<!ENTITY XInclude "&internalXInclude;">

<!-- 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>

<!ENTITY % local.loc.class      "|loc-content">

<!ELEMENT loc-content (#PCDATA|abbr)*>
<!ATTLIST loc-content
          href    CDATA             #IMPLIED>
<!ELEMENT abbr (#PCDATA)>
<!ATTLIST abbr
          lang    CDATA             #IMPLIED
          title    CDATA            #IMPLIED>

<!ENTITY copy   "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
<!ENTITY reg    "&#174;"> <!-- registered sign = registered trade mark sign,
                                  U+00AE ISOnum -->
]>
<spec w3c-doctype="cr">
<header>
  <title>XML Inclusions (XInclude)</title>
  <version>Version 1.0</version>
  <w3c-designation>xinclude-&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="&XInclude;">&XInclude;</loc>
  </publoc>
  <altlocs>
   <loc href="&XInclude;/CR-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-20020221/">http://www.w3.org/TR/2002/CR-xinclude-20020221/</loc>
   <loc href="http://www.w3.org/TR/2001/WD-xinclude-20010516/">http://www.w3.org/TR/2001/WD-xinclude-20010516/</loc>
   <loc href="http://www.w3.org/TR/2000/WD-xinclude-20001026/">http://www.w3.org/TR/2000/WD-xinclude-20001026/</loc>
   <loc href="http://www.w3.org/TR/2000/WD-xinclude-20000717">http://www.w3.org/TR/2000/WD-xinclude-20000717</loc>
   <loc href="http://www.w3.org/TR/2000/WD-xinclude-20000322">http://www.w3.org/TR/2000/WD-xinclude-20000322</loc>
   <loc href="http://www.w3.org/TR/1999/NOTE-xinclude-19991123">http://www.w3.org/TR/1999/NOTE-xinclude-19991123</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>
  <copyright>
    <p role="copyright">
    <loc href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Copyright">Copyright</loc>
    &nbsp; &copy; 2002  
    <loc-content href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></loc-content>
    <sup>&reg;</sup>
    (<loc-content href="http://www.lcs.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></loc-content>,
    <loc-content href="http://www.inria.fr/"><abbr lang="fr" title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr></loc-content>, 
    <loc href="http://www.keio.ac.jp/">Keio</loc>), All Rights Reserved.
    W3C <loc href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Legal_Disclaimer">liability</loc>,
    <loc href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#W3C_Trademarks">trademark</loc>,
    <loc href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</loc>
    and <loc href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</loc>
    rules apply.</p>
  </copyright>

  <status>
    <p>This document is a Candidate Recommendation of the World Wide Web 
    Consortium.  (For background on this work, please see the <loc 
    href="http://www.w3.org/XML/Activity">XML Activity Statement</loc>.) This 
    specification is considered stable by the <loc 
    href="http://www.w3.org/XML/Activity#core-wg">XML Core Working Group</loc> 
    and is available for public review.</p>
    
    <p>Feedback received during the 
    <loc href="http://www.w3.org/TR/2002/CR-xinclude-20020221/">first 
    Candidate Recommendation</loc> has prompted some features to
    be removed from the specification, namely, full namespace fixup, and 
    conformance to full <bibref ref="XPointer-CR"/> in favor of a lower level
    made possible by the factoring of XPointer into the <bibref ref="XPCore"/> 
    and separate fragment schemes.</p>
    
    <p>This second Candidate Reommendation provides an opportunity for these 
    changes to be reflected in implementations, and for the XML Core Working 
    Group to collect additional test cases and information about implementations.
    We expect that sufficient feedback to determine its future will have been received 
    by 1 November 2002. Comments on this document should be sent 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>). 
    Any feedback on patterns of implementation and use of this specification 
    would be very welcome.  The <loc href="http://www.w3.org/XML/Group/2002/09/xinclude-implementation">XInclude Implementation Report</loc>
    lists known implementations.  We also welcome contributions of XInclude test
    cases.  Comments on XPointer can also be reported against the XPointer 
    specifications.</p>

    <p>While we welcome implementation experience reports, the XML Core Working 
    Group will not allow early implementation to constrain its ability to make 
    changes to this specification prior to final release.</p>
    
    <p>The requirements used to guide the development of XInclude
    may be found in the <bibref ref="XInclude-note"/> W3C Note of 
    23 November 1999.</p>
  
    <p>Patent disclosures relevant to this specification may be found on the
    Working Group's <loc href="&XMLCore-IPR;">public patent disclosure page.</loc></p>
  
    <p>The English version of this specification is the only normative version. 
    However, for translations of this document, see 
    <loc href="http://www.w3.org/XML/#trans">http://www.w3.org/XML/#trans</loc>. 
    A list of current W3C Recommendations and other technical documents can be found at
    <loc href="http://www.w3.org/TR/">http://www.w3.org/TR/</loc>. W3C 
    publications may be updated, replaced, or obsoleted by other documents at any 
    time. In particular it is inappropriate to use W3C Working Drafts as reference 
    material or to cite them as other than "work in progress".</p>
  </status>

  <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>

  <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>
  <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 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/2001/XInclude"
           targetNamespace="http://www.w3.org/2001/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" type="xs:anyURI" use="required"/>
    <xs:attribute name="parse" use="optional" default="xml"
                  type="xi:parseType" />
    <xs:attribute name="encoding" type="xs:string" use="optional"/>
    <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>
  <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.  This attribute is required.</p>
      </def>
    </gitem>

    <gitem>
      <label>parse</label>
      <def>
        <p>An enumeration specifying whether to include the 
        resource as parsed XML or as text.  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>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>

  </glist>
  
  <p>Attributes from other namespaces <termref def="dt-must">may</termref> 
  be placed on the <code>xi:include</code> element.  Unqualified 
  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 content of the <code>xi:include</code> element 
  <termref def="dt-must">may</termref> include an 
  <code>xi:fallback</code> element.  Other content 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 analizing 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       #REQUIRED
    parse      (xml|text)  "xml"
    encoding   CDATA       #IMPLIED
&gt;</eg>

</div2>
 
<div2>
  <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>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>.
  <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 
  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 is interpreted as
    an IURI reference.  <termdef id="dt-iuri" term="internationalized URI reference">An
    <term>internationalized URI reference</term>, or <term>IURI</term>, 
    is a URI reference that directly uses <bibref ref="Unicode"/> characters.</termdef>
    IURI references allow a superset of the characters of fully escaped URI 
    references, but <termref def="dt-must">must</termref> have normal occurrences 
    of the percent sign (%) 
    escaped because it is the character used for escaping in URIs and IURIs.
    Also see <bibref ref="IURI"/> (non-normative).</p>
    
    <p>The base URI for relative IURIs 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 
    IURI resulting from resolution to absolute IURI form is called 
    the <term>include location</term>.</termdef></p>
    
    <p>The set of characters allowed in an <att>href</att> 
    attribute is the same as for XML, namely <bibref ref="Unicode"/>. 
    However, some Unicode characters are disallowed from URI references. 
    Thus the disallowed characters in URI references <termref def="dt-must">must</termref>
    ultimately be encoded and escaped by the XInclude or other processor 
    when the URI is resolved.</p>

    <div3>
      <head>URI Escaping</head>
      
      <p>The disallowed characters include all non-ASCII characters, 
      plus the excluded characters listed in Section 2.4 of 
      <bibref ref="RFC2396"/>, except for the number sign (#) and percent 
      sign (%) characters and the square bracket characters re-allowed 
      in <bibref ref="RFC2732"/>.  Disallowed characters are escaped as 
      follows:</p>

      <olist>
        <item><p>Each disallowed character is converted to UTF-8 <bibref ref="RFC2279"/>
          as one or more bytes.</p></item>
        <item><p>Any bytes corresponding to a disallowed character 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>
    </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 and the resource is fetched, coerced to text/xml, and an
    infoset is created.</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 unsuppored encoding,
    the resource is determined through implementation-specific mechanisms not 
    to be XML, or a syntax error in an <bibref ref="XPCore"/>)
    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>Note that 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>

		<ednote>
			<edtext>Reference to XPointer Framework as a definition of XPointer is somewhat 		unsatisfactory.</edtext>
		</ednote>

    <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>When the resource is coerced to text/xml, the fragment part of the URI 
    reference is interpreted as an XPointer, regardless of the media type of the resource.  
    The XPointer indicates 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"/> 
    <termref def="dt-must">must</termref> be supported.  XInclude processors optionally
    support other forms of XPointer such as that described in 
    <bibref ref="XPointer"/>.</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 <termref def="dt-include-location">include location</termref>
      might identify the <emph role="info-item">document information item</emph>
      (for instance, a URI reference without an XPointer, 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 <termref def="dt-include-location">include location</termref>
      having 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>
      
      <p>If the document (top-level) element in the source infoset is an 
      <code>xi:include</code> element, it is a 
      <termref def="dt-error">fatal error</termref> to attempt 
      to replace it with something other than a list of zero or more 
      comments, zero or more processing instructions, and one element.</p>

    </div3>

    <div3 id="ranges">
      <head>Range Locations</head>
      
      <p>An <termref def="dt-include-location">include location</termref>
      having 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 <termref def="dt-include-location">include location</termref>
      having 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 <termref def="dt-include-location">include location</termref>
      having 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> consists 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 <termref def="dt-include-location">include location</termref>
      having 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.  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 identifer) result in a 
    <termref def="dt-resource-error">resource error</termref>.</p>
    
    <p>The fetched resource is treated as plain text and converted to a 
    set of character information items without attempting to parse the 
    resource as XML.  This feature facilitates the inclusion of working 
    XML examples, as well as other text-based formats.</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><termdef id="dt-selected-range" term="selected range">A range 
    of characters (the <term>selected range</term>) <termref def="dt-must">may</termref> 
    be identified by a fragment identifier.</termdef>  The syntax of the fragment 
    identifier is interpreted using the syntax of the fragment 
    identifier for the media type text/plain.  In the absence of a 
    fragment identifier, the <termref def="dt-selected-range">selected 
    range</termref> contains all the characters in the resource except 
    the initial byte order mark (BOM) if one is present.  A BOM is the character
    U+FEFF when it appears as the first character in resource encoded in
    UTF-8, UTF-16 or UTF-32.  UTF-16BE and UTF-16LE will not contain a BOM.</p>
    
    <note>
      <p>There is currently no standard defining fragment identifiers
      for the media type text/plain.</p>
    </note>
    
    <p>The set of characters in the <termref def="dt-selected-range">selected 
    range</termref> is converted to a set of
    <termref def="dt-top-level-included-items">top-level included items</termref> 
    by creating a <emph role="info-item">character information item</emph> with the
    <emph role="infoset-property">character code</emph> set to the 
    character code representing the character in ISO 10646 encoding, and the
    <emph role="infoset-property">element content whitespace</emph> set to 
    false.</p>
    
    <p><bibref ref="CharMod"/> describes the required treatment of 
    non-normalized Unicode 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> 
    consists 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>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 href="#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-source-infoset">source infoset</termref>'s
      <emph role="info-item">document information item</emph>, if 
      it is not a duplicate of an existing member.</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.</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 the
          either <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 desireable, 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="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 fragment 
    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="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="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="Unicode" key="Unicode" href="http://www.unicode.org/unicode/standard/standard.html">
  The Unicode Consortium.
  <titleref href="http://www.unicode.org/unicode/standard/standard.html">The Unicode Standard.</titleref>
</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 David Megginson, 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>

<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="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>

</blist>
</div1>

<inform-div1>
<head>References</head>

<blist>
<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="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="IURI" key="Internationalized URIs" href="http://www.w3.org/International/2000/03/draft-masinter-url-i18n-05.txt">
  <titleref href="http://www.w3.org/International/2000/03/draft-masinter-url-i18n-05.txt">Internationalized URIs.</titleref>
  Internet Engineering Task Force, 2000.  Expired Internet-Draft.
</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>

</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/2001/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/2001/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/2001/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/2001/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/2001/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/2001/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/2001/XInclude"
       href="source.xml#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>
