<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xmlspec-ie-dm.xsl"?>
<!DOCTYPE spec SYSTEM "xmlspec.dtd" [
  <!ENTITY date.year "2001">
  <!ENTITY date.month "December">
  <!ENTITY date.MM "12">
  <!ENTITY date.day "20">
  <!ENTITY date.DD "20">
  <!ENTITY doc.date "&date.year;&date.MM;&date.DD;">
  <!ENTITY doc.prefix "WD-query-datamodel">
  <!ENTITY url.group "http://www.w3.org/XML/Group/">
  <!ENTITY url.group.ql "&url.group;xmlquery/">
  <!ENTITY url.publoc "&url.group;&date.year;/&date.MM;/&doc.prefix;-&doc.date;.html">
  <!ENTITY url.internal "http://www.w3.org/Style/XSL/Group/xpath2-tf/&doc.prefix;-&doc.date;.html">
  <!ENTITY url.external "http://www.w3.org/TR/&date.year;/&doc.prefix;-&doc.date;/">
  <!ENTITY url.this "&url.external;">
  <!ENTITY aacute "&#225;">
  
  <!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 -->

  <!ATTLIST issue
            date     CDATA             #IMPLIED
            raisedby CDATA             #IMPLIED>
  <!ENTITY % local.p.class        "| description | suggestion">
  <!ATTLIST resolution
            date     CDATA             #IMPLIED>
  <!ELEMENT description (p | olist | eg)+>
  <!ATTLIST description         
            id       ID                #IMPLIED
            role     NMTOKEN           #IMPLIED>
  <!ELEMENT suggestion (p)+>
  <!ATTLIST suggestion
            id       ID                #IMPLIED
            role     NMTOKEN           #IMPLIED>
]>
<spec w3c-doctype="wd">

<header>
  <title>XQuery 1.0 and XPath 2.0 Data Model</title>
  <version/>
  <w3c-designation>&doc.prefix;-&doc.date;</w3c-designation>
  <w3c-doctype>W3C Working Draft</w3c-doctype>
  <pubdate>
    <day>&date.day;</day>
    <month>&date.month;</month>
    <year>&date.year;</year>
  </pubdate>
  <publoc>
   <loc href="&url.this;">&url.this;</loc>
   <loc role="available-format" href="&url.this;Overview.html">HTML</loc>
   <loc role="available-format" href="&url.this;Overview.xml">XML</loc>
  </publoc>
  <latestloc>
    <loc href="http://www.w3.org/TR/query-datamodel/">http://www.w3.org/TR/query-datamodel/</loc>
  </latestloc>
  <prevlocs role="private">
    <loc href="http://www.w3.org/TR/2001/WD-query-datamodel-20010607/">http://www.w3.org/TR/2001/WD-query-datamodel-20010607/</loc>
    <loc href="http://www.w3.org/TR/2001/WD-query-datamodel-20010215/">http://www.w3.org/TR/2001/WD-query-datamodel-20010215/</loc>
  </prevlocs>
  <authlist>
    <author>
      <name>Mary Fern&aacute;ndez (XML Query WG)</name>
      <affiliation>AT&amp;T Labs</affiliation>
      <email href="mailto:mff@research.att.com">mff@research.att.com</email>
    </author>
    <author>
      <name>Jonathan Marsh (XSL WG)</name>
      <affiliation>Microsoft</affiliation>
      <email href="mailto:jmarsh@microsoft.com">jmarsh@microsoft.com</email>
    </author>
    <author>
      <name>Marton Nagy (XML Query WG)</name>
      <affiliation>Science Applications International Corporation (SAIC)</affiliation>
      <email href="mailto:marton.nagy@saic.com">marton.nagy@saic.com</email>
    </author>
  </authlist>
  <copyright>
    <p role="copyright">
    <loc href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Copyright">Copyright</loc>
    &nbsp; &copy; 2001  
    <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 section describes the status of this document at the time of its
    publication. Other documents may supersede this document. The latest status
    of this document series is maintained at the W3C.</p>

    <p>This is a Public Working Draft for review by W3C Members and 
    other interested parties. It is a draft document and may be updated, 
    replaced or made obsolete by other documents at any time. It is 
    inappropriate to use W3C Working Drafts as reference material or to 
    cite them as other than "work in progress". This is work in progress 
    and does not imply endorsement by the W3C membership.</p>

    <p>This document has been produced as part of the <bibref ref="xml-activity"/>, 
    following the procedures set out for the W3C Process. The document has 
    been written by the <bibref ref="XSLWG"/> and <bibref ref="XQWG"/>.</p>

    <!-- <p>The XSL and XML Query Working Groups feel that the contents of 
    this Working Draft are reasonably stable, and therefore encourages 
    feedback.</p> -->

    <p>Comments on this document should be sent to the W3C mailing list <loc href="mailto:www-xml-query-comments@w3.org">www-xml-query-comments@w3.org</loc>.
    (archived at <loc href="http://lists.w3.org/Archives/Public/www-xml-query-comments/">http://lists.w3.org/Archives/Public/www-xml-query-comments/</loc>).
    </p>

    <p>A list of current W3C Recommendations and other technical documents 
    can be found at <loc href="http://www.w3.org/TR/">http://www.w3.org/TR/</loc>.</p>
  </status>
  
  <abstract>
    <p>This document defines the W3C XQuery 1.0 and XPath 2.0 Data 
    Model, which is the data model of at least <bibref ref="XSLT2"/>, 
    and <bibref ref="XQuery"/>, 
    and any other specifications that reference it.  This data model 
    is based on the data models of <bibref ref="XPath"/> and 
    <bibref ref="XQDM00"/> and replaces <bibref ref="XQDM00"/>.    This document is the result of joint work by the     <bibref ref="XSLWG"/> and the <bibref ref="XQWG"/>.</p>
  </abstract>
  
  <langusage>
    <language id="en">English</language>
  </langusage>

  <revisiondesc role="public">
    <p>JM: 11-December-2001.
      <ulist>
        <item>
          <p>Fixed links, minor editorial issues, updated example section,          reorganized appendices.</p>
        </item>
      </ulist>
    </p>
    <p>MN: 5-December-2001.
      <ulist>
        <item>
<p>Renamed some functions/operators to align with the F&amp;O
document: xf:concat, op:value-equals, op-item-at, op:concatenate.</p>
        </item>
        <item>
<p>Editorial: Slightly modified the definition of value categories in
Section 1 and added examples of values that can be represented by the
data model. Added a note on using elment constructors with heterogeneous
sequences in Section 4.2. Added a note to Sections 4.2 and 4.3 to
signal that we are actively working on the resolution of Issue-0036.
</p>
        </item>
        <item>
<p>Updated the section on simple typed values (formerly called simple
values). Clarified the terminology used. Got rid of the subsections
explaining Primitive Values and Derived Simple Values and merged
some of that content into the main section. Defined a second
constructor parallel to the two constructors of elements and
attributes and specified that the canonical lexical representation
is to be used when applying the string-value accessor.</p>
        </item>
        <item>
<p>Defined the canonical lexical representation for a sequence of
simple typed values. </p>
        </item>
        <item>
          <p>Closed the issues <specref ref="Issue-0027"/>,
          <specref ref="Issue-0046"/>, <specref ref="Issue-0065"/>,
			 <specref ref="Issue-0055"/>.
          </p>
        </item>
        <item>
          <p>Added the issues <specref ref="Issue-0067"/>,
          <specref ref="Issue-0068"/>, <specref ref="Issue-0069"/>,
          <specref ref="Issue-0070"/>, <specref ref="Issue-0071"/>.
          </p>
        </item>
      </ulist>
    </p>
    <p>JM: 29-November-2001.
      <ulist>
        <item>
          <p>Added issue:
            <specref ref="Issue-0066"/>
          </p>
        </item>
      </ulist>
    </p>
    <p>JM: 19-November-2001.
      <ulist>
        <item>
          <p>Added issue:
            <specref ref="Issue-0065"/>
          </p>
        </item>
      </ulist>
    </p>
    <p>MN: 11-November-2001.
      <ulist>
        <item>
          <p>Continued updates relating to the treatment of common accessors.
          (In particular removed the prefix and namespace-uri accessors of a
          NamespaceNode.) Fixed sequence-accessor related inconsistencies
          between the data model and the Functions and Operators document:
          Updated the sequence sections and code samples to use the accessors
          defined in the F&amp;O document. Added references to sequence and
          QName accessor functions defined in the F&amp;O document.
          Modified the urls in the examples to use www.example.com.</p>
        </item>
        <item>
          <p>Closed issues:
            <specref ref="Issue-0053"/>
          </p>
        </item>
      </ulist>
    </p>
    <p>JM: 4-November-2001.
      <ulist>
        <item>
          <p>Closed issues:
            <specref ref="Issue-0005"/>, 
            <specref ref="Issue-0007"/>, 
            <specref ref="Issue-0043"/>
          </p>
        </item>
      </ulist>
    </p>
    <p>JM: 16-October-2001.
      <ulist>
        <item>
          <p>Added issues:
            <specref ref="Issue-0051"/>, 
            <specref ref="Issue-0052"/>, 
            <specref ref="Issue-0053"/>,
            <specref ref="Issue-0054"/>,
            <specref ref="Issue-0055"/>,
            <specref ref="Issue-0056"/>,
            <specref ref="Issue-0057"/>,
            <specref ref="Issue-0058"/>,
            <specref ref="Issue-0059"/>,
            <specref ref="Issue-0060"/>,
            <specref ref="Issue-0061"/>,
            <specref ref="Issue-0062"/>,
            <specref ref="Issue-0063"/>,
            <specref ref="Issue-0064"/>
          </p>
        </item>
      </ulist>
    </p>
    <p>JM: 17-August-2001.
      <ulist>
        <item>
          <p>Implemented editorial changes requested in
          <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Aug/0066.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Aug/0066.html</loc>
          and <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Aug/0099.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Aug/0099.html</loc>.</p>
        </item>
        <item>
          <p>Resolved issues:
            <specref ref="Issue-0001"/>, 
            <specref ref="Issue-0003"/>, 
            <specref ref="Issue-0015"/>, 
            <specref ref="Issue-0018"/>, 
            <specref ref="Issue-0020"/>, 
            <specref ref="Issue-0021"/>
          </p>
        </item>
        <item>
          <p>Added issues:
            <specref ref="Issue-0033"/>, 
            <specref ref="Issue-0034"/>, 
            <specref ref="Issue-0035"/>, 
            <specref ref="Issue-0036"/>, 
            <specref ref="Issue-0037"/>, 
            <specref ref="Issue-0038"/>, 
            <specref ref="Issue-0039"/>, 
            <specref ref="Issue-0040"/>, 
            <specref ref="Issue-0041"/>, 
            <specref ref="Issue-0042"/>, 
            <specref ref="Issue-0043"/>, 
            <specref ref="Issue-0044"/>, 
            <specref ref="Issue-0045"/>, 
            <specref ref="Issue-0046"/>, 
            <specref ref="Issue-0047"/>, 
            <specref ref="Issue-0048"/>, 
            <specref ref="Issue-0049"/>, 
            <specref ref="Issue-0050"/>
          </p>
        </item>
      </ulist>
    </p>
    
    <p>JM: 25-May-2001.
      <ulist>
        <item>
          <p>Updated stylesheet to derive from common xmlspec.xsl.</p>
        </item>
        <item>
          <p>Removed dependency on xmlquery-algebra.dtd, now extends xmlspec.dtd
          via internal subset.</p>
        </item>
        <item>
          <p>Added copyright to XML source.</p>
        </item>
        <item>
          <p>Removed mention of XPointer in the abstract.</p>
        </item>
      </ulist>
    </p>

    <p>MF: 17-May-2001.
    Per F2F discussion, tentative title 'XQuery 1.0 and XPath 2.0 Data Model'.
    Added <specref ref="Issue-0031"/>, <specref ref="Issue-0032"/>.</p>
    
    <p>MF: 02-May-2001.
      <ulist>
        <item>
          <p>Added <specref ref="textnodes"/> to explain relationship 
          between text nodes and simple-typed values.  See also 
          <specref ref="Issue-0027"/>.</p>
        </item>
        <item>
          <p>Added <specref ref="flags"/>.</p>
        </item>
        <item>
          <p>Added bounded Sequences as suggested by Michael Kay in 
          <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0316.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0316.html</loc>
          to model partial functions.</p>
        </item>
      </ulist>
    </p>
    
    <p>JM and MF: 27-Apr-2001.  
      <ulist>
        <item>
          <p>Integrated relationship of data model to Information Set 
          into subsections.</p>
        </item>
        <item>
          <p>Distributed pseudo-code of Infoset mapping in subsections.</p>
        </item>
        <item>
          <p>Addressed Mike Kay's issues in 
          <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0222.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0222.html</loc></p>
        </item>
        <item>
          <p>Added 'schema component' values that correspond to 
          components in <bibref ref="XSFD"/> as suggested by James 
          Clark in <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0234.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0234.html</loc>. 
          Currently, schema components are values, not nodes. See 
          <specref ref="Issue-0026"/>.</p>
        </item>
        <item>
          <p>Resolved issues <specref ref="Issue-0006"/>, 
          <specref ref="Issue-0013"/>, <specref ref="Issue-0014"/>, 
          <specref ref="Issue-0016"/>, <specref ref="Issue-0017"/>.
          Added issues <specref ref="Issue-0025"/>, 
          <specref ref="Issue-0026"/>.</p>
        </item>
      </ulist>
    </p>
 
    <p>MF: 27-Mar-2001.
    Major revision based on <bibref ref="XQDM00"/>.  Major changes 
    are detailed in:
    <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Mar/0350.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Mar/0350.html</loc>. 
    They include:
      <ulist>
        <item>
          <p><emph>Terminology</emph>.   'Sequence' replaces 'ordered forest'.
          All node constructors have complete names, e.g., 
          'AttributeNode' replaces 'AttrNode', 'ProcessingInstructionNode' 
          replaces 'PINode', etc.</p>
        </item>
        <item>
          <p><emph>Notation</emph>.  'Sequence&lt;ElementNode&gt;' replaces 
          '[ ElementNode ]'.  The XPath 2.0 task force agreed this 
          notation for collections would be more familiar to 
          programmers.</p>
        </item>
        <item>
          <p><emph>Conceptual</emph>. TextNodes replace ValueNodes. A primary 
          requirement of XSLT is to have access to the original 
          lexical representation of the XML document, including the 
          children of elements that are text nodes.  To support this 
          requirement, TextNodes have been added to the data model. 
          See <specref ref="textnodes"/>.</p>
          <p>ValueNodes have been eliminated.  Access to the Schema 
          simple-typed values of an element or attribute are provided 
          by the typed-value() accessor (See <specref ref="ElementNode"/>).
          The typed value of an element or attribute is derived from 
          the Schema normalized value in the PSV Infoset.</p>
          <p>This change guarantees access to the original lexical 
          form of the document.  It is not always possible to compute 
          the original lexical form from a typed simple value, but it 
          is always possible to compute the simple value from the 
          lexical form provided in the Schema normalized value in the 
          PSV Infoset.</p>
          <p>This introduces some awkwardness into the formal 
          semantics of XQuery, because when constructing a new element,  
          every simple value is (logically) converted into a text node.  
          For example, the XQuery value:</p>
          <p role="definition">&lt;a&gt;{ [1, 2] }&lt;/a&gt;</p>
          <p>is constructed by the data model expression:</p>
          <p role="definition">elementNode(qname(empty_sequence(), "a"), 
          empty_sequence(), empty_sequence(), text-node("1 2"))</p>
          <p>Applying typed_value() to the expression above yields:</p>
          <p role="definition">Sequence&lt; simpleValue(1, xs:integer), 
          simpleValue(2, xs:integer) &gt;</p>
        </item>
        <item>
          <p><emph>Conceptual</emph>: separating element construction from 'schema 
          processing'.  Currently, the elementNode constructor takes 
          both the content of the element and the runtime 
          representation of the element's type, called a 
          <emph>SchemaComponent</emph> James suggested separating 
          element construction from 'schema processing', i.e., 
          associating a runtime type with the constructed element.  
          Jerome says this better reflects what happens in an 
          implementation.</p>
          <p>Note that this is a conceptual data model only: this 
          model makes text nodes 'first class', but an implementation 
          could choose to make simple values 'first class' and 
          reconstruct text nodes on demand. This data model eliminates 
          many of the problems with the XML Query data model: 
          providing access to the original lexical form; handling 
          comments and PIs interleaved with simple values.  Overall, it 
          seems to strike a reasonable compromise of the needs of XSLT 
          and XQuery.</p>
        </item>
      </ulist>
    </p>
  </revisiondesc>
</header>

<body>

<div1>
  <head>Introduction</head>

  <p>This document defines the XQuery 1.0 and XPath 2.0 Data Model, 
  which is the data model of <bibref ref="XSLT2"/> and 
  <bibref ref="XQuery"/> 1.0.</p>

  <p>The XQuery 1.0 and XPath 2.0 Data Model (henceforth "data model") 
  serves two purposes.
  First, it defines precisely the information contained in the input to an 
  XSLT or XQuery processor.  Second, it defines all permissible values of 
  expressions in the XSLT, XQuery, and XPath languages.  A 
  language is <emph>closed</emph> with respect to a data model if the value 
  of every expression in a language is guaranteed to be in the data model. 
  XSLT 2.0, XQuery 1.0, and XPath 2.0 are all closed with respect to
  the data model.</p>
  
  <p>The data model is based on the <bibref ref="xml-infoset"/>
  (henceforth "Infoset"), but it requires the following new features to
  meet the <bibref ref="XPathReq"/> and <bibref ref="XQueryReq"/>:</p>
  
  <ulist>
    <item>
      <p>Support for XML Schema types. The XML Schema recommendations 
      define features, such as structures (<bibref ref="xmlschema-1"/>)
      and simple data types (<bibref ref="xmlschema-2"/>), that extend  
      the XML Information Set with precise type information.</p>
    </item>
    <item>
      <p>Representation of collections of documents and of 
      complex values. (<bibref ref="XQueryReq"/>)</p>
    </item>
  </ulist>

  <p>As with the Infoset, the XQuery 1.0 and XPath 2.0 Data Model 
  specifies what 
  information in the documents is accessible, but it does not specify
  the programming-language interfaces or bindings used to represent or 
  access the data.</p>

  <p><termdef id="dt-value-category" term="value category">Values in 
  the data model fall into four non-overlapping <term>value categories</term>: 
  <emph>nodes</emph>, <emph>simple typed values</emph>, 
  <emph>error</emph>, and <emph>schema components</emph>.
  Additionally we distinguish a fifth overlapping value category,
  <emph>sequences</emph>, which includes nodes and simple typed values, given
  the convention that a node or a simple typed value is identified with a one
  element sequence containing it.</termdef> 

  A node is defined in <specref ref="Node"/> and is one of seven node kinds.
  A simple typed value encapsulates an XML Schema simple type
  and a corresponding value of that type. They are defined in
  <specref ref="simpletypedvalue"/>.
  A sequence is an ordered collection of nodes, simple typed values, or any 
  mixture of nodes and simple typed values.  A sequence cannot be a member of 
  a sequence.  Sequences are defined in <specref ref="sequences"/>.  The 
  <emph>error</emph> value is defined in <specref ref="error"/>.  A 
  <emph>schema component</emph> represents the type of an element node, 
  attribute node, or simple typed value, and are defined in 
  <specref ref="types"/>.</p>
  
  <note>
    <p>In XPath 1.0, the data model only
    defines nodes.  The primitive data types (number, boolean, string,
    node-set) are part of the expression language, not 
    the data model.</p>
  </note>

  <p>Given the above value categories the data model can represent various
  values including not only the input and the output of a query, but all
  values of expressions used during the intermediate calculations.
  Examples include the input document or document repository (represented
  as a document node or a sequence of document nodes), the result of a
  path expression (represented as a sequence of nodes), the result of an
  arithmetic or a logical expression (represented as a simple typed value),
  a sequence expression resulting a sequence of integers, dates, QNames or
  other XML Schema simple typed values (represented as a sequence of
  simple typed values), etc.
  Examples of values that cannot be expressed directly by the data model
  include sequences containing schema components, sets containing both
  simple typed values and the error value, simple typed values whose type
  is not an XML Schema simple type, etc.
  </p>

  <p>In this document, we provide a precise definition of how values in the 
  XQuery 1.0 and XPath 2.0 Data Model are constructed and accessed, and how
  they relate to values in the Infoset.  We note wherever the XQuery 1.0 and 
  XPath 2.0 Data Model differs from that of XPath 1.0.</p>
  
</div1>

<div1>
  <head>Notation and Pseudo-code Syntax</head>

  <p>In addition to using prose, we define the data model using a functional 
  notation.  We chose this notation because it is simple and permits a 
  precise definition of the data model, suitable for use by the formal
  semantics of XQuery.  Although the notation has a functional style, we 
  emphasize that the data model can be realized in a variety of 
  programming languages and styles, for example, as object classes and 
  methods in an object-oriented language.</p>

  <p>Pseudo-code syntax is highlighted as follows:</p>

  <p role="definition">f : (x) -> y</p>

  <p>In the psuedo-code syntax, the term <emph>Node</emph> denotes
  the category of node values, <emph>SimpleTypedValue</emph> denotes the 
  category of simple typed values, and <emph>UnitValue</emph> refers to the
  category of either node values or simple typed values.  The term
  <emph>SchemaComponent</emph> denotes the category of schema component 
  values. <emph>Sequence&lt;V&gt;</emph> denotes the category of sequence 
  values all of whose members are in category <emph>V</emph>.  In a 
  sequence, <emph>V</emph> may be a <emph>Node</emph> or 
  <emph>SimpleTypedValue</emph>, or the union (choice) of several categories of 
  <emph>UnitValues</emph>. For example, the following denotes a category of 
  sequence containing any combination of comment and processing instruction 
  nodes:</p>
  
  <p role="definition">Sequence&lt;<loc href="#CommentNode">CommentNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc>&gt;</p>
  
  <p>There are some functions in the data model that are <emph>partial
  functions</emph>, for example, a node may have one parent node or no 
  parent.  We use <emph>bounded</emph> sequences, 
  <emph>Sequence(m,n)&lt;V&gt;</emph>, to denote a sequence of at least 
  <emph>m</emph> and at most <emph>n</emph> <emph>V</emph> values.
  The unbounded sequence <emph>Sequence&lt;V&gt;</emph> is
  equivalent to <emph>Sequence(0,*)&lt;V&gt;</emph>, where <emph>*</emph> 
  denotes unbounded.  For example, if the node argument has a parent, the 
  <emph>parent</emph> accessor returns a singleton sequence.  If the node
  argument does not have a parent, it returns the empty sequence.
  The signature of <emph>parent</emph> specifies that it returns
  an empty sequence or a sequence containing one element or document node:</p>

  <p role="definition">parent : (<loc href="#Node">Node</loc>) -> Sequence(0,1)&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#DocumentNode">DocumentNode</loc>&gt;</p>

  <p>The pseudo-code syntax defines functions to construct values, 
  called <emph>constructors</emph>; and functions to access parts of 
  values, called <emph>accessors</emph> (see <specref ref="Issue-0033"/>).</p>
  
<!-- JM- commented out since there aren't actually any constraint expressions!

  We use <emph>constraint expressions</emph> to specify precisely the
  relationships between a constructed value and the values returned by
  its accessors.  For example, this constraint states that 
  the value returned by an element node's <emph>name</emph> accessor
  is always equal to the name argument of the <emph>infoitem-to-element-node</emph> constructor.
  </p>
  <p role="definition">name(infoitem-to-element-node(q, n, a, c, sc)) = q</p>
  <p>This constraint is obvious : we would like an element's name to be
  the same as the one it was constructed to have. 
  Some constraints, however, are not obvious.  For example,
  the order of an element node's attributes 
  do not have to be preserved by its constructor.
  Constraint expressions follow the definitions of constructors and
  accessors.</p>
-->

  <note><p>The XPath 1.0 data model defines accessors, but does not
  define constructors.</p></note>

  <p>The term <emph>signature</emph> of a function specifies the 
  <termref def="dt-value-category">value category</termref>
  of its zero or more inputs and the value category of its one 
  output. The following signature denotes a function <emph>f</emph> that 
  takes values in the categories <emph>V</emph><sub>1</sub>, ..., 
  <emph>V</emph><sub>m</sub> and returns an output value in the category 
  <emph>V</emph><sub>n</sub> (see <specref ref="Issue-0067"/>).</p>

  <p role="aside">f : (<emph>V</emph><sub>1</sub>, ..., <emph>V</emph><sub>m</sub>) -> <emph>V</emph><sub>n</sub></p>

  <p>A member of a particular category is a permissible argument to any 
  function that accepts the category, for example, a 
  <emph>ProcessingInstructionNode</emph> is a permissible argument to a
  function expecting a <emph>Node</emph>.</p>

  <p>This document relies on the <bibref ref="xml-infoset"/>. Information items 
  and properties are indicated by the styles <emph role="info-item">information 
  item</emph> and <emph role="infoset-property">property</emph>, respectively.</p>

  <p>This document also provides pseudo-code syntax describing the mapping
  from the Infoset to the data model.  To facilitate this we introduce accessors
  to the required infoset properties through <emph>InfoItem</emph> objects.
  These infoset accessors are for rhetorical purposes only and are not intended to be exposed outside this
  specification.  We name the accessors of the Infoset using the convention 
  infoset-&lt;<emph>item-name</emph>&gt;-&lt;<emph>property-name</emph>&gt;.  
  Similarly, accessor functions that return PSV Infoset properties use the 
  naming convention psvi-&lt;<emph>item-name</emph>&gt;-&lt;<emph>property-name</emph>&gt;.
  For example, <code>infoset-element-attributes</code> is the accessor that 
  returns an element information item's <emph role="infoset-property">attributes</emph> 
  property:</p>

  <p role="definition">infoset-element-attributes : (<loc href="#ElementItem">ElementItem</loc>) -> Sequence&lt;<loc href="#AttributeItem">AttributeItem</loc>&gt;</p>

  <p>An <emph>InfoItem</emph> is one of eleven kinds of item: document 
  item, element item, attribute item, processing instruction item, 
  unexpanded entity item, character item, comment item, doctype item, 
  unparsed entity item, notation item, and namespace item.</p>

  <p>The <emph>infoitem-kind</emph> accessor
  returns a string value representing the information item's kind, either 
  <code>"document"</code>, <code>"element"</code>, <code>"attribute"</code>, 
  <code>"character"</code>, <code>"namespace"</code>, 
  <code>"processing-instruction"</code>, <code>"comment"</code>, <code>"doctype"</code>,
  <code>"notation"</code>, or <code>"unparsed-entity"</code>.</p>

  <p role="definition" id="InfoItem">infoitem-kind  : (InfoItem) -> <loc href="#dt-simple-typed-value">xs:string</loc></p> 

  <p>Throughout this document, the namespace prefix <code>xs</code> indicates
  the <bibref ref="xmlschema-1"/> namespace name 
  <code>http://www.w3.org/2001/XMLSchema</code>.
  The namespace prefixes <code>xf</code> and <code>op</code> indicate
  the namespace of the functions and operators defined in
  <bibref ref="XFO"/>.They are associated with the namespace names
  <code>http://www.w3.org/2001/12/xquery-functions</code> and
  <code>http://www.w3.org/2001/12/xquery-operators</code> respectively.</p>
  
  <p>The following functions and operators are defined in
  <bibref ref="XFO"/>:</p>

  <ulist>
    <item><p id="xf_anyURI">xf:anyURI</p></item>
    <item><p id="xf_concat">xf:concat</p></item>
    <item><p id="xf_integer">xf:decimal</p></item>
    <item><p id="xf_NCName">xf:NCName</p></item>
    <item><p id="xf_node-equal">xf:node-equal</p></item>
    <item><p id="xf_QName">xf:QName</p></item>
    <item><p id="xf_QName-from-uri">xf:QName-from-uri</p></item>
    <item><p id="xf_get-local-name">xf:get-local-name</p></item>
    <item><p id="xf_get-namespace-uri">xf:get-namespace-uri</p></item>
    <item><p id="xf_string">xf:string</p></item>
    <item><p id="op_value-equal">op:value-equal</p></item>
    <item><p id="op_concatenate">op:concatenate</p></item>
    <item><p id="xf_count">xf:count</p></item>
    <item><p id="xf_empty">xf:empty</p></item>
    <item><p id="op_item-at">op:item-at</p></item>
    <item><p id="xf_sublist">xf:sublist</p></item>
  </ulist>
</div1>

<div1>
  <head>Concepts</head>
  <div2>
    <head>Node Identity</head>

    <p>Because XML documents are tree-structured, we define the 
    data model using conventional terminology for trees.  The data model is 
    a node-labeled, tree-constructor representation, but also includes a 
    concept of node identity.  The identity of a node is established 
    when a node-constructor is applied to create the node: each 
    application of a node constructor creates a new node that is 
    identical to itself, and not identical to any other node
    (see <specref ref="Node"/>).</p>
    
    <p>This concept should not be confused with the concept of
    <emph>unique ID</emph>, which is a unique name assigned to an
    element by the author to represent references using ID/IDREF
    correlation.</p>
  </div2>
  
  <div2>
    <head>Document Order</head>
      
    <p>A <emph>document order</emph> is defined on all the nodes in a 
    document.  The document node is the first node.  Element nodes, 
    comment nodes, and processing instruction nodes occur in the 
    order of their representation in the XML (after expansion of 
    entities).  Element nodes occur before their children.  The 
    namespace nodes of an element immediately follow the element node
    (see <specref ref="Issue-0051"/>).
    The relative order of namespace nodes is implementation-dependent. 
    The attribute nodes of an element immediately follow the 
    namespace nodes of the element. The relative order of attribute 
    nodes is implementation-dependent. Reverse document order is the 
    reverse of document order.</p>

    <p>The relative order of nodes in distinct documents is 
    implementation-dependent but stable.  In other words, given 
    two distinct documents A and B, if a node in document A is 
    before a node in document B, then every node in document A 
    is before every node in document B.</p>

    <note><p>The relative order of free-floating nodes (those not in
    a document) is not defined.  See <specref ref="Issue-0050"/>.</p></note>

  </div2>
  
  <div2 id="psv">
    <head>XML Schemas and the XML Information Set</head>

<!-- dynamic typing
     free-floating nodes
     abstract type - no type-name. -->
     
    <p>The data model is defined in terms of the 
    <bibref ref="xml-infoset"/> after XML Schema validity assessment.
    XML Schema validity assessment is the process of assessing an XML
    element information item with respect to an XML Schema and
    augmenting it and some or all of its descendants with properties
    that provide information about validity and type assignment.
    The result of schema validity assessment is an augmented
    Infoset, known as the Post Schema-Validation Infoset, or
    PSVI.  
    </p>

    <p>The data model supports the following classes of XML documents:</p>

    <ulist>
      <item>
        <p>Schema-validated documents, i.e., those validated with respect 
        to a schema,</p>
      </item>
      <item>
        <p>DTD-valid documents, i.e., those documents validated with respect 
        to a DTD, and </p>
      </item>
      <item>
        <p>Well-formed documents with no corresponding DTD or schema.</p>
      </item>
    </ulist>

    <p>The data model does not support XML documents that are not supported by
    the XML Information Set, for example, non-well-formed documents and documents
    that don't conform to XML Namespaces.</p>
    
    <p>Schema-validated documents include documents in which some elements 
    or attributes have been validated by "lax" or "skip" validation 
    (<bibref ref="xmlschema-2"/>).</p>
    
    <p>An "incompletely validated document" is an XML document that has a
    corresponding schema but whose schema-validity assessment has resulted 
    in one or more element or attribute information items being assigned 
    values other than 'valid' for the <emph role="infoset-property">validity</emph>
    property in the PSVI.</p>

    <p>The data model supports incompletely validated documents.  <specref
    ref="types"/> specifies how such documents are represented in
    the data model.  See <specref ref="Issue-0024"/>.</p>

    <note><p>This implies accommodation for the case where 
    both a DTD and a schema are applied.  This will probably require some
    reconciliation of the [attribute type] property with type 
    information from the PSVI.  See issue <specref ref="Issue-0004"/>.</p></note>

  </div2>
  
  <div2>
    <head>Schema Components and Values</head>

    <p id="def-type">
    The <bibref ref="XSFD"/> (henceforth "XSFD") is a formal, declarative system for
    describing and naming XML Schema information, specifying XML
    instance type information, and validating instances against
    schemas.  XSFD includes a component model that defines four
    <emph>schema components</emph> (<emph>element</emph>, <emph>attribute</emph>, 
    <emph>simple type</emph>, and <emph>complex type</emph>), and
    it defines the mapping from the XML Schema component model to the XSFD
    model.  In addition, it specifies "normalized, universal" names
    for all components of an XML Schema, so that they can be uniquely
    identified by URIs.</p>

    <p>The data model provides a representation for schema components,
    which are used to represent the types of values.  All element nodes, 
    attribute nodes, and simple typed values have an associated schema component.  
    We use the term <emph>SchemaComponent</emph> to collectively refer to 
    the data model's schema component values <emph>element-declaration</emph>,
    <emph>attribute-declaration</emph>, <emph>simple-type-definition</emph>, 
    and <emph>complex-type-definition</emph>.  The accessors for schema components 
    are defined in <specref ref="types"/>.  The schema component of element and
    attribute nodes is derived from the PSV Infoset additions of the nodes' 
    corresponding element and attribute information items.</p>

    <p> A schema <emph>simple type</emph> consists of a lexical space,
    a value space, and a set of facets <bibref ref="xmlschema-2"/>.
    A simple type is either <emph>primitive</emph> (e.g., <emph>xs:string,
    xs:boolean, xs:float, xs:double</emph>) or
    <emph>derived</emph> (e.g., <emph>xs:language, xs:NMTOKEN,
    xs:long</emph>, xs:ID, xs:IDREF, etc., or user defined).  If a simple typed value is in the
    value space of the simple type, we say a simple typed value is an 
    <emph>instance</emph> of a schema simple type.  Because the value 
    spaces of schema simple types may overlap, a simple typed value may be an 
    instance of more than one schema simple type; e.g., an instance of
    <emph>xs:integer</emph> is  also an instance of a <emph>xs:long</emph>.
    </p>

    <p>A schema <emph>complex type</emph> defines the permissible
    structure and content of an element <bibref ref="xmlschema-1"/>.</p>

    <p>A schema <emph>attribute declaration</emph> specifies an
    attribute's name and the simple type of its value.</p>
    
    <p>A schema <emph>element declaration</emph> specifies an
    element's name and the simple or complex type of its content.</p>

  </div2>

<div2 id="textnodes">
  <head>Text Nodes and Simple-Typed Values</head>

  <p>The data model supports two representations of the character data in
  an XML document: text nodes and simple-typed values.  A text node represents 
  a string of consecutive character information items and
  never has another text node as its immediately following sibling.
  An element node, for example, has child nodes 
  that may include text nodes, comment nodes, processing instruction nodes, 
  and other element nodes.  In addition, the text content of an element may be 
  interpreted as a simple-typed value, such as an integer, a date, or a sequence 
  of prices.  To illustrate, consider an element node whose type is a 
  sequence of double-precision numbers.  The element's children are three nodes: 
  a text node with string contents " 12.00 ", followed by a comment node,
  followed by a text node with contents " 13.0", whereas its simple-typed value 
  is a sequence containing the double-precision numbers 12.0 and 13.0.</p>

  <p>The data model logically supports both text nodes and simple-typed 
  values, but it does not specify that they both must be implemented.  
  An implementation might choose to only store simple-typed values and 
  reconstruct text nodes on demand, or vice versa.  This allows for the
  efficient storage of and access to simple typed values but it has an impact 
  on interoperability; for instance, searching for leading zeros in nodes 
  with numerical simple typed values may yield results in some implementations 
  but not in others.</p>
</div2>

<div2 id="flags">
  <head>Ignoring Comments, Processing Instructions, and Whitespace</head>

  <p>Although the data model is able to represent comments, processing 
  instructions, and insignificant whitespace, preservation of this information 
  may be unnecessary and onerous for some applications.</p>

  <p>Construction of a document from an XML information set is 
  parameterized by three flags, <emph>ignore-comments</emph>,
  <emph>ignore-processing-instructions</emph>, and <emph>ignore-whitespace</emph>.  
  If the <emph>ignore-comments</emph> flag is true, comment nodes are not 
  preserved in the data model.  If the <emph>ignore-processing-instructions</emph>
  flag is true, processing-instruction nodes are not preserved in the 
  data model.  If the <emph>ignore-whitespace</emph> flag is true, 
  insignificant whitespace is not preserved.</p>

<p role="definition">
ignore-comments                : xs:boolean
ignore-processing-instructions : xs:boolean
ignore-whitespace              : xs:boolean
</p>

  <note><p>By whom these flags are set is not defined.  
  See <specref ref="Issue-0040"/>.</p></note>
  
  <p>Expressions which rely upon the presence or absence of comments, 
  processing instructions, or insignificant whitespace may produce different 
  results for two data models created from the same infoset (XML document), 
  when each data model is constructed with different settings of these flags.</p>

  <p>Insignificant whitespace is defined as a text node that:</p>
  <olist>
    <item><p>contains no characters other than whitespace characters 
    (as defined in XML 1.0), and</p></item>
    <item><p>has a parent element with a <emph role="infoset-property">validity</emph>
    property with the value "valid", and a
    <emph role="infoset-property">type definition</emph> property yielding
    a complex type with <emph>content-type</emph> of <emph>element-only</emph>.</p></item>
  </olist>
  
  <note><p>See <specref ref="Issue-0034"/>.  Removal of insignificant whitespace 
  might be performed automatically when consistent with the schema.  See 
  <specref ref="Issue-0028"/>.  XSLT's whitespace handling mechanism needs
  to be supported; see <specref ref="Issue-0057"/>.</p></note>
</div2>

</div1>

<div1 id="Node">
  <head>Nodes</head>

  <p>The category of <emph>Node</emph> values contains seven distinct 
  kinds of nodes: <loc href="#DocumentNode">document</loc>, 
  <loc href="#ElementNode">element</loc>, <loc href="#AttributeNode">attribute</loc>,
  <loc href="#TextNode">text</loc>, <loc href="#NamespaceNode">namespace</loc>,
  <loc href="#ProcessingInstructionNode">processing instruction</loc>, and
  <loc href="#CommentNode">comment</loc>.  The seven kinds of nodes are 
  defined in the following subsections.</p>
  
  <p>Each kind of node has its own constructor.   The effect of a node
  constructor is to create a new node with a unique identity, distinct
  from all other nodes.</p>
  
  <p>A set of accessors is defined on all seven kinds of Nodes.  Some 
  accessors return a constant empty sequence on certain node kinds.</p>
  
  <ulist>
    <item>
      <p>The <emph>node-kind</emph> accessor returns a string value 
      representing the node's kind: either <code>"document"</code>, 
      <code>"element"</code>, <code>"attribute"</code>, <code>"text"</code>, 
      <code>"namespace"</code>, <code>"processing-instruction"</code>, or
      <code>"comment"</code>.</p>
    </item>
    <item>
      <p>The <emph>name</emph> accessor returns a sequence containing
      one <emph>expanded QName</emph> for node kinds that can have names.
      For other node kinds, it always returns an empty sequence.
      An expanded QName is in the value space of <emph>xs:QName</emph>, 
      and consists of a namespace URI and a local name.  See 
      <specref ref="Issue-0063"/>, <specref ref="Issue-0070"/>.</p>
    </item>
    <item>
      <p>The <emph>parent</emph> accessor returns a sequence containing
      zero or one nodes for node kinds that can have parents.  For other
      node kinds, it always returns the empty sequence.</p>
    </item>
    <item>
      <p>The <emph>string-value</emph> accessor returns the node's 
      string representation.  For some kinds of node, the <emph>string-value</emph>
      is part of the node; for other kinds of node, the 
      <emph>string-value</emph> is computed from the 
      <emph>string-value</emph> of its descendant nodes.</p>
    </item>
    <item>
      <p>The <emph>typed-value</emph> accessor returns a sequence of
      simple typed values corresponding to the node. This may be a
      non-empty sequence for element and attribute nodes, but it is always
      the empty sequence for other node kinds.</p>
    </item>
    <item>
      <p>Every node has at most one <emph>parent</emph>, which is either 
      an element node or the document node.  A node that has no parent is 
      regarded as the root of a tree. The one exception is a namespace node, 
      which never has a parent.</p>
      <note>
        <p>In XPath 1.0, Namespace nodes have parents.</p>
      </note>
    </item>
    <item>
      <p>Document nodes and element nodes have a sequence of <emph>children</emph> 
      nodes.  A document node or an element node is the parent of each of 
      its child nodes.  Nodes never share children: if two nodes have 
      distinct identities, then no child of one node will be a child of 
      the other node.</p>
    </item>
  </ulist>

  <p>The return types of the Node accessors is given below.  Some kinds of node
  further restrict the return types; notably, many node kinds return a
  constant empty sequence for some of the accessors.</p>

  <p role="definition">
node-kind    : (Node) -> <loc href="#dt-simple-typed-value">xs:string</loc>
name         : (Node) -> Sequence(0,1)&lt;<loc href="#dt-simple-typed-value">xs:QName</loc>&gt;
base-uri     : (Node) -> Sequence(0,1)&lt;<loc href="#dt-simple-typed-value">xs:anyURI</loc>&gt;
string-value : (Node) -> <loc href="#dt-simple-typed-value">xs:string</loc>
typed-value  : (Node) -> Sequence&lt;<loc href="#simpletypedvalue">SimpleTypedValue</loc>&gt;
parent       : (Node) -> Sequence(0,1)&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#DocumentNode">DocumentNode</loc>&gt;
children     : (Node) -> Sequence&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc> 
                         | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> | <loc href="#CommentNode">CommentNode</loc>&gt;
attributes   : (Node) -> Sequence&lt;<loc href="#AttributeNode">AttributeNode</loc>&gt;
namespaces   : (Node) -> Sequence&lt;<loc href="#NamespaceNode">NamespaceNode</loc>&gt;
declaration  : (Node) -> Sequence(0,1)&lt;<loc href="#SchemaComponent">SchemaComponent</loc>&gt;
type         : (Node) -> Sequence(0,1)&lt;<loc href="#SchemaComponent">SchemaComponent</loc>&gt;
unique-ID    : (Node) -> Sequence(0,1)&lt;xs:ID&gt;
  </p>

  <p>A tree contains a root plus all nodes that are reachable 
  directly or indirectly from the root via the <emph>children</emph>, 
  <emph>attributes</emph>, and <emph>namespace</emph> accessors.  Every 
  node belongs to exactly one tree, and every tree has exactly one root 
  node.  A tree whose root node is a document node is referred to as a 
  <emph>document</emph>.  A tree whose root node is some other kind of 
  node is referred to as a <emph>fragment</emph>.</p>

<div2 id="DocumentNode">
  <head>Documents</head>

  <table role="node-summary">
    <thead>
      <tr><td>Document Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>node-kind</td>    <td>"document"</td></tr>
      <tr><td>name</td>         <td>empty sequence</td></tr>
      <tr><td>base-uri</td>     <td>xs:anyURI</td></tr>
      <tr><td>string-value</td> <td>xs:string</td></tr>
      <tr><td>typed-value</td>  <td>empty sequence</td></tr>
      <tr><td>parent</td>       <td>empty sequence</td></tr>
      <tr><td>children</td>     <td>arbitrary sequence of one or more 
                                element nodes, zero or more processing 
                                instruction nodes, and zero or more 
                                comment nodes</td></tr>
      <tr><td>attributes</td>   <td>empty sequence</td></tr>
      <tr><td>namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>declaration</td>  <td>empty sequence</td></tr>
      <tr><td>type</td>         <td>empty sequence</td></tr>
      <tr><td>unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <p>A document is represented by a document node, which corresponds 
  to a <emph role="info-item">document information item</emph>.</p>

  <note>
    <p>Document nodes and XPath 1.0 root nodes are essentially 
    identical.</p>
  </note>
  
  <p>A document node does not have an <emph>expanded-QName</emph>.</p> 

  <p>The <emph>base-uri</emph> of the document corresponds to the
  <emph role="infoset-property">base URI</emph> property.</p>

  <p>The <emph>string-value</emph> of the document node is the 
  concatenation of the string-values of all text-node descendants of 
  the document node in document order.</p>
  
  <p>The <emph>parent</emph> of the document node is always the empty 
  sequence.  A document node always represents the root of a tree.</p>

  <p>The <emph>children</emph> of the document node are nodes corresponding
  to the information items found in the 
  <emph role="infoset-property">children</emph> property, omitting 
  any <emph role="info-item">document type declaration information 
  items</emph>.</p>

  <note><p>There is no way to determine what DTD might apply to the data model.
  See <specref ref="Issue-0042"/>.</p></note>

  <p>In a well-formed document, the children of the document node consist
  exclusively of element nodes, processing-instruction nodes, and comment 
  nodes, and exactly one of these children is an element node.  A document 
  node in the data model is more permissive: it permits more than one 
  element node as a child and also permits text nodes as children.</p>

  <note><p>See <specref ref="Issue-0041"/>.</p></note>
  
  <p id="document-node">
  A document node has the constructor <emph>document-node</emph>, 
  which takes a base URI value and a non-empty sequence of its children nodes.
  Like all other node constructors, the document-node constructor has the
  effect of creating a new node with a unique identity, distinct from all
  other nodes.</p>

  <p role="definition">
document-node : (<loc href="#dt-simple-typed-value">xs:anyURI</loc>,
                 Sequence(1,*)&lt;<loc  href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
                              | <loc href="#CommentNode">CommentNode</loc>&gt;) 
             -> <loc href="#DocumentNode">DocumentNode</loc>
  </p>

  <p>The accessors <emph>base-uri</emph> and <emph>children</emph> return a 
  document node's constituent parts:</p>

<p role="definition">
base-uri : (<loc href="#DocumentNode">DocumentNode</loc>) -> <loc href="#dt-simple-typed-value">xs:anyURI</loc>
children : (<loc href="#DocumentNode">DocumentNode</loc>) 
         -> Sequence(1,*)&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc> 
                         | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> | <loc href="#CommentNode">CommentNode</loc>&gt;
</p>
  
  <p>The accessors <emph>node-kind</emph> and <emph>string-value</emph>
  also apply to document nodes and return results other than the empty sequence.
  The accessors <emph>name</emph>, <emph>typed-value</emph>,
  <emph>parent</emph>, <emph>attributes</emph>, <emph>namespaces</emph>,
  <emph>declaration</emph>, <emph>type</emph> and <emph>unique-ID</emph>
  applied to a document node always return the empty sequence.</p>

  <p>A document node is constructed from a Document Information
  Item by the <emph>infoitem-to-document-node</emph> function:</p>

<p role="definition" id="DocumentItem">
/* Accessors for document information items: */
infoset-document-children : (<loc href="#DocumentItem">DocumentItem</loc>) 
                     -> Sequence&lt;<loc
href="#ElementItem">ElementItem</loc> | <loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc> 
                                | <loc href="#CommentItem">CommentItem</loc> | DocTypeItem&gt;
infoset-document-base-uri : (<loc href="#DocumentItem">DocumentItem</loc>) -> <loc href="#dt-simple-typed-value">xs:anyURI</loc>
</p>

<p role="definition" id="infoitem-to-document-node">
infoitem-to-document-node : (<loc href="#DocumentItem">DocumentItem</loc>) -> <loc href="#DocumentNode">DocumentNode</loc>
function infoitem-to-document-node(d) { 
  let kids := <loc href="#collapse-text-nodes">collapse-text-nodes</loc>(<loc href="#sequence-map">sequence-map</loc>(infoitem-to-node,
                                  infoset-document-children(d)))
  return <loc href="#DocumentNode">document-node</loc>(infoset-document-base-uri(d), kids)
}
</p>
   
  <p>The <code><loc href="#collapse-text-nodes">collapse-text-nodes</loc></code>
  function synthesizes a single text node from multiple text nodes.  The 
  <code><loc href="#sequence-map">sequence-map</loc></code> function 
  applies its first function argument to each member of its second 
  sequence argument and returns a new sequence containing the result 
  of applying the function to each member of the sequence.  In the pseudo-code
  above, <code>infoitem-to-node</code> is applied to each child of the 
  <emph role="info-item">document information item</emph> value 
  <emph>d</emph> and a new sequence of children nodes is constructed, 
  each of which is a <emph>Node</emph>.  The constructor 
  <code>document-node</code> constructs the document node in the data 
  model.</p>

  <p role="definition" id="sequence-map">
  sequence-map : ((<emph>UnitValue1</emph> -> <emph>UnitValue2</emph>), Sequence&lt;<emph>UnitValue1</emph>&gt;) 
               -> Sequence&lt;<emph>UnitValue2</emph>&gt;</p>

  <p>The <emph>infoitem-to-node</emph> function maps an information item 
  to a sequence of zero or one node.</p>
  
  <p id="infoitem-to-node" role="definition">
  infoitem-to-node : (<loc href="#InfoItem">InfoItem</loc>) -> Sequence(0,1)&lt;Node&gt;
  function infoitem-to-node(i) { 
    return
      if (infoitem-kind(i) = "element") then 
        <loc href="#infoitem-to-element-node">infoitem-to-element-node</loc>(i)
      else if (infoitem-kind(i) = "character") then 
        <loc href="#infoitem-to-single-character-text-node">infoitem-to-single-character-text-node</loc>(i)
      else if (infoitem-kind(i) = "processing-instruction") then
        if (not(ignore-processing-instructions)) then 
          <loc href="#infoitem-to-processing-instruction-node">infoitem-to-processing-instruction-node</loc>(i)
        else <loc href="#empty-sequence">empty-sequence</loc>()
      else if (infoitem-kind(i) = "comment") then
        if (not(ignore-comments)) then 
          <loc href="#infoitem-to-comment-node">infoitem-to-comment-node</loc>(i)
        else <loc href="#empty-sequence">empty-sequence</loc>()
      else 
        /* infoitem-kind(i) = "doctype" | "notation" | "unparsed-entity" */ 
        <loc href="#empty-sequence">empty-sequence</loc>()
  }
  </p>
</div2>

<div2 id="ElementNode">
  <head>Elements</head>

   <table role="node-summary">
    <thead>
      <tr><td>Element Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>node-kind</td>    <td>"element"</td></tr>
      <tr><td>name</td>         <td>xs:QName</td></tr>
      <tr><td>base-uri</td>     <td>xs:anyURI</td></tr>
      <tr><td>string-value</td> <td>xs:string</td></tr>
      <tr><td>typed-value</td>  <td>sequence of zero or more simple typed values</td></tr>
      <tr><td>parent</td>       <td>sequence of zero or one element or document node</td></tr>
      <tr><td>children</td>     <td>sequence of zero or more element nodes, 
                                zero or more processing instruction nodes, 
                                zero or more comment nodes, and zero or more
                                text nodes</td></tr>
      <tr><td>attributes</td>   <td>sequence of zero or more attribute nodes</td></tr>
      <tr><td>namespaces</td>   <td>sequence of zero or more namespace nodes</td></tr>
      <tr><td>declaration</td>  <td>schema component</td></tr>
      <tr><td>type</td>         <td>schema component</td></tr>
      <tr><td>unique-ID</td>    <td>zero or one xs:ID</td></tr>
    </tbody>
  </table>

  <p>Each element node corresponds to an <emph role="info-item">element 
  information item</emph>.</p>

  <p>An element node has an <emph>expanded-QName</emph>.  The local part
  of the <emph>expanded-QName</emph> corresponds to the 
  <emph role="infoset-property">local name</emph> property.  
  The namespace URI of the <emph>expanded-QName</emph> of the element node
  corresponds to the <emph role="infoset-property">namespace name</emph>
  property.</p>
  
  <p>The <emph>parent</emph> of the element node corresponds to the node
  corresponding to the <emph role="infoset-property">parent</emph> property.</p>

  <p>An element node has an associated <emph>typed-value</emph>,
  which is a sequence of zero or more simple typed values. Examples of such
  values would be a sequence containing an integer, or user-defined simple
  value or several dates, etc. For a document with a
  schema, the element's typed-value corresponds to the <emph
  role="infoset-property">schema normalized value</emph> PSVI
  property.  If the element has a complex type, the typed-value is the
  empty sequence (see <specref ref="Issue-0054"/>. For an element in a 
  well-formed document with no associated schema, the element's 
  typed-value is the empty sequence.
  If the element was created with an <emph>xsi:nil</emph> attribute set to
  true, then <emph>typed-value</emph> returns the empty sequence.
  See <specref ref="Issue-0071"/>.</p>

  <p>The <emph>children</emph> nodes of the element node 
  correspond to the element, comment, processing instruction, and
  character information items appearing in the
  <emph role="infoset-property">children</emph> property.
  This correspondence is not one-to-one, as consecutive
  <emph role="info-item">character information item</emph> children
  are coalesced into a single text node.  Because the data model requires 
  that all general entities be expanded, there will never be 
  <emph role="info-item">unexpanded entity reference information item</emph> 
  children.</p>

  <p>The <emph>attributes</emph> of the element node are nodes
  corresponding to <emph role="info-item">attribute information 
  items</emph> appearing in the 
  <emph role="infoset-property">attributes</emph> property.  The 
  attributes of an element always have distinct names.</p>

  <p>The <emph>namespaces</emph> of the element node are nodes
  corresponding to <emph role="info-item">namespace information items</emph>
  appearing in the <emph role="infoset-property">in-scope namespaces</emph>
  property.  The namespaces of an element always have distinct prefixes.
  See <specref ref="Issue-0062"/>.</p>

  <p>The <emph>declaration</emph> of an element is a schema component
  and corresponds to the <emph role="infoset-property">element
  declaration</emph> PSVI property.  The <emph>type</emph> of an
  element is a schema component and corresponds to the <emph
  role="infoset-property">type definition</emph> PSVI property.  The
  representation of schema component information is defined in
  <specref ref="types"/>.  See <specref ref="Issue-0064"/>.</p>

  <p>The <emph>unique ID</emph> of the element node is an identifier
  optionally assigned by the user.  It corresponds to the 
  <emph role="infoset-property">normalized value</emph> property 
  of the <emph role="info-item">attribute information item</emph>
  in the <emph role="infoset-property">attributes</emph> 
  property that has a type <emph>ID</emph>, if one exists.</p>

  <note><p>Using this definition, only IDs declared in a DTD are effective.
  See <specref ref="Issue-0004"/>.  Even so, this definition is not
  backward compatible with XPath 1.0.  See <specref ref="Issue-0038"/>.
  Furthermore, it doesn't even work as spec'd, see <specref ref="Issue-0044"/>.</p></note>
  
  <p>An element node can be constructed in one of two
  ways: <emph>element-complex-node</emph> is useful for constructing an element
  from the PSVI, <emph>element-simple-node</emph> is useful when
  constructing an element via embedded expressions. The difference in
  the constructors is whether the children of the node are specified
  as a sequence of nodes or as a sequence of simple typed values.</p>

  <p id="element-complex-node">The constructor
  <emph>element-complex-node</emph> takes an expanded-QName, 
  a sequence of namespace nodes, a sequence of attribute nodes, a 
  sequence of child nodes, and the node's element declaration, which is 
  a schema component.</p>
  
  <p role="definition">
  element-complex-node : (<loc href="#dt-simple-typed-value">xs:QName</loc>, 
                          Sequence&lt;<loc href="#NamespaceNode">NamespaceNode</loc>&gt;,
                          Sequence&lt;<loc href="#AttributeNode">AttributeNode</loc>&gt;, 
                          Sequence&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
                                  | <loc href="#CommentNode">CommentNode</loc>&gt;, 
                          <loc href="#SchemaComponent">SchemaComponent</loc>)
                       -> <loc href="#ElementNode">ElementNode</loc>
  </p>

  <ednote><edtext>MF: The constructor only takes the element 
    declaration, because it's possible to derive
    the type of an element or attribute from its corresponding
    declaration.  But would it be cleaner to include the type in the
    constructor as well?
  </edtext></ednote>

  <p id="element-simple-node">The constructor <emph>element-simple-node</emph>
  takes an expanded-QName, 
  a sequence of namespace nodes, a sequence of attribute nodes, a 
  sequence of simple typed values, and the node's element declaration, which is 
  a schema component.</p>
  
  <p role="definition">
  element-simple-node : (<loc href="#dt-simple-typed-value">xs:QName</loc>, 
                         Sequence&lt;<loc href="#NamespaceNode">NamespaceNode</loc>&gt;,
                         Sequence&lt;<loc href="#AttributeNode">AttributeNode</loc>&gt;, 
                         Sequence&lt;<loc href="#simpletypedvalue">SimpleTypedValue</loc>&gt;, 
                         <loc href="#SchemaComponent">SchemaComponent</loc>)
                      -> <loc href="#ElementNode">ElementNode</loc>
  </p>

  <p>Like all other node constructors, the element node
  constructors has the effect of creating a new node with a unique 
  identity, distinct from all other nodes.</p>

  <p>To guarantee that the parent-child relationship is 
  invertible, the element constructors logically create a copy of all of their 
  namespace, attribute, and children arguments and set the parent property 
  of these nodes to the newly created element node. As long as the parent-child 
  constraint is satisfied, an implementation of the data model may choose to 
  use specialized techniques to avoid creating physical copies of the 
  arguments to an element constructor.  See <specref ref="Issue-0052"/>.</p>
  
  <note><p>An alternative interface is suggested by James Clark:
  See <specref ref="Issue-0019"/>.</p></note>

  <p>Neither constructor allows specifying the children of the node
  as a heterogeneous sequence, i.e. a sequence mixing nodes and simple
  typed values. It is still prossible to construct an element (with
  mixed content) from such a sequence in two steps:
  First the heterogeneous sequence will need to be turned into a
  homogeneous one by converting the simple typed values to text nodes,
  then the now homogeneous sequence can be passed to the
  element-complex-node constructor.
  Note that the precise type information of the simple typed values is
  lost in the process, which is inline with XML Schema, that cannot
  represent the type of such mixed content.
  </p>

  <ednote><edtext>Both element constructors take a SchemaComponent as one of
  their arguments. The question of what should the value of this argument
  be when no type information is available (for instance when dealing
  with well formed, schemaless documents) and how should the typed-value
  accessor behave in these cases is currently under discussion.
  See also <specref ref="Issue-0036"/>.</edtext></ednote>

  <p>The accessors <emph>name</emph>, <emph>namespaces</emph>,
  <emph>attributes</emph> and <emph>declaration</emph> return an
  element node's constituent parts.
  The <emph>children</emph> accessor returns the sequence of children
  nodes for an element node if it was created with <emph>element-complex-node</emph>
  and it returns a singleton sequence containing a text node corresponding
  to the sequence of simple typed values if it was created with
  <emph>element-simple-node</emph>.
  The <emph>type</emph>
  accessor returns the schema component corresponding to the type of
  the element's content: either a complex-type-definition or
  simple-type-definition.  It is possible to derive the element's type
  from its declaration. See <specref ref="Issue-0068"/>.
</p>
  
  <p role="definition">
name        : (<loc href="#ElementNode">ElementNode</loc>) -> <loc href="#dt-simple-typed-value">xs:QName</loc>
namespaces  : (<loc href="#ElementNode">ElementNode</loc>) -> Sequence&lt;<loc href="#namespace-node">NamespaceNode</loc>&gt;
attributes  : (<loc href="#ElementNode">ElementNode</loc>) -> Sequence&lt;<loc href="#AttributeNode">AttributeNode</loc>&gt;
children    : (<loc href="#ElementNode">ElementNode</loc>) -> Sequence&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#TextNode">TextNode</loc>
                               | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> | <loc href="#comment-node">CommentNode</loc>&gt; 
declaration : (<loc href="#ElementNode">ElementNode</loc>) -> <loc href="#SchemaComponent">SchemaComponent</loc>
type        : (<loc href="#ElementNode">ElementNode</loc>) -> <loc href="#SchemaComponent">SchemaComponent</loc>
  </p>

  <p>If an element has a simple type, the accessor function 
  <emph>typed-value</emph> returns a sequence of the simple-typed values 
  of the element; otherwise, it returns the empty sequence.
  If the element was created with an <emph>xsi:nil</emph> attribute set to
  true, then <emph>typed-value</emph> returns the empty sequence.</p>
    
  <p role="definition">typed-value : (<loc href="#ElementNode">ElementNode</loc>) -> Sequence&lt;<loc href="#simpletypedvalue">SimpleTypedValue</loc>&gt;</p>

  <p>The <emph>string-value</emph> of an element node returns the concatenation
  of the string-values of all text-node descendants of the element node in 
  document order if it was created with <emph>element-complex-node</emph>
  and it returns the string representation of the sequence of simple typed values
  if it was created with <emph>element-simple-node</emph>.</p>

  <p role="definition">string-value : (<loc href="#ElementNode">ElementNode</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc></p>

  <p>If an element has a unique ID, the accessor function <emph>unique-ID</emph> 
  returns a sequence containing the unique ID of the node; otherwise, it 
  returns the empty sequence.</p>
    
  <p role="definition">unique-ID : (<loc href="#ElementNode">ElementNode</loc>) -> Sequence(0,1)&lt;xs:ID&gt;</p>

  <p>The node accessors <emph>base-uri</emph>, <emph>node-kind</emph>, 
  <emph>parent</emph>, and <emph>string-value</emph> also apply to
  element nodes.</p>

  <p>An element node is constructed from an Element Information
  Item by the <emph>infoitem-to-element-node</emph> function:</p>

  <p role="definition" id="ElementItem">
/* Accessors for element information items: */
infoset-element-namespace-name       : (<loc href="#ElementItem">ElementItem</loc>) -> Sequence(0,1)&lt;<loc href="#dt-simple-typed-value">xs:anyURI</loc>&gt;
infoset-element-local-name           : (<loc href="#ElementItem">ElementItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
infoset-element-children             : (<loc href="#ElementItem">ElementItem</loc>) -> Sequence&lt;<loc href="#InfoItem">InfoItem</loc>&gt;
infoset-element-attributes           : (<loc href="#ElementItem">ElementItem</loc>) -> Sequence&lt;<loc href="#AttributeItem">AttributeItem</loc>&gt;
infoset-element-in-scope-namespaces  : (<loc href="#ElementItem">ElementItem</loc>) -> Sequence&lt;<loc href="#NamespaceItem">NamespaceItem</loc>&gt;
infoset-element-base-uri             : (<loc href="#ElementItem">ElementItem</loc>) -> <loc href="#dt-simple-typed-value">xs:anyURI</loc>  /* unused ? */

psvi-element-validity                : (<loc href="#ElementItem">ElementItem</loc>) -> xs:string
psvi-element-element-declaration     : (<loc href="#ElementItem">ElementItem</loc>) -> <loc href="#ElementItem">ElementItem</loc>
psvi-element-type-definition         : (<loc href="#ElementItem">ElementItem</loc>) -> <loc href="#ElementItem">ElementItem</loc>
psvi-element-schema-normalized-value : (<loc href="#ElementItem">ElementItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
  </p>

  <p id="infoitem-to-element-node" role="definition">
infoitem-to-element-node : (<loc href="#ElementItem">ElementItem</loc>) -> <loc href="#ElementNode">ElementNode</loc>
function infoitem-to-element-node(e) { 
  let name := <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>(infoset-element-namespace-name(e), 
                                infoset-element-local-name(e)),
      nsnodes := <loc href="#sequence-map">sequence-map</loc>(<loc href="#infoitem-to-namespace-node">infoitem-to-namespace-node</loc>, 
                              infoset-element-in-scope-namespaces(e)),
      attrnodes := <loc href="#sequence-map">sequence-map</loc>(<loc href="#infoitem-to-attribute-node">infoitem-to-attribute-node</loc>, infoset-element-attributes(e)),
      kids := <loc href="#collapse-text-nodes">collapse-text-nodes</loc>(<loc href="#sequence-map">sequence-map</loc>(<loc href="#infoitem-to-node">infoitem-to-node</loc>, infoset-element-children(e))),
      declaration := infoitem-to-schema-component(psvi-element-validity(e), 
                                                  psvi-element-element-declaration(e)),
      type := infoitem-to-schema-component(psvi-element-validity(e), 
                                           psvi-element-type-definition(e))
  return <loc href="#element-complex-node">element-complex-node</loc>(name, nsnodes, attrnodes, kids, declaration)
}</p>

  <ednote><edtext>MF: Even though its possible to derive
  the type of an element from its corresponding element declaration,
  it seems cleaner to compute explicitly the schema components for
  both the element declaration and its simple or complex type.</edtext></ednote>

  <note><p>[base URI] is discarded.  See <specref ref="Issue-0030"/>.</p></note>

<!--
  <ednote><edtext>MF: There now exists a normalized Schema value that
  contains the value of an element(attribute)'s
  simple-typed value.  This value should be used to compute an
  element(attribute)'s <emph>typed-value</emph>.
  </edtext></ednote>
-->

<!--
  <p role="definition" id="infoitem-to-concat-string">
  /* The <emph>infoitem-to-concat-string</emph> function concatenates two strings */
  concat-string : (string, string) -> string
  </p>
-->
</div2>

<div2 id="AttributeNode">
  <head>Attributes</head>

   <table role="node-summary">
    <thead>
      <tr><td>Attribute Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>node-kind</td>    <td>"attribute"</td></tr>
      <tr><td>name</td>         <td>xs:QName</td></tr>
      <tr><td>base-uri</td>     <td>empty sequence</td></tr>
      <tr><td>string-value</td> <td>xs:string</td></tr>
      <tr><td>typed-value</td>  <td>sequence of zero or more simple typed values</td></tr>
      <tr><td>parent</td>       <td>sequence of zero or one element nodes</td></tr>
      <tr><td>children</td>     <td>empty sequence</td></tr>
      <tr><td>attributes</td>   <td>empty sequence</td></tr>
      <tr><td>namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>declaration</td>  <td>schema component</td></tr>
      <tr><td>type</td>         <td>schema component</td></tr>
      <tr><td>unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <p>Each element node has an associated set of attribute nodes, each
  corresponding to an <emph role="info-item">attribute 
  information item</emph>.</p>
  
  <p>An attribute node has an <emph>expanded-QName</emph>.  The local part 
  of the <emph>expanded-QName</emph> corresponds to the 
  <emph role="infoset-property">local name</emph> property. The namespace 
  name of the <emph>expanded-QName</emph> corresponds to the 
  <emph role="infoset-property">namespace name</emph> property.</p>

  <p>An attribute node has an associated <emph>string-value</emph>,
  which corresponds to the
  <emph role="infoset-property">normalized value</emph> property.</p>

  <p>An attribute node also has a <emph>typed-value</emph>.  For a
  document with a schema, the attribute's typed-value corresponds to
  the <emph role="infoset-property">schema normalized value</emph>
  PSVI property.</p>

  <p>For convenience, the element node is called the "parent" of each of 
  these attribute nodes even though an attribute node is not a "child" of 
  its parent element.  The <emph>parent</emph> of the attribute node 
  corresponds to the <emph role="infoset-property">owner element</emph> 
  property.</p>

  <p>The <emph>declaration</emph> of an attribute is a schema component
  and corresponds to the <emph role="infoset-property">attribute
  declaration</emph> PSVI property.  The <emph>type</emph> of an
  attribute is a schema component and corresponds to the <emph
  role="infoset-property">type definition</emph> PSVI property.  The
  representation of schema component information is defined in
  <specref ref="types"/>.</p>

  <p>An attribute node can be constructed in one of two ways:
  <emph>attribute-complex-node</emph> is useful for constructing an attribute
  from the PSVI, <emph>attribute-simple-node</emph> is useful when
  constructing an attribute with embedded expressions.</p>

  <p id="attribute-complex-node">The constructor
  <emph>attribute-complex-node</emph>
  takes the attribute's name, a string value and the node's attribute
  declaration, which is a schema component.</p>

  <p role="definition">
attribute-complex-node : (<loc href="#dt-simple-typed-value">xs:QName</loc>, <loc href="#dt-simple-typed-value">xs:string</loc>, <loc href="#SchemaComponent">SchemaComponent</loc>)
                       -> <loc href="#AttributeNode">AttributeNode</loc></p>
  
  <p id="attribute-simple-node">The constructor
  <emph>attribute-simple-node</emph> takes the attribute's name, a 
  simple typed value and the node's attribute declaration, which is a 
  schema component.</p>

  <p role="definition">
attribute-simple-node : (<loc href="#dt-simple-typed-value">xs:QName</loc>, Sequence&lt;<loc href="#simpletypedvalue">SimpleTypedValue</loc>&gt;, <loc href="#SchemaComponent">SchemaComponent</loc>)
                      -> <loc href="#AttributeNode">AttributeNode</loc></p>
  
  <p>Like all other node constructors, the attribute node
  constructors have the effect of creating a new node with a unique 
  identity, distinct from all other nodes.  </p>

  <ednote><edtext>Both attribute constructors take a SchemaComponent as one of
  their arguments. The question of what should the value of this argument
  be when no type information is available (for instance when dealing
  with well formed, schemaless documents) and how should the typed-value
  accessor behave in these cases is currently under discussion.
  See also <specref ref="Issue-0036"/>.</edtext></ednote>

  <p>The accessors <emph>name</emph> and <emph>declaration</emph> return an
  attribute's constituent parts.
  The accessor <emph>string-value</emph> returns an attribute's
  constituent part if it was created with <emph>attribute-complex-node</emph>
  and it returns the string representation of the sequence of simple typed values
  if it was created with <emph>attribute-simple-node</emph>.
  The <emph>type</emph> accessor
  returns the schema component corresponding to the simple type of the
  attribute's value.  It is possible to derive the attribute's type
  from its declaration.
  The accessor function <emph>typed-value</emph> returns 
  a sequence of the simple-typed values of an attribute.
  </p>

  <p role="definition">
name         : (<loc href="#AttributeNode">AttributeNode</loc>) -> <loc href="#dt-simple-typed-value">xs:QName</loc>
string-value : (<loc href="#AttributeNode">AttributeNode</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
declaration  : (<loc href="#AttributeNode">AttributeNode</loc>) -> <loc href="#SchemaComponent">SchemaComponent</loc>
type         : (<loc href="#AttributeNode">AttributeNode</loc>) -> <loc href="#SchemaComponent">SchemaComponent</loc>
typed-value  : (<loc href="#AttributeNode">AttributeNode</loc>) -> Sequence&lt;<loc href="#simpletypedvalue">SimpleTypedValue</loc>&gt;</p>

  <p>The node accessors <emph>node-kind</emph> and <emph>parent</emph>
  also apply to attribute nodes and may return results other than the
  empty sequence.
  The accessors <emph>base-uri</emph>, <emph>children</emph>,
  <emph>attributes</emph>, <emph>namespaces</emph> and <emph>unique-ID</emph>
  applied to an attribute node always return the empty sequence.</p>

  <p>An attribute node is constructed from an Attribute Information
  Item by the <emph>infoitem-to-attribute-node</emph> function:</p>

  <p role="definition" id="AttributeItem">
/* Accessors for attribute information items: */
infoset-attribute-namespace-name       : (<loc href="#AttributeItem">AttributeItem</loc>) -> Sequence(0,1)&lt;<loc href="#dt-simple-typed-value">xs:anyURI</loc>&gt;
infoset-attribute-local-name           : (<loc href="#AttributeItem">AttributeItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
infoset-attribute-normalized-value     : (<loc href="#AttributeItem">AttributeItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
infoset-attribute-owner-element        : (<loc href="#AttributeItem">AttributeItem</loc>) -> <loc href="#ElementItem">ElementItem</loc>

psvi-attribute-validity                : (<loc href="#AttributeItem">AttributeItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
psvi-attribute-attribute-declaration   : (<loc href="#AttributeItem">AttributeItem</loc>) -> <loc href="#ElementItem">ElementItem</loc>
psvi-attribute-type-definition         : (<loc href="#AttributeItem">AttributeItem</loc>) -> <loc href="#ElementItem">ElementItem</loc>
psvi-attribute-schema-normalized-value : (<loc href="#AttributeItem">AttributeItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
  </p>

<!--   <p role="infoset">Although it's possible to derive
the type of an attribute from its corresponding attribute declaration,
it seems cleaner to compute explicitly the schema components for
both the attribute declaration and its simple type.</p> -->

  <p role="definition" id="infoitem-to-attribute-node">
infoitem-to-attribute-node : (<loc href="#AttributeItem">AttributeItem</loc>) -> <loc href="#AttributeNode">AttributeNode</loc> 
function infoitem-to-attribute-node(a) {
   let name := <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>(infoset-attribute-namespace-name(a), 
                                 infoset-attribute-local-name(a)),
       declaration := infoitem-to-schema-component(psvi-attribute-validity(a), 
                                                   psvi-attribute-attribute-declaration(a)),
       type := infoitem-to-schema-component(psvi-attribute-validity(a), 
                                            psvi-attribute-type-definition(a))
   return <loc href="#attribute-complex-node">attribute-complex-node</loc>(name, infoset-attribute-normalized-value(a), declaration)
}
  </p>

  <ednote><edtext>JM: Update the above to accommodate the possibility of
  schema-less and DTD validation.</edtext></ednote>

</div2>

<div2 id="NamespaceNode">
  <head>Namespaces</head>

   <table role="node-summary">
    <thead>
      <tr><td>Namespace Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>node-kind</td>    <td>"namespace"</td></tr>
      <tr><td>name</td>         <td>sequence of zero or one xs:QName</td></tr>
      <tr><td>base-uri</td>     <td>empty sequence</td></tr>
      <tr><td>string-value</td> <td>xs:string</td></tr>
      <tr><td>typed-value</td>  <td>empty sequence</td></tr>
      <tr><td>parent</td>       <td>empty sequence</td></tr>
      <tr><td>children</td>     <td>empty sequence</td></tr>
      <tr><td>attributes</td>   <td>empty sequence</td></tr>
      <tr><td>namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>declaration</td>  <td>empty sequence</td></tr>
      <tr><td>type</td>         <td>empty sequence</td></tr>
      <tr><td>unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <p>Each element node has an associated set of namespace nodes, each
  corresponding to a <emph role="info-item">namespace information item</emph>.</p>
  
  <p>A namespace node has an <emph>expanded-QName</emph>.  The local part of the 
  <emph>QName</emph> corresponds to the <emph role="infoset-property">prefix</emph> 
  property.  The namespace URI of the <emph>QName</emph> is the empty
  sequence.</p>

  <p>The <emph>string-value</emph> of the namespace node corresponds to 
  the <emph role="infoset-property">namespace name</emph> property.</p>

  <p>A namespace node has no <emph>parent</emph>.</p>

  <note><p>From XPath 1.0 : "The <emph>parent</emph> of the
  namespace node is the element node in whose namespaces collection
  this node appears."  See <specref ref="Issue-0039"/> and
  <specref ref="Issue-0060"/>, and <specref ref="Issue-0061"/>.</p></note>

<p id="namespace-node">
  A namespace node has the constructor
  <emph>namespace-node</emph>, which takes a namespace prefix and 
  the absolute URI of the namespace being declared. The namespace prefix may
  be the empty sequence. If the URI is the zero-length string, the prefix must 
  be the empty sequence.
  Like all other node constructors, the namespace node
  constructor has the effect of creating a new node with a unique identity, 
  distinct from all other nodes.  </p>

  <p role="definition">
namespace-node : (Sequence(0,1)&lt;<loc href="#dt-simple-typed-value">xs:string</loc>&gt;, <loc href="#dt-simple-typed-value">xs:string</loc>) 
               -> <loc href="#NamespaceNode">NamespaceNode</loc></p>

  <p>A namespace node's constituent parts may be obtained by applying
  the accessors <emph>name</emph> (with the function
  <loc href="#xf_get-local-name">xf:get-local-name</loc>) and
  <emph>string-value</emph>.</p>

  <p role="definition">
name         : (<loc href="#NamespaceNode">NamespaceNode</loc>) -> Sequence(0,1)&lt;<loc href="#dt-simple-typed-value">xs:QName</loc>&gt;
string-value : (<loc href="#NamespaceNode">NamespaceNode</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
  </p>

  <p>The node accessor <emph>node-kind</emph> also applies to namespace nodes
  and returns a result other than the empty sequence.
  The accessors <emph>base-uri</emph>, <emph>typed-value</emph>,
  <emph>parent</emph>, <emph>children</emph>, <emph>attributes</emph>,
  <emph>namespaces</emph>, <emph>declaration</emph>, <emph>type</emph> and
  <emph>unique-ID</emph> applied to a namespace node always return the empty
  sequence.</p>

  <p>A namespace node is constructed from a Namespace Information
  Item by the <emph>infoitem-to-namespace-node</emph> function:</p>

  <p role="definition" id="NamespaceItem">
infoset-namespace-prefix           : (<loc href="#NamespaceItem">NamespaceItem</loc>) -> Sequence(0,1)&lt;<loc href="#dt-simple-typed-value">xs:string</loc>&gt;
infoset-namespace-namespace-name   : (<loc href="#NamespaceItem">NamespaceItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
  </p>

  <p role="definition" id="infoitem-to-namespace-node">
infoitem-to-namespace-node : (<loc href="#NamespaceItem">NamespaceItem</loc>) -> <loc href="#NamespaceNode">NamespaceNode</loc> 
function infoitem-to-namespace-node(i) {
   return <loc href="#NamespaceNode">namespace-node</loc>(infoset-namespace-prefix(i), infoset-namespace-namespace-name(i))
}</p>
</div2>

<div2 id="ProcessingInstructionNode">
  <head>Processing Instructions</head>

   <table role="node-summary">
    <thead>
      <tr><td>Processing Instruction Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>node-kind</td>    <td>"processing-instruction"</td></tr>
      <tr><td>name</td>         <td>xs:QName</td></tr>
      <tr><td>base-uri</td>     <td>empty-sequence</td></tr>
      <tr><td>string-value</td> <td>xs:string</td></tr>
      <tr><td>typed-value</td>  <td>empty sequence</td></tr>
      <tr><td>parent</td>       <td>sequence of zero or one element or document nodes</td></tr>
      <tr><td>children</td>     <td>empty sequence</td></tr>
      <tr><td>attributes</td>   <td>empty sequence</td></tr>
      <tr><td>namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>declaration</td>  <td>empty sequence</td></tr>
      <tr><td>type</td>         <td>empty sequence</td></tr>
      <tr><td>unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <p>A processing instruction node corresponds to a <emph role="info-item">processing
  instruction information item</emph>.  There are no processing instruction 
  nodes for processing instructions that are children of a 
  <emph role="info-item">document type declaration information item</emph>.</p>
  
  <p>A processing instruction node has an <emph>expanded-QName</emph>. The local part of the 
  <emph>expanded-QName</emph> corresponds to the <emph role="infoset-property">target</emph>
  property.  The namespace URI of the <emph>expanded-QName</emph> is
  the empty sequence.  The local part is a string value that must be an NCName.</p>

  <p>The string '?&gt;' may not occur within a processing instruction's
  target value (<bibref ref="xml-rec"/>).</p>

  <p>The <emph>string-value</emph> of the processing instruction node 
  corresponds to the <emph role="infoset-property">content</emph> 
  property.</p>

  <p>The <emph>parent</emph> of the processing instruction node 
  corresponds to the <emph role="infoset-property">parent</emph> 
  property.</p>

  <p id="processing-instruction-node">
  A processing-instruction node has the constructor
  <emph>processing-instruction-node</emph>, which takes an NCName
  representing the target and a string representing the content.  Like
  all other node constructors, the processing node constructor has the
  effect of creating a new node with a unique identity, distinct from
  all other nodes.  </p>
  
  <p role="definition">
processing-instruction-node : (<loc href="#dt-simple-typed-value">xs:NCName</loc>, <loc href="#dt-simple-typed-value">xs:string</loc>)
                            -> <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc>
  </p>
  
  <p>A processing instruction's constituent parts may be obtained by applying
  the accessors <emph>name</emph> (with the function
  <loc href="#xf_get-local-name">xf:get-local-name</loc>) and
  <emph>string-value</emph>.</p>

  <p role="definition">
name         : (<loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc>) -> <loc href="#dt-simple-typed-value">xs:QName</loc>
string-value : (<loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
  </p>
  
  <p>The node accessors <emph>node-kind</emph> and <emph>parent</emph>
  also apply to processing-instruction nodes and may return results other
  than the empty sequence.
  The accessors <emph>base-uri</emph>, <emph>typed-value</emph>,
  <emph>children</emph>, <emph>attributes</emph>, <emph>namespaces</emph>,
  <emph>declaration</emph>, <emph>type</emph> and <emph>unique-ID</emph>
  applied to a processing-instruction node always return the empty sequence.
  </p>

  <p>A processing-instruction node is constructed from an Processing
  Instruction Information Item by the <emph>infoitem-to-processing-instruction-node</emph> function:</p>

  <p role="definition" id="ProcessingInstructionItem">
/* Accessors for processing instruction information items */
infoset-processing-instruction-target  : (<loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
infoset-processing-instruction-content : (<loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
</p>

  <p role="definition" id="infoitem-to-processing-instruction-node">
infoitem-to-processing-instruction-node : (<loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc>) -> <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
function infoitem-to-processing-instruction-node(i) {
  return processing-instruction-node(<loc href="#xf_NCName">xf:NCName</loc>(infoset-processing-instruction-target(i)), 
                                     infoset-processing-instruction-content(i))
}</p>
</div2>

<div2 id="CommentNode">
  <head>Comments</head>
  
   <table role="node-summary">
    <thead>
      <tr><td>Comment Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>node-kind</td>    <td>"comment"</td></tr>
      <tr><td>name</td>         <td>empty sequence</td></tr>
      <tr><td>base-uri</td>     <td>empty-sequence</td></tr>
      <tr><td>string-value</td> <td>xs:string</td></tr>
      <tr><td>typed-value</td>  <td>empty sequence</td></tr>
      <tr><td>parent</td>       <td>sequence of zero or one element or document nodes</td></tr>
      <tr><td>children</td>     <td>empty sequence</td></tr>
      <tr><td>attributes</td>   <td>empty sequence</td></tr>
      <tr><td>namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>declaration</td>  <td>empty sequence</td></tr>
      <tr><td>type</td>         <td>empty sequence</td></tr>
      <tr><td>unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <p>A comment node corresponds to a <emph role="info-item">comment 
  information item</emph>.  There are no comment nodes for comments
  that are children of a <emph role="info-item">document type declaration
  information item</emph>.</p>
  
  <p>A comment node does not have an <emph>expanded-QName</emph>.</p> 

  <p>The <emph>string-value</emph> of the comment node corresponds to 
  the <emph role="infoset-property">content</emph> property.</p>
  
  <p>The <emph>parent</emph> of the comment node 
  corresponds to the <emph role="infoset-property">parent</emph> 
  property.</p>

  <p>The string "--" (double-hyphen) must not occur within a comment's
  string value (<bibref ref="xml-rec"/>).</p>
  
  <p id="comment-node">A comment node has the constructor
  <emph>comment-node</emph>, which takes a string value.
  Like all other node constructors, the comment node
  constructor has the effect of creating a new node with a unique identity, 
  distinct from all other nodes.</p>
  
  <p role="definition">
comment-node : (<loc href="#dt-simple-typed-value">xs:string</loc>) -> <loc href="#CommentNode">CommentNode</loc></p>

<!--  
  <p  role="infoset">The accessor <emph>content</emph> returns a <code>CommentNode</code>'s content.</p>
  
  <p role="definition">
content    : (<loc href="#CommentNode">CommentNode</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
  </p>
-->

  <p>A comment node's constituent parts may be obtained by applying
  the accessor <emph>string-value</emph>.</p>

  <p role="definition">
string-value : (<loc href="#CommentNode">CommentNode</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
  </p>
  
  <p>The node accessors <emph>node-kind</emph> and <emph>parent</emph>
  also apply to comment nodes and may return results other than the empty
  sequence.
  The accessors <emph>name</emph>, <emph>base-uri</emph>,
  <emph>typed-value</emph>, <emph>children</emph>, <emph>attributes</emph>,
  <emph>namespaces</emph>, <emph>declaration</emph>, <emph>type</emph> and
  <emph>unique-ID</emph> applied to a comment node always return the empty
  sequence.</p>

  <p>A comment node is constructed from a Comment Information 
  Item by the <emph>infoitem-to-comment-node</emph> function:</p>

  <p role="definition" id="CommentItem">
/* Accessors for comment information items */
infoset-comment-value    : (<loc href="#CommentItem">CommentItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
</p>

<!--  infoset-comment-parent   : (<loc href="#CommentItem">CommentItem</loc>) -> <loc href="#ElementItem">ElementItem</loc> | <loc href="#DocumentItem">DocumentItem</loc>  /* unused ? */
-->  

<p role="definition" id="infoitem-to-comment-node">
infoitem-to-comment-node : (<loc href="#CommentItem">CommentItem</loc>) -> <loc href="#comment-node">CommentNode</loc> 
function infoitem-to-comment-node(i) {
  return  <loc href="#CommentNode">comment-node</loc>(infoset-comment-value(i))
}
</p>
</div2>

<div2 id="TextNode">
  <head>Text</head>

   <table role="node-summary">
    <thead>
      <tr><td>Text Node accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>node-kind</td>    <td>"text"</td></tr>
      <tr><td>name</td>         <td>empty sequence</td></tr>
      <tr><td>base-uri</td>     <td>empty-sequence</td></tr>
      <tr><td>string-value</td> <td>xs:string</td></tr>
      <tr><td>typed-value</td>  <td>empty sequence</td></tr>
      <tr><td>parent</td>       <td>sequence of zero or one element or document nodes</td></tr>
      <tr><td>children</td>     <td>empty sequence</td></tr>
      <tr><td>attributes</td>   <td>empty sequence</td></tr>
      <tr><td>namespaces</td>   <td>empty sequence</td></tr>
      <tr><td>declaration</td>  <td>empty sequence</td></tr>
      <tr><td>type</td>         <td>empty sequence</td></tr>
      <tr><td>unique-ID</td>    <td>empty sequence</td></tr>
    </tbody>
  </table>

  <p>A text node corresponds to a sequence of one or more consecutive
  <emph role="info-item">character information items</emph>.  As much 
  character data as possible is grouped into each text node: a text node 
  never has an immediately following or preceding sibling that is a 
  text node.</p>

  <p>A text node does not have an <emph>expanded-QName</emph>.</p> 

  <p>The <emph>string-value</emph> of a text node is the character data,
  which corresponds to the concatenated <emph role="infoset-property">character 
  code</emph> properties of each of the <emph role="info-item">character 
  information items</emph>.</p>

  <note><p>The string-value is not W3C normalized as described in the
  <loc href="http://www.w3.org/TR/charmod/#sec-TextNormalization">Character
  Model for the World Wide Web version 1.0</loc> draft.  See
  <specref ref="Issue-0045"/>.</p></note>

  <p>The <emph>parent</emph> of the text node corresponds to 
  the <emph role="infoset-property">parent</emph> property of 
  any one of the consecutive <emph role="info-item">character 
  information items</emph> (consecutive characters always have 
  the same parent).</p>

  <p id="text-node">A text node has the constructor <code>text-node</code>
  and takes a string value.  Like all other node constructors, the text
  constructor has the effect of creating a new node with a unique identity, 
  distinct from all other nodes.</p>

  <p role="definition">
text-node : (<loc href="#dt-simple-typed-value">xs:string</loc>) -> <loc href="#TextNode">TextNode</loc></p>

  <p>The <emph>string-value</emph> of a text node is simply its content.</p>

  <p role="definition">
string-value : (<loc href="#TextNode">TextNode</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>
  </p>
  
  <p>The node accessors <emph>node-kind</emph> and <emph>parent</emph>
  also apply to text nodes and may return results other than the empty
  sequence.
  The accessors <emph>name</emph>, <emph>base-uri</emph>,
  <emph>typed-value</emph>, <emph>children</emph>, <emph>attributes</emph>,
  <emph>namespaces</emph>, <emph>declaration</emph>, <emph>type</emph> and
  <emph>unique-ID</emph> applied to a text node always return the empty
  sequence.</p>

  <p>The mapping from character information items to text nodes occurs 
  in the <loc href="#infoitem-to-element-node">infoitem-to-element-node</loc> 
  function.  The <emph>infoset-character-code</emph> accessor maps a 
  character information item to the ISO 10646 character code (in the 
  range 0 to #x10FFFF, though not every value in this range is a legal 
  XML character code) of the character.</p>

  <p role="definition" id="CharacterItem">
infoset-character-code       : (<loc href="#CharacterItem">CharacterItem</loc>) -> Code</p>

  <p>The function <emph>infoitem-to-single-character-text-node</emph> takes one character
  information item and maps it to a text node with a string value of 
  length one.</p>

  <p id="infoitem-to-single-character-text-node" role="definition">
  infoitem-to-single-character-text-node : (<loc href="#CharacterItem">CharacterItem</loc>) -> <loc href="#TextNode">TextNode</loc>
  function infoitem-to-single-character-text-node(c) {
    /* convert character code to string of length 1 */
    return <loc href="#TextNode">text-node</loc>(code2string(infoset-character-code(c)))
  }</p>

  <ednote><edtext>JM: need a definition or description of code2string.</edtext></ednote>

  <p>The <emph>collapse-text-nodes</emph> function synthesizes a single text 
  node from multiple text nodes. It calls <emph>infoitem-to-text-nodes</emph>
  to collapse recursively one or more consecutive text nodes in its argument 
  sequence.  If insignificant whitespace is ignored, any text node containing 
  only whitespace is eliminated. All other nodes  are returned unchanged.</p>

  <p id="collapse-text-nodes" role="definition">
  collapse-text-nodes    : (Sequence&lt;Node&gt;) -> Sequence&lt;Node&gt; 
  infoitem-to-text-nodes : (Sequence&lt;Node&gt;) -> Sequence&lt;Node&gt; 

  function collapse-text-nodes(nodes) {
    let newnodes := infoitem-to-text-nodes(nodes)
    return 
      if (<loc href="#flags">ignore-whitespace</loc>) then 
        <loc href="#sequence-map">sequence-map</loc>(delete-whitespace-node, newnodes)
      else newnodes
  }

  function infoitem-to-text-nodes(nodes) {
    if (<loc href="#xf_empty">xf:empty</loc>(nodes)) then return <loc href="#empty-sequence">empty-sequence</loc>()
    else
      let head := <loc href="#op_item-at">op:item-at</loc>(nodes, 1), 
          tail := <loc href="#xf_sublist">xf:sublist</loc>(nodes, 2)
      return
        if (node-kind(head) = "text") then
          /* Collapse two consecutive text nodes and apply 
             infoitem-to-text-nodes recursively */
          if (<loc href="#xf_empty">xf:empty</loc>(tail)) then head
          else if (node-kind(<loc href="#op_item-at">op:item-at</loc>(tail,1)) = "text") then 
            infoitem-to-text-nodes(
              op:concatenate(
                text-node(<loc href="#xf_concat">xf:concat</loc>(string-value(head), string-value(<loc href="#op_item-at">op:item-at</loc>(tail,1)))), 
                <loc href="#xf_sublist">xf:sublist</loc>(tail, 2)
              )
            )
          else op:concatenate(head, op:concatenate(<loc href="#op_item-at">op:item-at</loc>(tail,1), infoitem-to-text-nodes(tail)))
        else op:concatenate(head, infoitem-to-text-nodes(tail))
    }</p>

  <ednote><edtext>JM: need a definition or description of delete-whitespace-node.</edtext></ednote>

<!--  infoset-character-parent     : (<loc href="#CharacterItem">CharacterItem</loc>) -> Sequence&lt;<loc href="#ElementItem">ElementItem</loc>&gt; /* unused */
  infoset-character-whitespace : (<loc href="#CharacterItem">CharacterItem</loc>) -> <loc href="#dt-simple-typed-value">xs:boolean</loc> /* unused */
-->  
</div2>
</div1>


<div1 id="simpletypedvalue">
  <head>Simple Typed Values</head>

  <ednote><edtext>MN:
  Simple typed values were previously called simple values. The change in
  the terminology clarifies that these values are typed values and that
  "simple" refers to the type being an XML Schema simple type.
  </edtext></ednote>

  <p><termdef id="dt-simple-typed-value" term="simple typed value">A <term>simple typed   value</term> encapsulates an <emph>XML Schema simple type</emph>
  and a corresponding value of that type.</termdef></p>

  <p>An XMLSchema simple type <bibref ref="xmlschema-2"/> may be
  <emph>primitive</emph> or <emph>derived</emph>.
  The primitive simple types are named:
  <emph>xs:string</emph>, 
  <emph>xs:boolean</emph>,
  <emph>xs:decimal</emph>, 
  <emph>xs:float</emph>,
  <emph>xs:double</emph>, 
  <emph>xs:duration</emph>,
  <emph>xs:dateTime</emph>, 
  <emph>xs:time</emph>,
  <emph>xs:date</emph>, 
  <emph>xs:gYearMonth</emph>,
  <emph>xs:gYear</emph>,
  <emph>xs:gMonthDay</emph>,
  <emph>xs:gDay</emph>, 
  <emph>xs:gMonth</emph>,
  <emph>xs:hexBinary</emph>, 
  <emph>xs:base64Binary</emph>,
  <emph>xs:anyURI</emph>, 
  <emph>xs:QName</emph>,
  <emph>xs:NOTATION</emph>.
  
  A derived simple type has a primitive base type and a set of 
  constraining facets.</p> 

  <p><termdef id="dt-primvalue" term="primitive value">A <term>primitive   value</term> is a value in the union of the value spaces of the 
  nineteen primitive XML Schema data types.</termdef>  This value space   includes the value space of XML Schema derived data types where the derivation
  is done via facets, as they always limit the possible values by imposing
  restrictions. Consequently, values corresponding to XML Schema data
  types derived via facets are also primitive values.
  XML Schema simple types can be derived by list. Values corresponding
  to such types are represented by a sequence of simple typed values
  whose type is the base type.
  XML Schema simple types can be derived by union. Values corresponding
  to such types lose the union type information and store one of
  the individual types.
  </p>

  <note><p>xs:anySimpleType is not represented in the data model.  See 
  <specref ref="Issue-0036"/>.</p></note>

  <p>A simple typed value can be constructed in one of two ways
  depending on whether it is to be created from a primitive value or
  from the lexical representation of a primitive value.
  The constructor <emph>simple-typed-value</emph> takes a primitive
  value and the schema component of the corresponding simple type.
  The constructor <emph>simple-typed-value-from-string</emph> takes a
  string and the schema component of the corresponding simple type. </p>
    
  <p role="definition">
simple-typed-value             : (<loc href="#dt-primvalue">PrimitiveValue</loc>, <loc href="#SchemaComponent">SchemaComponent</loc>)
                               -> <loc href="#simpletypedvalue">SimpleTypedValue</loc>
simple-typed-value-from-string : (<loc href="#dt-primvalue">xs:string</loc>, <loc href="#SchemaComponent">SchemaComponent</loc>)
                               -> <loc href="#simpletypedvalue">SimpleTypedValue</loc></p>

  <p>The latter constructor corresponds very closely to the simple typed
  value constructors specified in <bibref ref="XFO"/>.
  Each of those constructors takes a string in the lexical space of the 
  given primitive type and returns the corresponding simple typed value.
  For example, the constructor 
  <code><loc href="#xf_integer">xf:decimal</loc>(<loc href="#xf_string">xf:string</loc>)</code>
  constructs a simple typed value of type xs:decimal from a string.
  Analogous constructors exist for the other XML Schema primitive types.</p>

  <p>The accessor <emph>value</emph> returns a simple typed value's 
  primitive value and <emph>type</emph> returns the schema component
  representing its type.
  The accessor <emph>string-value</emph> can be used to recover a
  lexical representation of the simple typed value's primitive value:
  If the simple typed value's type is primitive, it returns the
  primitive value's canonical lexical representation for that primitive
  type as specified in XML Schema Part 2 : Datatypes
  <bibref ref="xmlschema-2"/>.
  If the simple typed value's type is derived, it returns the
  primitive value's canonical lexical representation for the base type
  (which is a primitive type).</p>
    
    <p role="definition">
value         : (<loc href="#simpletypedvalue">SimpleTypedValue</loc>) -> <loc href="#dt-primvalue">PrimitiveValue</loc>
type          : (<loc href="#simpletypedvalue">SimpleTypedValue</loc>) -> <loc href="#SchemaComponent">SchemaComponent</loc>
string-value  : (<loc href="#simpletypedvalue">SimpleTypedValue</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc></p>
    
  <note>
    <p>Using the canonical lexical representation for simple typed values
	  as described above may not always be compatible with XPath 1.0.</p>
  </note>

  <p>Note that the data model does not currently represent
  key values and key reference values as described in XML Schema Part 1 : 
  Structures  <bibref ref="xmlschema-1"/>. In a future draft of this 
  document, keys and key references may be represented in the data 
  model (see <specref ref="Issue-0032"/>).</p>

  <!-- Do we want to use this example somehow ???

    <p>For example, a "Sku" type is derived from 
    string and has a <emph>pattern</emph> facet:</p>
    
    <p role="definition">&lt;simpleType name="Sku" base="string"&gt;
   &lt;pattern value="\d{3}-[A-Z]{2}"/&gt; 
&lt;/simpleType&gt;</p>
  -->

</div1>


<div1 id="sequences">
  <head>Sequences</head>

  <p>A <emph>sequence</emph> is an ordered collection of zero or more
  items. An <emph>item</emph> may be a node or a simple typed value, i.e.
  a sequence may contain nodes, simple typed values, or any mixture of
  nodes and simple typed values (see <specref ref="Issue-0035"/>).
  Unlike conventional lists, sequences are "flat", i.e., sequences may not 
  contain other sequences. Sequences may contain duplicate items.</p>

  <p>An important characteristic of the data model is that there is no
  distinction between an item (i.e., a node or a simple typed value) and a 
  singleton sequence containing that item, i.e., an item is 
  equivalent to a singleton sequence containing that item and vice 
  versa.</p>
  
  <note>
    <p>Sequences replace node-sets from XPath 1.0.  In XPath 1.0, 
    node-sets do not contain duplicates.  In generalizing node-sets to 
    sequences in XPath 2.0, duplicate removal is provided by functions 
    on node sequences.</p>
  </note>
  
  <note><p>See <specref ref="Issue-0025"/>.</p></note>
  
  <p>A collection of documents is represented in the data model as a 
  sequence of document nodes (see <specref ref="Issue-0023"/>).</p>

  <p>A sequence has no identity.  Equality comparison of sequences is 
  performed only by comparing the items of the sequences.</p>

  <p>The <emph>string-value</emph> of a sequence containing simple typed
  values only is obtained by inserting a <code>#x20</code> (space)
  separator between the <emph>string-value</emph>s of the individual
  members of the sequence and concatenating the result.</p>
  
  <p>The <emph>string-value</emph> of a sequence containing any item
  other than a simple typed value is the concatenation of the
  <emph>string-value</emph>s of the individual members of the sequence.
  In particular the string value of an empty sequence is an empty string.
  </p>
  
  <p>The constructor <emph>empty-sequence</emph> constructs the empty 
  sequence.  The n-ary <emph>op:concatenate</emph> constructor creates a new 
  sequence containing the values in its first argument followed by 
  the concatenated values of its second through final arguments.
  In the function signatures below UnitValue refers to the category of
  nodes or simple typed values.
  Since a unit value is equivalent to a singleton sequence containing the
  unit value, <emph>op:concatenate</emph> may be applied to unit values.</p>
  
  <p role="definition" id="empty-sequence">
empty-sequence : Sequence&lt;<emph>UnitValue</emph>&gt;
op:concatenate         : (Sequence&lt;<emph>UnitValue</emph>&gt;, ..., Sequence&lt;<emph>UnitValue</emph>&gt;)
               -> Sequence&lt;<emph>UnitValue</emph>&gt;</p>  

  <p>A sequence has several accessors. They are defined in <bibref ref="XFO"/>.
  In this document the following four accessors are used.
  The <emph>empty</emph> accessor returns a boolean indicating whether or
  not the specified sequence is empty.
  The <emph>item-at</emph> accessor returns the item in the sequence that
  is located at the specified index.
  The <emph>sublist</emph> accessor returns the contiguous sequence of items
  beginning at the specified position and continuing to the end of the
  sequence. 
  The <emph>count</emph> function returns the number of items in the sequence. 
  </p>

  <p role="definition">
empty   : (Sequence&lt;<emph>UnitValue</emph>&gt;) -> xs:boolean
item-at : (Sequence&lt;<emph>UnitValue</emph>&gt;,xs:decimal) -> <emph>UnitValue</emph>
sublist : (Sequence&lt;<emph>UnitValue</emph>&gt;,xs:decimal) -> Sequence&lt;<emph>UnitValue</emph>&gt;
count   : (Sequence&lt;<emph>UnitValue</emph>&gt;) -> xs:unsignedInt</p>

</div1>

<div1 id="error">
  <head>Error</head>

  <p>The data model includes a distinguished error value, called
  <emph>error</emph>.   Note that <emph>error</emph> cannot occur in 
  the content of any node in the data model, nor may it occur in any
  sequence (see <specref ref="Issue-0047"/>).  The error object is 
  defined so that functions or operators have a mechanism for 
  identifying an error condition.  How the error value is handled in 
  a query processor is implementation-defined (see 
  <specref ref="Issue-0048"/>).</p>
  
</div1>

<div1 id="types">
  <head>Schema Components</head>

   <table role="node-summary">
    <thead>
      <tr><td>Schema Component accessors</td><td>possible values</td></tr>
    </thead>
    <tbody>
      <tr><td>component-kind</td><td>xs:string</td></tr>
      <tr><td>parent</td><td>sequence of zero or one SchemaComponents</td></tr>
      <tr><td>base</td><td>SchemaComponent</td></tr>
      <tr><td>derived-by-extension</td><td>xs:boolean</td></tr>
      <tr><td>derived-by-restriction</td><td>xs:boolean</td></tr>
      <tr><td>name</td><td>xs:QName</td></tr>
    </tbody>
  </table>

  <p>This section requires some familiarity with the <bibref ref="XSFD"/>.
  In the data model, the <bibref ref="XSFD"/> (XFSD) components are 
  represented by four kinds of schema-component values:
  <emph>element-declaration</emph>,
  <emph>attribute-declaration</emph>,
  <emph>simple-type-definition</emph>, and 
  <emph>complex-type-definition</emph>.
  A <emph>schema component</emph> collectively refers to these four kinds
  of values.</p>

  <p>According to <bibref ref="XSFD"/>, the <emph>name</emph> of an XSFD 
  component has the form 
  <emph>i</emph>#<emph>sn</emph><sub>1</sub>/.../<emph>sn</emph><sub>k</sub>,
  where <emph>sn</emph><sub>k</sub> = <emph>ss</emph>::<emph>j</emph>.
  The symbol <emph>i</emph> is a namespace, <emph>ss</emph> is one of 
  six symbol spaces (<code>element</code>, <code>attribute</code>, 
  <code>type</code>, <code>attributeGroup</code>, <code>modelGroup</code>, 
  or <code>notation</code>), and <emph>j</emph> is an NCName.</p>
  
  <p>Given an XSFD component <emph>f</emph> with <emph>name</emph>,
  <emph>base</emph>, <emph>derivation</emph>, and <emph>refinement</emph>
  fields, the corresponding Schema Component value has the following 
  properties:</p>

  <p>A schema component has an <emph>expanded-QName</emph> corresponding
  to the <emph>name</emph> field of <emph>f</emph>.  The namespace URI 
  is equal to the <emph>i</emph> component of the name.
  If <emph>j</emph> = *, the local part is equal to empty string, 
  otherwise the local part is equal to the <emph>j</emph> component of
  the name.  For example, given the XSFD component name
  <code>http://www.example.com/baz.xsd#type::u/element::d/type::*/element::a</code>,
  the namespace URI is <code>http://www.example.com/baz.xsd</code> and
  the local part is <code>a</code>.</p>

  <p>The <emph>parent</emph> is the schema component representing
  the XSFD component with the <emph>name</emph> 
  <emph>i</emph>#<emph>sn</emph><sub>1</sub>/.../<emph>sn</emph><sub>(k-1)</sub>,
  unless <emph>k</emph> = 1, in which case the <emph>parent</emph>
  is the empty sequence.</p>

  <p>The <emph>base</emph> is the schema component corresponding to the
  XSFD component whose name is that of the <emph>base</emph> field of
  XSFD component <emph>f</emph>.</p>

  <p>If <emph>derivation</emph> is <emph>"extension"</emph>, 
  the <emph>derived-by-extension</emph> property is true; otherwise it
  is false.</p>

  <p>If <emph>derivation</emph> is <emph>"restriction"</emph>, 
  the <emph>derived-by-refinement</emph> property is true; otherwise it 
  is false.</p>

  <note><p>The <emph>abstract</emph>, <emph>refinement</emph> and 
  <emph>content</emph> fields of an XSFD component are not represented
  by Schema Components (<specref ref="Issue-0031"/>).  Facets and
  substitution groups are not represented by Schema Components 
  (<specref ref="Issue-0011"/> and <specref ref="Issue-0066"/>).
  Also see <specref ref="Issue-0022"/> and <specref ref="Issue-0056"/>.</p></note>
    
  <p> A <emph>SchemaComponent</emph> has the following accessors.
  The <emph>component-kind</emph> accessor returns the string
  <emph>"element-declaration"</emph>, <emph>"attribute-declaration"</emph>,
  <emph>"simple-type-definition"</emph>, or
  <emph>"complex-type-definition"</emph>.  The other accessors are 
  defined above.  See <specref ref="Issue-0049"/>.</p>
  
<p role="definition" id="SchemaComponent">
component-kind        : (SchemaComponent) -> xs:string
name                  : (SchemaComponent) -> xs:QName
parent                : (SchemaComponent) -> Sequence(0,1)&lt;SchemaComponent&gt;
base                  : (SchemaComponent) -> SchemaComponent
derived-by-extension  : (SchemaComponent) -> xs:boolean
derived-by-refinement : (SchemaComponent) -> xs:boolean
</p>

<div2>
  <head>Mapping PSV Infoset additions to Schema Components</head>

  <p>This section specifies how the schema component of an element 
  or attribute node is constructed from the PSV Infoset additions 
  that specify validity and type assessment for the node's corresponding 
  information item.</p>

  <p>We note that each kind of XSFD component has a corresponding
  "top-most" or "root" component, named <emph>xs:anyElement</emph>, 
  <emph>xs:anyAttribute</emph>, <emph>xs:anySimpleType</emph>, 
  <emph>xs:anyComplexType</emph>. These root components represent 
  the most general element, attribute, simple type, and complex type.
  We assume these components are pre-defined and rely on them in the
  definitions below.</p>

  <p>A PSV element (attribute) information item has a 
  <emph role="infoset-property">validity</emph>, 
  an <emph role="infoset-property">element-declaration</emph>
  (<emph role="infoset-property">attribute-declaration</emph>), and
  a <emph role="infoset-property">type-definition</emph> property.
  The <emph role="infoset-property">validity</emph> property may be
  <emph>"valid"</emph>, <emph>"invalid"</emph>, or <emph>"notKnown"</emph>.
  The <emph role="infoset-property">element-declaration</emph>
  (<emph role="infoset-property">attribute-declaration</emph>)
  property contains an element information item that is
  isomorphic to the XML Schema element or attribute declaration of the 
  element or attribute information item.  Similarly, 
  the <emph role="infoset-property">type-definition</emph>
  property contains an element information item that is
  isomorphic to the XML Schema type definition of the 
  element or attribute information item.
  These properties are used to construct the schema 
  component of an element or attribute in the data model.</p>

  <p>The <emph>infoitem-to-schema-component</emph> function
  takes a string-valued validity property and an element information item
  that corresponds to an element or attribute declaration or a type
  definition.  It constructs a schema-component value that
  corresponds to the schema component represented by its
  arguments. </p>

  <p id="infoitem-to-schema-component" role="definition">
  infoitem-to-schema-component : (xs:string, <loc href="#ElementItem">ElementItem</loc>) -> <loc href="#SchemaComponent">SchemaComponent</loc>
  </p>

  <p>If its <emph role="infoset-property">validity</emph> property is
  <emph>"valid"</emph>, <emph>infoitem-to-schema-component</emph> constructs a
  schema component that corresponds to the element or attribute
  declaration or type definition represented by the element information 
  item in its second argument.</p>

  <p>If its <emph role="infoset-property">validity</emph> property is
  <emph>"invalid"</emph> or <emph>"notKnown"</emph>,
  <emph>infoitem-to-schema-component</emph> returns the "root" schema component
  that corresponds to the element or attribute declaration or type
  definition represented by the information item in its second
  argument.  For example, if the information item is an element
  declaration, <emph>infoitem-to-schema-component</emph> returns
  <emph>xs:anyElement</emph>, and similarly, for the other three
  components.  The only information that can be inferred from an
  invalid or not known validity value is that the information item is
  well-formed, therefore, we must associate the most general type
  information with the element or attribute node.</p>

  <ednote><edtext>MF:
  Following two cases need to be completed:
  </edtext></ednote>

  <p>Given information items that validate with respect to a DTD, ...
  </p>

  <p>Given information items from a document 
  a well-formed document, with no corresponding DTD or Schema...
  </p>

  <ednote><edtext>MF cite James' notes:
  Given an XSFD normalized attribute or element x[t types d], the
  declaration accessor would return deref(x) and the type accessor would
  return deref(t).

  Note that for any element or attribute node nd, if declaration(x) is not
  null, then

  local-name(x) = local-name(declaration(x)), and
  namespace-uri(x) = namespace-uri(declaration(x))
  </edtext></ednote>

</div2>
</div1>
</body>

<back>
<div1>
  <head>XML Information Set Conformance</head>

  <p>This specification conforms to the XML Information Set <bibref ref="xml-infoset"/>.
  The following information items must be exposed by the infoset producer 
  to construct an instance of the data model:</p>
    
  <ulist>
    <item><p>The <emph role="info-item">Document Information Item</emph> with
             <emph role="infoset-property">base URI</emph> and
             <emph role="infoset-property">children</emph> properties.</p></item>
             
    <item><p><emph role="info-item">Element Information Items</emph> with
             <emph role="infoset-property">children</emph>,
             <emph role="infoset-property">attributes</emph>,
             <emph role="infoset-property">in-scope namespaces</emph>,
             <emph role="infoset-property">local name</emph>,
             <emph role="infoset-property">namespace name</emph>,
             <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>,
             <emph role="infoset-property">normalized value</emph>,
             <emph role="infoset-property">owner element</emph> properties.</p></item>

    <item><p><emph role="info-item">Character Information Items</emph> with
             <emph role="infoset-property">character code</emph> and
             <emph role="infoset-property">parent</emph> properties.</p></item>

    <item><p><emph role="info-item">Processing Instruction Information Items</emph> with
             <emph role="infoset-property">target</emph>,
             <emph role="infoset-property">content</emph> and
             <emph role="infoset-property">parent</emph> properties.</p></item>

    <item><p><emph role="info-item">Comment Information Items</emph> with
             <emph role="infoset-property">content</emph> and
             <emph role="infoset-property">parent</emph> properties.</p></item>

    <item><p><emph role="info-item">Namespace Information Items</emph> with
             <emph role="infoset-property">prefix</emph> and
             <emph role="infoset-property">namespace name</emph> properties.</p></item>
  </ulist>
  
  <p>Other information items and properties made available by the
  Infoset processor are ignored.  In addition to the properties above, 
  the following properties from the PSV Infoset are required:</p>
  
  <ulist>
    <item><p><emph role="infoset-property">validity</emph>, 
             <emph role="infoset-property">element declaration</emph>,
             <emph role="infoset-property">type definition</emph>, and
             <emph role="infoset-property">schema normalized value</emph> properties on
             <emph role="info-item">Element Information Items</emph>.</p></item>

    <item><p><emph role="infoset-property">attribute declaration</emph>, 
             <emph role="infoset-property">type definition</emph>, and  
             <emph role="infoset-property">schema normalized value</emph> properties on
             <emph role="info-item">Attribute Information Items</emph>.</p></item>
  </ulist>

</div1>

<div1>
<head>References</head>
<blist>

<bibl id="xml-infoset" key="XML Information Set">
  World Wide Web Consortium, 
  <emph>XML Information Set (Infoset)</emph>.
  See <loc href="http://www.w3.org/TR/xml-infoset/">http://www.w3.org/TR/xml-infoset/</loc>.
</bibl>

<bibl id="xml-rec" key="XML Recommendation">
  World Wide Web Consortium, 
  <emph>Extensible Markup Language (XML) 1.0 (Second Edition)</emph>
  See <loc href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</loc>.
</bibl>

<bibl id="XFO" key="XQuery 1.0 and XPath 2.0 Functions and Operators">
  World Wide Web Consortium, 
  <emph>XQuery 1.0 and XPath 2.0 Functions and Operators</emph>.
  See <loc href="http://www.w3.org/TR/xquery-operators/">http://www.w3.org/TR/xquery-operators/</loc>.
</bibl>

<bibl id="XSFD" key="XML Schema: Formal Description">
  World-Wide Web Consortium
  <emph>XML Schema: Formal Description</emph>, Working Draft, 
  March 2001. 
  See <loc href="http://www.w3.org/TR/xmlschema-formal/">http://www.w3.org/TR/xmlschema-formal/</loc>.
</bibl>

<bibl id="xmlschema-1" key="XMLSchema Part 1">
  World Wide Web Consortium, 
  <emph>XML Schema Part 1: Structures</emph>.
  See <loc href="http://www.w3.org/TR/xmlschema-1/">http://www.w3.org/TR/xmlschema-1</loc>.
</bibl>

<bibl id="xmlschema-2" key="XMLSchema Part 2">
  World Wide Web Consortium, 
  <emph>XML Schema Part 2: Datatypes</emph>.
  See <loc href="http://www.w3.org/TR/xmlschema-2/">http://www.w3.org/TR/xmlschema-2</loc>.
</bibl>

</blist>
</div1>
<inform-div1>
<head>References</head>
<blist>
<bibl key="XML Query Data Model" id="XQDM00">
  World-Wide Web Consortium
  <emph>XML Query Data Model</emph>, Working Draft, Feb 2001.
  See <loc href="http://www.w3.org/TR/2001/WD-query-datamodel-20010215/">http://www.w3.org/TR/2001/WD-query-datamodel-20010215/</loc>.
</bibl>

<bibl id="xml-activity" key="XML Activity">
  World Wide Web Consortium, 
  <emph>XML Activity</emph>. 
  Home page: <loc href="http://www.w3.org/XML/">http://www.w3.org/XML/</loc>.
</bibl>

<bibl key="XPath" id="XPath">
  World-Wide Web Consortium
  <emph>XML Path Language (XPath)</emph>: Version 1.0. 
  November, 1999. 
  See <loc href="http://www.w3.org/TR/xpath.html">http://www.w3.org/TR/xpath.html</loc>.
</bibl>

<bibl id="XPathReq" key="XPath Requirements Version 2.0">
  World Wide Web Consortium, 
  <emph>XPath Requirements Version 2.0</emph>.
  See <loc href="http://www.w3.org/TR/xpath20req">http://www.w3.org/TR/xpath20req</loc>.
</bibl>

<bibl id="xpointer" key="XML Pointer Language (XPointer)">
  World Wide Web Consortium, 
  <emph>XML Pointer Language (XPointer)</emph>.
  See <loc href="http://www.w3.org/TR/xptr/">http://www.w3.org/TR/xptr/</loc>.
</bibl>

<bibl id="XSLT2" key="XSLT 2.0">
  World Wide Web Consortium, 
  <emph>XSL Transformations Language (XSLT)</emph>: Version 2.0. 
  See <loc href="http://www.w3.org/TR/xslt20/">http://www.w3.org/TR/xslt20/</loc>.
</bibl>

<bibl id="XSLT" key="XSLT 1.0">
  World Wide Web Consortium, 
  <emph>XSL Transformations Language (XSLT)</emph>: Version 1.0. 
  See <loc href="http://www.w3.org/TR/xslt">http://www.w3.org/TR/xslt</loc>.
</bibl>

<bibl id="XQFS" key="XQuery 1.0 Formal Semantics">
  World Wide Web Consortium, 
  <emph>XQuery 1.0 Formal Semantics</emph>.
  See <loc href="http://www.w3.org/TR/query-semantics/">http://www.w3.org/TR/query-semantics/</loc>
</bibl>

<bibl id="XQWG" key="XML Query Working Group">
  World Wide Web Consortium, 
  <emph>XML Query Working Group</emph>.
  Home page: <loc href="http://www.w3.org/XML/Activity#query-wg">http://www.w3.org/XML/Activity#query-wg</loc>.
</bibl>

<bibl id="XSLWG" key="XSL Working Group">
  World Wide Web Consortium, 
  <emph>XSL Working Group</emph>.
  Home page: <loc href="http://www.w3.org/Style/XSL/">http://www.w3.org/Style/XSL/</loc>.
</bibl>

<bibl id="XQuery" key="XQuery 1.0: A Query Language for XML">
  World Wide Web Consortium, 
  <emph>XQuery 1.0: A Query Language for XML</emph>.
  See <loc href="http://www.w3.org/TR/xquery/">http://www.w3.org/TR/xquery/</loc>.
</bibl>

<bibl id="XQueryReq" key="XML Query Requirements">
  World Wide Web Consortium, 
  <emph>XML Query Requirements</emph>.
  See <loc href="http://www.w3.org/TR/2001/WD-xmlquery-req-20010215">http://www.w3.org/TR/2001/WD-xmlquery-req-20010215</loc>.
</bibl>
</blist></inform-div1>
<inform-div1>  <head>Example</head>  
  <p>We use the following XML document to illustrate the information   contained in an instance of the data model:</p>
<eg><![CDATA[<?xml version="1.0"?>
<p:part xmlns:p="http://www.example.com/PartSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation = "http://www.example.com/PartSchema
                              http://www.example.com/PartSchema"
        name="nutbolt">
  <p:mfg>Acme</p:mfg>
  <p:price>10.50</p:price>
</p:part>]]></eg>
<p>The document is associated with the URI "http://www.example.com/partlist/part0001.xml",and is valid with respect to the following XML schema:</p>
<eg><![CDATA[<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.example.com/PartSchema"
           xmlns="http://www.example.com/PartSchema">
  <xs:element name="part" type="part-type"/>
  <xs:complexType name="part-type">
    <xs:element name="mfg" type="xs:string"/>
    <xs:element name="price" type="xs:decimal"/>
    <xs:attribute name="name" type="xs:string"/>
  </xs:complexType>
</xs:schema>]]></eg>
<p>For this example, we chose an XML document and an XML Schema 
that illustrates the relationship between 
document content and its associated schema type information. 
In general, an XML Schema is not required,
that is, the data model can represent a schemaless, well-formed XML
document with the rules described in <specref ref="types"/>.</p>
<p>The XML document is represented by the data-model constructors below.
The value <emph>D1</emph> represents a document node; 
the values <emph>E1, E2, etc.</emph> represent element nodes; 
the values <emph>A1, ...</emph> represent attribute nodes;
the values <emph>N1, ...</emph> represent namespace nodes;
the values <emph>T1, ...</emph> represent text nodes;
the values <emph>SC1, ...</emph> represent schema component values.Accessors that return a constant value for that node type are omitted.</p>
<p role="definition">
// Document node D1
base-uri(D1)     = <loc href="#xf_anyURI">xf:anyURI</loc>("http://www.example.com/partlist/part0001.xml")string-value(D1) = <loc href="#xf_string">xf:string</loc>("\n  Acme\n  10.50\n")
children(D1)     = E1
// Element node E1
name(E1)         = <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>("http://www.example.com/PartSchema", "part")
base-uri(E1)     = <loc href="#xf_anyURI">xf:anyURI</loc>("http://www.example.com/partlist/part0001.xml")string-value(E1) = <loc href="#xf_string">xf:string</loc>("\n  Acme\n  10.50\n")typed-valued(E1) = ()
parent(E1)       = D1
children(E1)     = (T1, E2, T3, E3, T5)
attributes(E1)   = A1
namespaces(E1)   = (N1, N2)
declaration(E1)  = SC1
type(E1)         = SC2
unique-ID(E1)    = ()// Attribute node A1
name(A1)         = <loc href="#xf_QName">xf:QName</loc>("name")
string-value(A1) = <loc href="#xf_string">xf:string</loc>("nutbolt")
typed-value(A1)  = <loc href="#xf_string">xf:string</loc>("nutbolt")
parent(A1)       = E1
declaration(A1)  = SC3
type(A1)         = SC4
// Namespace node N1
name(N1)         = <loc href="#xf_QName">xf:QName</loc>("xml")
string-value(N1) = <loc href="#xf_string">xf:string</loc>("http://www.w3.org/XML/1998/namespace")

// Namespace node N2
name(N2)         = <loc href="#xf_QName">xf:QName</loc>("p")
string-value(N2) = <loc href="#xf_string">xf:string</loc>("http://www.example.com/PartSchema")

// Element node E2
name(E2)         = <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>("http://www.example.com/PartSchema", "mfg")
base-uri(E2)     = <loc href="#xf_anyURI">xf:anyURI</loc>("http://www.example.com/partlist/part0001.xml")string-value(E2) = <loc href="#xf_string">xf:string</loc>("Acme")typed-value(E2)  = simple-value("Acme", SC4)
parent(E2)       = E1
children(E2)     = T2
attributes(E2)   = ()
namespaces(E2)   = (N1, N2)
declaration(E2)  = SC5
type(E2)         = SC4
unique-ID(E2)    = ()// Element node E3
name(E3)         = <loc href="#xf_QName-from-uri">xf:QName-from-uri</loc>("http://www.example.com/PartSchema", "price")
base-uri(E3)     = <loc href="#xf_anyURI">xf:anyURI</loc>("http://www.example.com/partlist/part0001.xml")string-value(E3) = <loc href="#xf_string">xf:string</loc>("Acme")typed-value(E3)  = simple-value(10.50, SC7)
parent(E3)       = E1
children(E3)     = T3
attributes(E3)   = ()
namespaces(E3)   = (N1, N2)
declaration(E3)  = SC6
type(E3)         = SC7

// Text node T1
string-value(T1) = <loc href="#xf_string">xf:string</loc>("\n  ")
parent(T1)       = E1
// Text node T2
string-value(T2) = <loc href="#xf_string">xf:string</loc>("Acme")
parent(T2)       = E2
// Text node T3
string-value(T3) = <loc href="#xf_string">xf:string</loc>("\n  ")
parent(T3)       = E1
// Text node T4
string-value(T4) = <loc href="#xf_string">xf:string</loc>("10.50")
parent(T4)       = E3
// Text node T5
string-value(T5) = <loc href="#xf_string">xf:string</loc>("\n")
parent(T5)       = E1

// Schema component SC1
component-kind(SC1)        = "element-declaration"
name(SC1)                  = 
  xf:QName-from-uri("http://www.example.com/PartSchema", "part")
parent(SC1)                = <loc href="#empty-sequence">empty-sequence</loc>()
base(SC1)                  = xs:anyElement
derived-by-extension(SC1)  = false
derived-by-refinement(SC1) = true

// Schema component SC2 
component-kind(SC2)        = "type-definition"
name(SC2)                  = 
  xf:QName-from-uri("http://www.example.com/PartSchema", "part-type")
parent(SC2)                = SC1
base(SC2)                  = xs:anyComplexType
derived-by-extension(SC2)  = false
derived-by-refinement(SC2) = true

// Schema component SC3
component-kind(SC3)        = "attribute-declaration"
name(SC3)                  = 
  xf:QName-from-uri("http://www.example.com/PartSchema", "name")
parent(SC3)                = SC1
base(SC3)                  = xs:anyAttribute
derived-by-extension(SC3)  = false
derived-by-refinement(SC3) = true

// Schema component SC4
component-kind(SC4)        = "simple-type-definition"
name(SC4)                  = 
  xf:QName-from-uri("http://www.w3.org/1999/XMLSchema", "string")
parent(SC4)                = <loc href="#empty-sequence">empty-sequence</loc>()
base(SC4)                  = xs:anySimpleType
derived-by-extension(SC4)  = false
derived-by-refinement(SC4) = true

// Schema component SC5
component-kind(SC5)        = "element-declaration"
name(SC5)                  = 
  xf:QName-from-uri("http://www.example.com/PartSchema", "mfg")
parent(SC5)                = SC2
base(SC5)                  = xs:anyElement
derived-by-extension(SC5)  = false
derived-by-refinement(SC5) = true

// Schema component SC6
component-kind(SC6)        = "element-declaration"
name(SC6)                  = 
  xf:QName-from-uri("http://www.example.com/PartSchema", "price")
parent(SC6)                = SC2
base(SC6)                  = xs:anyElement
derived-by-extension(SC6)  = false
derived-by-refinement(SC6) = true

// Schema component SC7
component-kind(SC7)        = "simple-type-definition"
name(SC7)                  = 
  xf:QName-from-uri("http://www.w3.org/1999/XMLSchema", "decimal")
parent(SC7)                = <loc href="#empty-sequence">empty-sequence</loc>()
base(SC7)                  = xs:anySimpleType
derived-by-extension(SC7)  = false
derived-by-refinement(SC7) = true
</p>
<!--
<p>
A graphical depiction of the
data-model instance, containing the information described in
the text above, is also included.
</p>
<p>
<graphic source="picture.xfig.gif" alt="Graphical depiction of data
model instance."/> 
</p>
-->
<ednote><edtext>MF: New graphic is needed here.</edtext></ednote>
</inform-div1>

<inform-div1 id="appendix-issues-list">  <head>Issues</head>  
  <p>The issues in this section serve as a 
  design history for this document. The ordering of issues is irrelevant. 
  Each issue has a unique id of the form Issue-&lt;dddd&gt; (where d is 
  a digit). This can be used for referring to the issue by 
  &lt;url-of-this-document&gt;#Issue-&lt;dddd&gt;.  Furthermore, each 
  issue has a mnemonic header, a date, an optional description, and an 
  optional resolution. For convenience, resolved issues are displayed 
  in green.  Some of the issues contain references to W3C internal 
  archives. These are marked with "members only". Some of the 
  descriptions of the resolved issues are obsolete w.r.t. to the 
  current version of the document.</p>

<issue id="Issue-0001" date="Oct-2000" raisedby="Datamodel Editors" status="closed">
  <head>PSV Infoset identity constraints</head>
  <description>
    <p>What should be data-model representation, if any, of PSV Infoset
    identity-constraint tables?</p>
  </description>
  <resolution date="17-August-2001">
    <p>JM: Duplicate of <specref ref="Issue-0032"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0002"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
  <head>Representation of atomic values</head>
  <description>
    <p>This function assumes that the character information items for an
    atomic value (e.g., string, integer, floating-point number) are
    not interleaved with other information items (e.g., PIs or comments).
    The treatment of such interleaved values is not handled in this
    definition.  This issue is addressed in threads beginning at: 
    <loc href="http://lists.w3.org/Archives/Member/w3c-archive/2000Jun/0090.html">
    http://lists.w3.org/Archives/Member/w3c-archive/2000Jun/0090.html (members only)</loc>
    and 
    <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000Sep/0079.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000Sep/0079.html (members only)</loc>.</p>
  </description>
  <resolution date="15-Jan-2001"><p>MF: The data model does not
    preserve information items interleaved with the character info items
    of an atomic value.</p>
  </resolution>
</issue>

<issue id="Issue-0003"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
  <head>Example parent</head>
  <description>
    <p><emph>Remark Michael:</emph> An IDREF cannot point to an empty 
    string.</p>
  </description>
  <resolution date="17-August-2001">
    <p>JM: Issue is obsolete, probably had something to do with Reference
    Nodes, which have been removed.</p>
  </resolution>
</issue>

<issue id="Issue-0004"  date="Oct-2000" raisedby="Datamodel Editors">
  <head>Schema/DTD</head>
  <description>
    <p>A document may refer to a DTD and have an associated schema.
    Currently, content model from the DTD is ignored, as are unique
    IDs from the schema.  A coherent priority or merging strategy
    is needed.</p>
  </description>
</issue>

<issue id="Issue-0005"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
  <head>Lists of Simple Values</head>
  <description>
    <p>The current data model draft takes only into account
    singleton value-nodes.  It must represent lists of simple-type 
    values as well.  See <loc
    href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000May/0060.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000May/0060.html</loc> (members only).</p>
    <p>Peter suggests having a special-purpose kind of a TextNode that
    represents lists of simple types.
    An advantage of this approach is that the constraint that lists of
    simple types be homogeneous/monomorphic can be enforced. 
    However, lists/forests already can be modeled in current data model, without
    adding more complexity. 
    For example, an attribute's value could be modeled as a list of TextNodes:</p>
    <p role="definition">
    value    : (<loc href="#AttributeNode">AttributeNode</loc>)  -> Sequence&lt;<loc href="#TextNode">TextNode</loc>&gt;
    </p>
    <p>A disadvantage of this approach is that the 
    monomorphism constraint on lists derived from simple types is not
    enforced.
    However, given a type system for Query, such a constraint could
    be enforced.  So Mary is in favor of not having a special-purpose
    kind of TextNode to represent lists, but instead model them by 
    forests directly in the data model.</p>
    <p>JM: note that the pseudo-code doesn't appear to handle schema list
    values.</p>
  </description>
  <resolution date="30-Oct-2001">
    <p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Oct/0358.html">decision record</loc> (members only).</p>
  </resolution>
</issue>

<issue id="Issue-0006"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
  <head>Collections</head>
  <description>
    <p>We need a more thorough definition of collections, perhaps 
    in a separate section, which includes bags and defines collections 
    formally.</p>
    <p>In particular, the algebra (probably) will not support arbitrarily
    nested collections (i.e., lists of lists, sets of sets, etc.).  We
    need to specify how collections are constructed.  For example, 
    in the data model, the basic collection is a forest, i.e., a list of
    Nodes.  The forest constructor creates a singleton forest from one
    Node; or it creates a forest from two forests by concatenating
    the two forests:</p>
    <eg>
    Forest = Node | Sequence&lt;Node&gt;

    forest : (Node) -> Forest
    function forest(Node n) =  Sequence&lt;n&gt;

    union : (Forest, Forest) -> Forest
    function union(f1, f2) = list-append f1 f2

    bagunion : (NodeBag, NodeBag) -> NodeBag
    setunion : (NodeSet, NodeSet) -> NodeSet
    </eg>
    <p>Similar constructors would exist for bags with and
    without duplicates.</p>
    <p role="definition">
    unordered : (Forest) -> NodeBag
    unique    : (NodeBag) -> NodeSet
    set = unique o unordered : (Forest) -> NodeSet
    </p>
  </description>
  <resolution date="15-Jan-2001"><p>Added section on Collections
    <specref ref="sequences"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0007"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
  <head>Text Nodes</head>
  <description>
    <p>An alternative representation is to have a single TextNode 
    whose base type is string:</p>
    <p role="definition">
      text-node  : (xs:string, S, Sequence&lt;Node&gt;) -> <loc href="#TextNode">TextNode</loc>
    </p>
    <p>This representation is more closely aligned with other node types
    in the data model, but it makes the simple type of leaf-node values 
    opaque.</p>
    <p>Peter Fankhauser compares and constrasts these options in : 
    <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000Apr/0174.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2000Apr/0174.html</loc>
    (members only).</p>
  </description>
  <resolution date="30-Oct-2001">
    <p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Oct/0358.html">decision record</loc> (members only).</p>
  </resolution>
</issue>

<issue id="Issue-0008"  date="Oct-2000" raisedby="Michael Rys" status="closed">
  <head>Node vs edge centric data model</head>
  <description>
    <p><emph>Cite:</emph></p>
    <p>Let me summarize my issues with a node-centric datamodel right 
    at the beginning. The first two are mentioned in the doc
    later on:</p>
    <p>As long as (1) the data represents a tree, (2) easy bi-directional 
    is not required, (3) projection/extension operations with object-preserving
    semantics are not required, a node-centric datamodel is isomorphic to an
    edge-centric datamodel and is easier to represent and understand.</p>
    <p>As soon as anyone of the above requirements change, an edge model 
    has several advantages:</p>
    <olist>
      <item>
        <p>data represents a graph: naming the edges (relationships) 
        becomes a must, since the names are now on the relationships and not 
        on the objects.  Uniform treatment of all edges (even the so far 
        anonymous containment edges) makes defining operations easier since 
        they are more orthogonal. With the possibility of distinguishing 
        "type" from "name", even subelement names now semantically represent 
        relationship names. For example, ShipAddr and BillAddr in</p>
        <p>
          &lt;Order&gt;
            &lt;ShipAddr dt:dt="Address"&gt;...&lt;/ShipAddr&gt;
            &lt;BillAddr dt:dt="Address"&gt;...&lt;/BillAddr&gt;
          &lt;/Order&gt;
        </p>
        <p>are denoting relationships (ownership to be exact) from the 
        order element to the Address elements.</p>
      </item>
      <item>
        <p>As soon as backwards pointers are introduced into a 
        node-centric model, the representation becomes more complex and 
        less elegant. Transforming data becomes more complex since the 
        backwards pointer becomes part of the object state. Thus, if I 
        define views where an element changes the parent, in the
        edge-centric case, this just adds a new relationship, the object 
        state is unchanged, in the node-centric approach, I need to 
        express now two parents in the object state.</p>
      </item>
      <item>
        <p>Projection/extension operations. Assume that I pose a query 
        that projects name and address but hides the age of a person 
        element. In the edge-centric approach, this means that the 
        query logically transforms the graph context on which the query 
        operates by removing the age edge from the context without 
        touching the object state (the objects keeps its basetype),
        in the node-centric approach, the object state needs to change 
        since the context transformation will remove the attribute 
        property age. While both operations transform the context, 
        I find the former to be more elegant than the later.</p>
      </item>
    </olist>
  </description>
  <resolution date="15-Jan-2001">
    <p>MF: To align with XPath 1.0 and the Algebra,
    the data model is node centric.</p>
  </resolution>
</issue>

<issue id="Issue-0009"  date="Oct-2000" raisedby="Michael Rys">
  <head>Schema info</head>
  <description>
    <p><emph>Cite:</emph>Sometimes one wants to use different schemata 
    over the same basic XML fragment. So I would rather start with that 
    in principle, the data model is schemaless and can provide the data 
    model of any XML fragment given a schema.  Thus, the schema 
    postprocessing becomes a datamodel transformation that we make 
    explicit (and that could be optimized with other operations that
    transform the datamodel graph).</p>
  </description>
</issue>

<issue id="Issue-0010"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
  <head>Node identity</head>
  <description>
    <p>Should the data model require that an implementation guarantee 
    that the identity of a node is always preserved?</p>
  </description>
  <resolution date="15-Jan-2001">
    <p>MF: The data model always preserves node identity; the only 
    operator that does not preserve node identity is <code>copy</code>.</p>
  </resolution>
</issue>

<issue id="Issue-0011" date="Oct-2000" raisedby="Datamodel Editors">
  <head>Access to facets</head>
  <description>
    <p>In XML Schema, facets such as "nullable" is associated with 
    an <emph>element declaration</emph>, which is a element name, 
    complex type pair.   If the query language needs access to such 
    facets, we may need to replace <emph>ReferenceNode</emph> by a 
    reference to the element declaration.</p>
  </description>
</issue>

<issue id="Issue-0012"  date="Oct-2000" raisedby="Michael Rys" status="closed">
  <head>Representation of reference values</head>
  <description>
    <p><emph>Cite:</emph>  The current representation of reference 
    values is too much IDREF(S) centric. I would prefer a more general 
    representation for XLink and the schema (and potentially graph 
    operation) introduced reference mechanisms.</p>
  </description>
  <resolution date="13-August-2001">
    <p>JM: Removed reference nodes.</p>
  </resolution>
</issue>

<issue id="Issue-0013" date="17-Jan-2001" raisedby="Mary Fernandez" status="closed">
  <head>Equality operators on collections</head>
  <description>
    <p>Equality operators '=' on collections are not defined.</p>
  </description>
  <resolution date="27-March-2001">
    <p>MF: Added Functions (subsequently removed to Functions and Operators spec).</p>
  </resolution>
</issue>

<issue id="Issue-0014" date="17-Jan-2001" raisedby="Mary Fernandez" status="closed">
  <head>Elements with unordered children</head>
  <description>
    <p>Should the element constructor 
    <loc href="#element-complex-node">element-complex-node</loc> also permit bags of 
    children?</p>
  </description>
  <resolution  date="13-April-2001">
    <p>MF: decision to use sequences everywhere in data model.</p>
  </resolution>
</issue>

<issue id="Issue-0015" date="02-Feb-2001" raisedby="Mary Fernandez" status="closed">
  <head>Semantics of value equality operator '='</head>
  <description>
    <p>The semantics of the value equality operator '=' are undefined.</p>
  </description>
  <resolution  date="17-August-2001">
    <p>JM: Defined in the Functions and Operators document.</p>
  </resolution>
</issue>

<issue id="Issue-0016" date="21-Feb-2001" raisedby="Michael Rys" status="closed">
  <head>PSV Infoset Mapping - undefined terms</head>
  <description>
    <p><code>Code</code> is undefined. </p>
  </description>
  <resolution date="25-Apr-2001">
    <p>Defined in <specref ref="TextNode"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0017" date="03-Mar-2001" raisedby="Mary Fernandez" status="closed">
  <head>Relationship between Ordered and Unordered collections</head>
  <description>
    <p>The relationship between ordered and unordered collections is 
    not specified.  Any ordered collection can be treated as an 
    unordered collection.</p>
  </description>
  <resolution date="25-Apr-2001">
    <p>Unordered collections removed.</p>
  </resolution>
</issue>

<issue id="Issue-0018" date="12-Mar-2001" raisedby="Michael Rys" status="closed">
  <head>Representation of lists of IDREFS and NMTOKENS</head>
  <description>
    <p>How are IDREF lists and NMTOKEN lists represented in
    data model.</p>
  </description>
  <resolution date="17-August-2001">
    <p>JM: Duplicate of <specref ref="Issue-0005"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0019" date="15-Mar-2001" raisedby="James Clark">
<head>Element constructor that performs schema processing</head>
<description>
  <p>An alternate is to separate element construction from schema 
  validity assessment.  The element constructor would construct an 
  element corresponding to the an element information item in the Infoset 
  before schema validity assessment. 
  To produce elements with types, the <code>schema-process</code> function 
  would schema process an element with respect to a schema type to yield a 
  new element with the full PSV infoset. The <code>schema-process</code> 
  function would ignore any type information on attributes and elements and 
  would assess the untyped value with respect to the given type.</p>
  
  <p role="definition">
element-node  : (<loc href="#dt-simple-typed-value">xs:QName</loc>, 
                 Sequence&lt;<loc href="#NamespaceNode">NamespaceNode</loc>&gt;,
                 Sequence&lt;<loc href="#AttributeNode">AttributeNode</loc>&gt;, 
                 Sequence&lt;<loc href="#ElementNode">ElementNode</loc> | <loc href="#ProcessingInstructionNode">ProcessingInstructionNode</loc> 
                         | <loc href="#TextNode">TextNode</loc> | <loc href="#CommentNode">CommentNode</loc>&gt;)
              -> <loc href="#ElementNode">ElementNode</loc>
schema-process : (<loc href="#ElementNode">ElementNode</loc> | <loc href="#AttributeNode">AttributeNode</loc>, <loc href="#SchemaComponent">SchemaComponent</loc>) 
               -> <loc href="#ElementNode">ElementNode</loc> | <loc href="#AttributeNode">AttributeNode</loc>
  </p>
</description>
</issue>

<issue id="Issue-0020" date="27-Mar-2001" raisedby="Michael Kay" status="closed">
  <head>Semantics of <code>copy</code></head>
  <description>
    <p>Deep copy on a node is defined only informally. For example, 
    does deep copy preserve base URI?</p>
  </description>
  <resolution  date="17-August-2001">
    <p>JM: Obsolete - copy function removed (not used).</p>
  </resolution>
    <!--
      <p>The <code>copy</code> function takes any value and returns a copy of 
      that value.  For <code>Node</code> values, a "deep" copy of the node and
      all of its descendent nodes is returned.  For sequence, a new
      sequence is constructed that contains a copy of every value in the
      sequence.</p>
      
      <p role="definition">
      copy : (Sequence&lt;<emph>UnitValue</emph>&gt;) -> Sequence<emph>&lt;UnitValue</emph>&gt;
      </p>
    -->
</issue>

<issue id="Issue-0021" date="27-Mar-2001" raisedby="XPath 2.0 Task Force" status="closed">
  <head>Declared vs. In-scope namespaces</head>
  <description>
    <p>Currently, an element node preserved its declared namespace 
    nodes, not its in-scope namespaces.  Members of the XSLT WG 
    point out this may make impossible to determine the meaning of 
    data-model values that refer to the default namespace.  This is 
    a big, nasty problem.</p>
  </description>
  <resolution  date="17-August-2001">
    <p>JM: Element constructor uses in-scope namespaces.</p>
  </resolution>
</issue>

<issue id="Issue-0022" date="27-Mar-2001" raisedby="XPath 2.0 Task Force
(Steve Zilles)">
  <head>Abstraction of Run-time type information</head>
  <description>
    <p>The representation of run-time type information is very 
    concrete -- it's the data model representation of a Schema type.  
    The XPath task force would like a more abstract representation of 
    runtime type that is not bound so tightly to XML Schema.   This 
    is an open design problem.</p>
  </description>
</issue>

<issue id="Issue-0023" date="27-Mar-2001" raisedby="XPath 2.0 Task Force">
  <head>Support for document repositories</head>
  <description>
    <p>Many people would like to see support for document repositories 
    in XPath 2.0 with a corresponding notion in the data model.
    A document repository is easy to model as a sequence or bag of
    document nodes.  It may have some additional properties, like for 
    an ordered repository, order among all the nodes in the repository.</p>
  </description>
</issue>

<issue id="Issue-0024" date="27-Mar-2001" raisedby="Michael Sperberg-McQueen">
  <head>Support for Schema-invalid documents</head>
  <description>
    <p>In its current state, the data model clearly does not cover 
    schema-invalid documents:  section 3.3 says "We assume that the 
    element is an instance of the type represented by Def-Type, i.e., 
    the document 'type checks' or is valid with respect to the
    given schema."</p>

    <p>I believe we may wish to extend / modify the data model
    to specify that:</p>

    <olist>
      <item>
        <p>if the element is marked valid (i.e. if the [validity]
        property for the element information item has the value
        "valid"), then we assume that the element is an instance
        of the type represented by Def-Type</p>
      </item>
      <item>
        <p>otherwise, if the element is marked invalid (i.e. the
        [validity] property has the value "invalid" or "notKnown"),
        and if the element has neither attributes nor child elements,
        then we assume [observe] that the element is an instance
        of the type anySimpleType</p>
      </item>
      <item>
        <p>otherwise, we assume that the element is an instance of 
        the type anyType</p>
      </item>
    </olist>

    <p>This would allow / require schema systems to be robust in the
    face of invalid documents.  At first glance, that seems like a
    win.</p>
  </description>
</issue>

<issue id="Issue-0025" date="27-Apr-2001" raisedby="Mike Kay">
  <head>Types of Sequences</head>
  <description>
    <p>Should sequence values carry their type as do 
    simple typed values and element and attribute nodes?</p>
  </description>
</issue>

<issue id="Issue-0026" date="27-Apr-2001" raisedby="Mary Fernandez">
  <head>Schema Component Values vs. Nodes</head>
  <description>
    <p>If schema component values becomes nodes, then 
    does that mean they can occur any where in a document tree?
    I.e., can they be children of other nodes?  What does this mean
    when a data model is serialized as a document?</p>
  </description>
</issue>

<issue id="Issue-0027" date="01-May-2001" raisedby="Mary Fernandez" status="closed">
  <head>Lexical representation of simple-typed values</head>
  <description>
    <p>Given a simple-typed value, it may be necessary to recover
    its lexical representation, for example, when creating a text node 
    that contains the value.  It is not always possible to compute a
    unique lexical representation of a simple typed value.</p>
  </description>
  <resolution date="05-December-2001">
    <p>Changed the definition of the string-value accessor to return
    the canonical lexical representation of the simple typed value (as
    defined by XML Schema Part 2: Datatypes).
    <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Dec/0046.html">decision record</loc> (members only)</p>
  </resolution>
</issue>

<issue id="Issue-0028" date="04-May-2001" raisedby="Jonathan Marsh">
  <head>Whitespace handling</head>
  <description>
    <p>Whitespace handling needs to be more explicit.  In the 
    presence of a schema we have full knowledge of which whitespace is 
    significant and which isn't, and can either mark whitespace as 
    insignificant (and thus exclude it from text() and string-range() 
    for instance), or automatically suppress whitespace in the data model.  
    The former is appropriate given the dual representation of text nodes 
    and values, the latter is appropriate if we only expose values.</p>
  </description>
</issue>

<issue id="Issue-0029" date="04-May-2001" raisedby="Jonathan Marsh" status="closed">
  <head>Use of Reference Nodes</head>
  <description>
    <p>Reference nodes may be part of the data model, but will never 
    appear from a mapping from the infoset.  In addition they cannot be
    serialized.  Without these two features there doesn't seem to be
    much point in having them.  Should we leverage an existing syntax
    (e.g. IDREFS) or design a new syntax to represent them?</p>
  </description>
  <resolution date="13-August-2001">
    <p>Removed Reference Nodes.</p>
  </resolution>
</issue>

<issue id="Issue-0030" date="04-May-2001" raisedby="Jonathan Marsh">
  <head>Base URI is a property of element nodes</head>
  <description>
    <p>With external entities, and now with XML Base, the base URI can
    be scoped to various parts of the document.  A base URI property should
    be added to Element Nodes, and the constructor and infoset mapping
    updated.  Otherwise relative URIs in content cannot be correctly
    resolved.</p>
    <p>Processing instructions also require an infoset-derived base URI.
    The base URI of attributes, for instance, should probably not be the
    empty sequence, if that does not adequately imply that the base URI
    of the element should be used instead.</p>
  </description>
</issue>

<issue id="Issue-0031" date="17-May-2001" raisedby="Ashok Malhotra">
  <head>Schema component does not reveal [content] property</head>
  <description>
    <p>Schema component does not reveal [content] property of <bibref
    ref="XSFD"/> schema component.  MF: Problem with revealing
    [content] property is that we/Schema/Query have to agree on syntax
    for component content (Sec 2.2.1 in <bibref ref="XSFD"/>).  </p>
  </description>
</issue>

<issue id="Issue-0032" date="17-May-2001" raisedby="Query">
  <head>Keys and key references not represented</head>
  <description>
    <p>Note that the data model does not currently represent
    key values and key reference values as described in XML Schema Part 1 : 
    Structures  <bibref ref="xmlschema-1"/>. In a future draft of this 
    document, keys and key references will be represented in the data 
    model.</p>
  </description>
</issue>

<issue id="Issue-0033" date="28-April-2001" raisedby="James Clark">
  <head>Unclear relationship between values passed to the constructor, 
  and those returned by the accessor</head>
  <description>
    <p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0312.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Apr/0312.html</loc> (members only).
    Asks for inference rules, especially for the constuctor, describing
    when values returned by an accessor are the same as those set by the
    corresponding constructor.  Especially unclear are when adjacent
    text nodes are collapsed, base URI and namespace declarations.</p>
  </description>
</issue>

<issue id="Issue-0034" date="8-May-2001" raisedby="Michael Kay">
  <head>Interaction of insignificant whitespace with comments</head>
  <description>
    <p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001May/0053.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001May/0053.html</loc> (members only).
    Clarify whether whitespace is classified as insignificant before 
    or after PI and comment removal.</p>
  </description>
</issue>

<issue id="Issue-0035" date="8-May-2001" raisedby="XSL WG (Michael Kay)">
  <head>Eliminate heterogeneous sequences</head>
  <description>
    <p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001May/0054.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001May/0054.html</loc> (members only),
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001May/0048.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001May/0048.html</loc> (members only).
    Simplify operations such as distinct() by disallowing sequences mixing
    nodes and simple typed values. Suggests converting nodes in such a 
    heterogeneous sequence to their typed values.</p>
  </description>
</issue>

<issue id="Issue-0036" date="19-July-2001" raisedby="XSL WG">
  <head>Support for abstract types</head>
  <description>
    <p>xsd:anySimpleType (and other abstract types) are not supported
    in the data model.  The string-value of an xsd:anySimpleTyped is
    apparently the empty sequence - indicating that you can't really
    do useful operations on anySimpleType'd values.  However, we
    apply a default schema which assigns xsd:anySimpleType, resulting
    in a proliferation of these types.  How can we operate on these
    documents?  Should we at least return a non-empty string-value() 
    for an anySimpleType? Should we define additional operations such
    as +, *, for compatibility with XPath 1.0?</p>
  </description>
</issue>

<issue id="Issue-0037" date="19-July-2001" raisedby="XSL WG">
  <head>Axis functions</head>
  <description>
    <p>Define (somewhere other than the data model document?) 
    axis functions for non-primitive axes like descendants-or-self.</p>
  </description>
</issue>

<issue id="Issue-0038" date="13-August-2001" raisedby="Datamodel Editors">
  <head>XPath 1.0 treatment of non-unique IDs</head>
  <description>
    <p>From XPath 1.0: "If an XML processor reports two elements in 
    a document as having the same unique ID (which is possible only 
    if the document is invalid) then the second element in document 
    order must be treated as not having a unique ID."  This has not
    been incorporated into this document.</p>
  </description>
</issue>

<issue id="Issue-0039" date="13-August-2001" raisedby="Datamodel Editors">
  <head>Parent of namespace nodes</head>
  <description>
    <p>In XPath 1.0 namespace nodes have a parent.  Should we adopt the
    XPath 1.0 behavior, the current behavior (no parent), or some other
    parent (e.g. the document)?</p>
  </description>
</issue>

<issue id="Issue-0040" date="15-August-2001" raisedby="Jim Melton">
  <head>Setting and examining construction flags</head>
  <description>
    <p>[Jim] found [him]self wondering how those flags (parameters) get 
    set/passed.  More importantly, can a process ask whether 
    "this instance" of the data model has those flags set or not? 
    If so, how?  If not, why not?</p>
  </description>
</issue>

<issue id="Issue-0041" date="15-August-2001" raisedby="Jonathan Marsh">
  <head>Document node permissiveness unnecessary</head>
  <description>
    <p>What are the use cases for being permissive about children of the
    document node?  According to the note above, sequences of elements
    do not need a container node.  Suggest removing this permissiveness.</p>
  </description>
</issue>

<issue id="Issue-0042" date="15-August-2001" raisedby="Jim Melton">
  <head>System Id and Public Id are not exposed</head>
  <description>
    <p>In our model, there is no way for a query to determine what DTD is 
    relevant for the data model instance.  That seems like a piece of 
    information that might be wanted occasionally (though probably not 
    often).</p>
  </description>
</issue>

<issue id="Issue-0043" date="15-August-2001" raisedby="Jonathan Marsh" status="closed">
  <head>Treatment of common accessors inconsistent</head>
  <description>
    <p>In some cases, when an accessor is inappropriate for a node, we
    omit that accessor.  In other cases, we define it to always return
    the empty sequence.  We need to rationalize these two design patterns.</p>
  </description>
  <resolution date="30-Oct-2001">
    <p>Use empty sequence throughout. <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Oct/0358.html">decision record</loc> (members only).</p>
  </resolution>
</issue>

<issue id="Issue-0044" date="15-August-2001" raisedby="Jonathan Marsh">
  <head>Unable to construct an element with unique ID</head>
  <description>
    <p>The unique ID property is defined on an element node, but is a function
    of an attribute information item.  When an element node is constructed
    it is given a attribute node - not an info item.  An attribute node
    is insufficient to remember the appropriate properties from the
    infoset in order for the element constructor to detect when an
    attribute is an ID declared in the DTD.</p>
  </description>
</issue>

<issue id="Issue-0045" date="17-August-2001" raisedby="Jim Melton">
  <head>Text nodes are not W3C-normalized text</head>
  <description>
    <p>The <loc href="http://www.w3.org/TR/charmod/">Character
    Model for the World Wide Web version 1.0</loc> working draft defines
    W3C-normalized text.  The algorithm for constructing text nodes
    from character information items does not perform normalization to
    this form.  Should it?</p>
  </description>
</issue>


<issue id="Issue-0046" date="17-August-2001" raisedby="Jim Melton" status="closed">
  <head>Value of derived types?</head>
  <description>
    <p>In XML Schema, the type unsignedInt is a simple type, but 
    it's a derived type (not a primitive type); the nearest 
    corresponding primitive type is decimal.  If I were to invoke 
    the value accessor with something analogous to "value(cast as 
    unsignedInt('10'))", does it return a decimal value, and is 
    the SchemaComponent returned by type a component that 
    describes decimal?  I do not believe that this a non-issue 
    because the only types supported in the data model are XPath 
    1.0's types (string, number, boolean, and node-set), since 
    this document makes a strong point about using all of 
    Schema's simple types.  Thus, does value return the primitive 
    value, or does it return something like the schema-normalized 
    value of the specified simple type?</p>
  </description>
  <resolution date="05-December-2001">
    <p>Simple typed values encapsulate both the value and the type.
    The type of an unsignedInt is the SchemaComponent corresponding to
    the unsignedInt. The string representation on the other hand is the
    value's canonical lexical representation for the base type (which is a
    primitive type) as specified by XML Schema.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Dec/0046.html">Decision record</loc> (members only).</p>
  </resolution>
</issue>

<issue id="Issue-0047" date="17-August-2001" raisedby="Jim Melton">
  <head>Should errors be allowed in sequences?</head>
  <description>
    <p>The possibility that generating sequences in which one or more 
    members are Error may sometimes be a useful way to produce partial 
    results that can satisfy some sorts of queries.</p>
  </description>
</issue>

<issue id="Issue-0048" date="17-August-2001" raisedby="Jim Melton">
  <head>Imprecise behavior of errors</head>
  <description>
    <p>I am very concerned that "How the error value is handled in a 
    query processor is implementation-defined."  I think we have to 
    do a bit better than this, although leaving flexibility for 
    implementations to do more for their users is a Good Thing.</p>
  </description>
</issue>

<issue id="Issue-0049" date="17-August-2001" raisedby="James Clark">
  <head>Alternative design of schema components</head>
  <description>
    <p>MF cite James: 
    An alternative would be to have an extends accessor
    that returns deref([base]) if [derivation] is extension and empty
    sequence otherwise, and a restricts accessor that returns deref([base])
    if [derivation] is restriction and empty sequence otherwise.</p>
  </description>
</issue>

<issue id="Issue-0050" date="17-August-2001" raisedby="Jim Melton">
  <head>Relative order of free-floating nodes</head>
  <description>
    <p>Are newly-constructed nodes in any particular order, such 
    as some kind of document order?  Does the order of these 
    nodes have any relationship to the document order of the 
    "input" data model instance?  In fact, is the process being 
    described properly characterized as "create a new data model 
    instance from information derived from an existing data model 
    instance", or something similar?  Can more than one "new" 
    document instance be created by a single query?  In the 
    fourth paragraph [Section 4], we see the phrase "the document node" --- 
    is this the "existing document"'s document node, the "new 
    document"'s document node, both, neither?  Can more than one 
    "existing" document instance be the source of information for 
    a query?</p>
  </description>
</issue>

<issue id="Issue-0051" date="28-August-2001" raisedby="Michael Kay">
  <head>Document order of shared namespace nodes</head>
  <description>
    <p>Section 3.2 states that in the document ordering, the namespace 
    nodes of an element follow the element but precede its attributes. 
    This is inconsistent with the idea, suggested but not spelled out in 
    4.4, that a namespace node can be shared by several elements. In fact, 
    the question of namespace node identity is not really tackled. My view 
    is that namespace node identity should be determined by the 
    combination of (document identity, namespace prefix, namespace URI), 
    that the parent of a namespace node should be the document node, and 
    that namespace nodes should be ordered after every other node in the 
    document. (This is easier for implementations than placing them at the 
    start of the document, because the number of namespace nodes is not 
    known until parsing is complete).</p>
  </description>
</issue>

<issue id="Issue-0052" date="28-August-2001" raisedby="Michael Kay">
  <head>Element constructor copies nodes?</head>
  <description>
    <p>In section 4.2 Elements, the notion that the constructor makes a 
    copy of the supplied child nodes seems strange. It's hard to square 
    this with the definition of node identity. Also, I don't see why the 
    provision is needed here, but not for the document node constructor. 
    Wouldn't it be cleaner to define a precondition that all the child 
    nodes supplied to the constructor must be parentless?</p>
  </description>
</issue>

<issue id="Issue-0053" date="28-August-2001" raisedby="Michael Kay" status="closed">
  <head>Semantics of head and tail on empty sequences</head>
  <description>
    <p>Head would appear to be a partial function, it does 
    not apply to empty sequences. If we follow the same conventions as 
    elsewhere, that means head returns a Sequence(0,1)&lt;item&gt;, which 
    perhaps begs the question as to how you extract the first member of 
    this sequence...</p>
  </description>
  <resolution date="18-November-2001">
    <p>Replaced the accessors head and tail by the some of the sequence
    accessors defined in the Functions and Operators document. </p>
  </resolution>
</issue>

<issue id="Issue-0054" date="6-September-2001" raisedby="Evan Lenz">
  <head>Complex types with simple content</head>
  <description>
    <p>Currently, the typed-value of a complex type is the empty sequence.
    Should complex types with simple content (i.e. an element that contains
    only text but that also has an attribute) be treated differently than
    complex types with complex content?</p>
  </description>
</issue>

<issue id="Issue-0055" date="6-September-2001" raisedby="XSL WG" status="closed">
  <head>Effect of xsi:nil</head>
  <description>
    <p>The XSL WG wishes xsi:nil="true" to result in a typed-value
    of the empty sequence.  This allows the differentiation of a null
    string value and an empty string.</p>
  </description>
  <resolution date="07-December-2001">
    <p>This is a duplicate of the resolved XPath Issue 0021: Handling of
    xsi:nil on Input. See the <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Dec/0047.html">review of the XPath issues</loc> (members only).
    Accordingly closed this issue, updated the document to reflect the
	 decision and added the related data model Issue-0071.
	 </p>
  </resolution>
</issue>

<issue id="Issue-0056" date="20-September-2001" raisedby="XPath TF">
  <head>Lightweight Schema Components</head>
  <description>
    <p>Summary:  The only necessary operation on Schema Components is
    instance-of(schema-component1, schema-component2).  There is no need to
    expose the internal structure of Schema Components to enable this
    functionality.  Instead we could provide an abstract Type object whose
    internal structure can be treated as a black box.  See
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Jul/0042.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Jul/0042.html</loc> (members only).</p>
  </description>
</issue>

<issue id="Issue-0057" date="25-September-2001" raisedby="Michael Kay">
  <head>Support for XSLT whitespace stripping</head>
  <description>
    <p>XSLT allows a stylesheet to designate elements whose whitespace
    is to be stripped.  We need to support this in the data model, or
    possibly elsewhere.</p>
    <p>Similarly, a data model instance for a stylesheet has provisions
    for stripping comments and processing instructions.</p>
  </description>
</issue>

<issue id="Issue-0058" date="25-September-2001" raisedby="Michael Kay">
  <head>Node constructors formalism of questionable value</head>
  <description>
    <p>Node constructors. I'm a bit concerned that this is lacking in rigor.
    Some of this is exposed in <specref ref="Issue-0050"/>. The idea that 
    the constructor for a parent node (Element or Document) takes a copy 
    of the supplied children node doesn't seem to be fully worked out. 
    What does "taking a copy" mean, where is it defined? It has to be a 
    deep copy to make sense; it has to preserve its name, its type, and 
    its children, but not its base URI or its node identity, and it 
    acquires a new position in document order. What happens about
    the namespace nodes when an element or attribute is copied? Altogether,
    I'm worried that this idea of node constructors looks formal, but 
    is actually just as informal as the 1.0 specification. It's actually 
    a very procedural description, and I can't really see why it's needed: 
    if it's intended as a target vocabulary for the formal semantics of 
    the language, then it's a pretty shaky foundation. I'd be much happier 
    with a model that only defines the valid states in the system; if we 
    are going to define the permitted state transitions, we need to be 
    much more rigorous about it.</p>
  </description>
</issue>

<issue id="Issue-0059" date="25-September-2001" raisedby="Michael Kay">
  <head>Pseudo-formalism provides no value</head>
  <description>
    <p>"The sequence-map function applies its first function argument to each
    member of its second sequence argument and returns a new sequence
    containing
    the result of applying the function to each member of the sequence." I
    really wonder whether it is a good idea to define the data model using a
    pseudo-formal language that we make up and half-explain as we go along? If
    we can't use an existing formal notation like Z or VDM that has a good
    specification we can reference, we should do the whole thing in English.</p>
  </description>
</issue>

<issue id="Issue-0060" date="25-September-2001" raisedby="Michael Kay">
  <head>Sharing namespace nodes</head>
  <description>
    <p>We need to say something about the identity of namespace
    nodes, and about the fact that two namespace nodes for the same prefix 
    and uri may need to be combined when an element is added to a document. 
    Also "the element constructor logically creates a copy of all of its
    namespace..." - namespace nodes do not need to be copied(?)</p>
  </description>
</issue>

<issue id="Issue-0061" date="25-September-2001" raisedby="Michael Kay">
  <head>No access to prefix on free-floating attributes</head>
  <description>
    <p>An observation: if an attribute node has no parent element (a 
    floating attribute), then there is also no access to any namespace 
    nodes. This makes it impossible to support the XPath 1.0 name() 
    function, which returns a lexical QName for the node by finding a 
    prefix that maps to the node's namespace URI.</p>
    <p>[JM: Sounds like we need a QName object that is a triple, local-name,
    namesapce-uri, and prefix, to support XSLT.]</p>
  </description>
</issue>

<issue id="Issue-0062" date="16-October-2001" raisedby="Michael Kay">
  <head>Namespace fixups required</head>
  <description>
    <p>The current XSLT draft includes a substantial piece of text on
    namespace fixup. This was introduced in the XSLT 1.1 working draft, 
    and is basically designed to ensure that when an element or attribute 
    is added to a result tree, namespace nodes are also added to declare 
    any namespace URI used by the element or attribute. (At XSLT 1.0, 
    this was handled at serialization time, but this had to change when 
    temporary trees became accessible to the stylesheet). The description 
    of namespace fixup logically belongs with the description of the node 
    construction process in the data model document.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Oct/0036.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Oct/0036.html</loc> (members only).</p>
  </description>
</issue>

<issue id="Issue-0063" date="16-October-2001" raisedby="Michael Kay">
  <head>Is prefix preserved?</head>
  <description>
    <p>Although XSLT and the XPath 2.0 data model agree that element and 
    attribute nodes do not hold a namespace prefix, XSLT has always hinted 
    that prefixes might be preserved through a transformation where possible. 
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Oct/0036.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Oct/0036.html</loc> (members only).</p>
    <p>[JM: the ability to recover the lexical value of an xs:QName simple
    type seems useful, perhaps even necessary.  It is at least needed to
    support the name() function.  A better description of the xs:QName 
    accessors is required, perhaps unifying xs:QName and expanded-QName.]</p>
  </description>
</issue>

<issue id="Issue-0064" date="16-October-2001" raisedby="Jeni Tennison">
  <head>Access to member type definition</head>
  <description>
    <p>The constructor for the element node probably should include the type
    definition in the constructor as well, for cases where the [type
    definition] of the element information item is not the same as the
    [type definition] of the [element declaration], which can occur if
    xsi:type is used in the document.  [Same for attribute nodes.]
    <loc href="http://lists.w3.org/Archives/Public/www-xml-query-comments/2001Sep/0012.html">http://lists.w3.org/Archives/Public/www-xml-query-comments/2001Sep/0012.html</loc>.</p>
  </description>
</issue>

<issue id="Issue-0065" date="19-November-2001" raisedby="Mary Fernandez" status="closed">
  <head>Proposal for alternative constructor</head>
  <description>
    <p>The element and attribute constructors are not convenient when 
    constructing elements or attributes with simple-type content.  An
    alternative constructor that takes a typed value directly (instead of
    only text nodes or normalized string values) would simplify
    dependent specifications.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Nov/0068.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2001Nov/0068.html</loc> (members only).</p>
  </description>
  <resolution date="05-December-2001">
    <p>Add the two new constructors proposed by Mary with the change that
    the element/attribute declarations are not optional and they are named
    differently (so we won't overload the constructors).
    <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Dec/0046.html">decision record</loc> (members only)</p>
  </resolution>
</issue>

<issue id="Issue-0066" date="29-November-2001" raisedby="Ashok Malhotra">
  <head>SchemaComponent support for substitutions groups</head>
  <description>
    <p>SchemaComponents currently don't expose any substitution group 
    information.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Nov/0358.html">http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2001Nov/0358.html</loc> (members only).</p>
  </description>
</issue>

<issue id="Issue-0067" date="5-December-2001" raisedby="Marton Nagy">
  <head>Align function call syntax</head>
  <description>
    <p>The syntax of the function calls need to be aligned with the other
    working documents, in particular the Functions and Operators and the
    XQuery documents. Possible candidates are f:(T1,T2)-&gt;T or
    f(T1 $v1, T2 $v2)=&gt;T. </p>
  </description>
</issue>

<issue id="Issue-0068" date="4-December-2001" raisedby="XPath Task Force">
  <head>Retaining the type of a sequence of heterogeneous simple typed values.</head>
  <description>
    <p>When a sequence of heterogeneous simple typed values is passed as
    the content of an element constructor, is the type information associated
    with the simple typed values preserved? e.g. when using a sequence
    containing a decimal, a string and a boolean are these types preserved
    (or possibly changed to anySimpleType* ?). Note that XML Schema cannot
    describe this former. Related to this, should we ever allow an element
    constructor to create an instance that can not be serialized as XML
    text without loss of type information?  
    </p>
  </description>
</issue>

<issue id="Issue-0069" date="4-December-2001" raisedby="XPath Task Force">
  <head>Canonical form for derived types.</head>
  <description>
    <p>Should derived types have a canonical form? Should we ask XML Schema
    to fix this?</p>
  </description>
</issue>

<issue id="Issue-0070" date="5-December-2001" raisedby="XPath Task Force">
  <head>Should the name accessor return "" or ()?</head>
  <description>
    <p>Should the name accessor return "" or () for nodes that have no name?</p>
  </description>
</issue>

<issue id="Issue-0071" date="7-December-2001" raisedby="Michael Rys">
  <head>Magic Attributes</head>
  <description>
    <p>Should the following attributes be represented in
       the data model? xmlns attributes, xml:lang, xml:space,
       xsi:nil (etc). If so, how?
    </p>
  </description>
</issue>
</inform-div1>

</back>
</spec>

  
<!--
<p role="infoset" id="otherItems">
  <p>For completeness, the following accessors are defined for information 
  unused in the mapping described in following sections.</p>

  <p role="definition">
/* Accessors for Unexpanded Entity Reference Information Items */ 
infoset-unexpanded-entity-name     : (<loc href="#otherItems">UnexpandedEntityReferenceItem</loc>) -> xs:string
infoset-unexpanded-entity-system   : (<loc href="#otherItems">UnexpandedEntityReferenceItem</loc>) -> xs:anyURI
infoset-unexpanded-entity-public   : (<loc href="#otherItems">UnexpandedEntityReferenceItem</loc>) -> xs:string
infoset-unexpanded-entity-base-uri : (<loc href="#otherItems">UnexpandedEntityReferenceItem</loc>) -> xs:anyURI
infoset-unexpanded-entity-parent   : (<loc href="#otherItems">UnexpandedEntityReferenceItem</loc>) -> ElementItem

/* Accessors for Document Type Information Items */
infoset-doctype-system   : (<loc href="#otherItems">DocTypeItem</loc>) -> xs:anyURI
infoset-doctype-public   : (<loc href="#otherItems">DocTypeItem</loc>) -> xs:string
infoset-doctype-children : (<loc href="#otherItems">DocTypeItem</loc>) -> Sequence&lt;<loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc>&gt;
infoset-doctype-parent   : (<loc href="#otherItems">DocTypeItem</loc>) -> DocumentItem

/* Accessors for Unparsed Entity Information Items */
infoset-unparsed-entity-name          : (<loc href="#otherItems">EntityItem</loc>) -> xs:string
infoset-unparsed-entity-system        : (<loc href="#otherItems">EntityItem</loc>) -> xs:anyURI
infoset-unparsed-entity-public        : (<loc href="#otherItems">EntityItem</loc>) -> xs:string
infoset-unparsed-entity-notation-name : (<loc href="#otherItems">EntityItem</loc>) -> xs:string
infoset-unparsed-entity-notation      : (<loc href="#otherItems">EntityItem</loc>) -> <loc href="#otherItems">NotationItem</loc>
   
/* Accessors for Notation Information Items */
infoset-notation-name     : (<loc href="#otherItems">NotationItem</loc>) -> xs:string
infoset-notation-system   : (<loc href="#otherItems">NotationItem</loc>) -> xs:anyURI
infoset-notation-public   : (<loc href="#otherItems">NotationItem</loc>) -> xs:string
infoset-notation-base-uri : (<loc href="#otherItems">NotationItem</loc>) -> xs:anyURI
  </p>
  
  <p>For example, </p>
  <p role="definition">list-append [ 1, 2 ] [ 3, 4 ] = [ 1, 2, 3, 4 ]
  concat-string "First" "Last" = "FirstLast"
  </p>
  
  <p>
  For example, given the function <emph>addOne</emph>:
  </p>
  <p role="definition">
  function add-one(x) { return x + 1 }
  sequence-map(add-one, append(1, 2)) = append(2, 3)
  </p>

</p>
-->
  <!--
  <p>
  Identity constraint tables resolve
  the reference between a keyref attribute and the element to which it
  refers.
  If we assume that a node table is is a table of (key-sequence,
  qualified-node) pairs and is keyed on key-sequence, we can compute a
  new node table for element E, eligible constraint C as follows:
  </p>
  <p role="definition">
  IdentityConstraintTable = { (Constraint, NodeTable) }
  NodeTable = { ([values], ElementItem) }

  psvi-element-ict : (<loc href="#ElementItem">ElementItem</loc>) -> IdentityConstraintTable

  psvi-ict- : (IdentityConstraintTable,  ) -> 
  psvi-node-table-key-seq : (NodeTable) -> Sequence&lt;values&gt;
  psvi-node-table

  function nodeTable(E, C) {
    /* compute node table for element E &amp; constraint C */
    table = union(forall (keyseq, qualnode) in eligibleConstraint(E,C))
    /* inherit non-conflicting constraints from children */
    kidsTable  = union(forall K in children(E), nodeTable(K, C))
    inheritTable = kidsTable - table
    return union(table, inheritTable)
  }
  // inheritTable is really a project on key-sequence, difference of the
  // two tables and then a join with kidsTable to reconstruct the
  inherited table.
  </p>
  <ednote>
  <edtext>
  This mapping does not capture an element item's keyref values,
  which are maintained in the element item's identity constraints table.
  The identity constraints table is created for ``bookkeeping purposes''
  by an XML Schema processor (see <bibref ref="xmlschema-1"/>). 
  The mapping of an element item's identity constraints table into 
  keyref values will be specified in a future draft of this document.
  </edtext>
  </ednote>
  -->

<!--  infoset-element-prefix               : (<loc href="#ElementItem">ElementItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>   /* unused */-->
<!--  infoset-element-namespace-attributes : (<loc href="#ElementItem">ElementItem</loc>) -> Sequence&lt;<loc href="#AttributeItem">AttributeItem</loc>&gt;  /* unused */-->
<!--  infoset-element-parent               : (<loc href="#ElementItem">ElementItem</loc>) -> <loc href="#ElementItem">ElementItem</loc> | <loc href="#DocumentItem">DocumentItem</loc>  /* unused ? */-->

<!--  infoset-processing-instruction-base-uri      : (<loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc>) -> <loc href="#dt-simple-typed-value">xs:anyURI</loc>  /* unused ? */
infoset-processing-instruction-notation      : (<loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc>) -> <loc href="#InfoItem">NotationItem</loc>  /* unused */
infoset-processing-instruction-parent        : (<loc href="#ProcessingInstructionItem">ProcessingInstructionItem</loc>) -> <loc href="#ElementItem">ElementItem</loc> | <loc href="#DocumentItem">DocumentItem</loc>  /* unused ? */
--> 
<!--
  <p>The data model includes a function on <emph>UnitValue</emph>s,
  called <code>before</code>, which compares the document 
  order of two nodes in a document.
  Document (or global) order refers to the total order 
  among all element nodes in a document. 
  Global order is defined as the order of appearance of the
  element nodes when performing a pre-order, depth-first traveral of a
  the document.
  This corresponds to the order of appearance of their opening tags in
  the XML serialization and is equivalent to the definition used in
  <bibref ref="XPath"/>.</p>
  
  <p id="inequality" role="definition">
  before : (<emph>UnitValue</emph>, <emph>UnitValue</emph>) -> xs:boolean
  </p>

  <p>Because the data model supports both nodes and simple values, it is
  useful to define <code>before</code> over both nodes and simple values.
  If both the arguments to <code>before</code> 
  are simple values, its meaning is the same as the
  less-than operator ('&lt;) applied to those values.
  If its first argument is a simple value and its
  second argument is a node,
  <code>before</code> 
  returns true; conversely, 
  if its first argument is a node and its
  second argument is a simple value, 
  <code>before</code> returns false. 
  If both arguments are nodes, 
  <code>before</code> 
  returns true if the first node is before (and different from) the
  second node in document order. It returns false if the first node is
  equal to or after the second node in document order.  
  If the two nodes are in different documents,
  igs result is implementation-defined, but stable, 
  In addition, if nodes <emph>n1</emph> and <emph>n2</emph> 
  are in one tree, and node <emph>m</emph> is in a different tree, then
  <code>not</code> (<code>before</code>(<emph>n1</emph>, <emph>m</emph>)
  <code>and</code> <code>before</code>(<emph>m</emph>, <emph>n2</emph>)) holds.</p>
-->

<!--
<p>
Recall that an XML schema is also an XML document, which can be
represented in the data model.  The complex and
simple types in the example schema are represented below:
</p>
<p role="definition">
name(part-type)       = xf:QName-from-uri("http://www.w3.org/1999/XMLSchema", "complexType")
children(part-type)   = append(E4, E5, E6)
attributes(part-type) = A2
namespaces(part-type) = <loc href="#empty-sequence">empty-sequence</loc>()
type(part-type)       = complex-type-defininitionreference-node(xs:complexType)

name(A2)       = xf:QName("name")
value(A2)      = "part-type"

name(E4)       = xf:QName-from-uri("http://www.w3.org/1999/XMLSchema", "element")
children(E4)   = <loc href="#empty-sequence">empty-sequence</loc>()
attributes(E4) = append(A3, A6)
namespaces(E4) = <loc href="#empty-sequence">empty-sequence</loc>()
type(E4)       = reference-node(xs:element)

name(A3)       = xf:QName("name")
value(A3)      = "mfg"

name(A6)       = xf:QName("type")
value(A6)      = xf:QName-from-uri("http://www.w3.org/1999/XMLSchema", "string")

name(E5)       = xf:QName-from-uri("http://www.w3.org/1999/XMLSchema", "element")
children(E5)   = <loc href="#empty-sequence">empty-sequence</loc>()
attributes(E5) = append(A4, A7)
namespaces(E5) = <loc href="#empty-sequence">empty-sequence</loc>()
type(E5)       = reference-node(xs:element)

name(A4)       = xf:QName("name")
value(A4)      = "price"

name(A7)       = xf:QName("type")
value(A7)      = xf:QName-from-uri("http://www.w3.org/1999/XMLSchema", "decimal")

name(E6)       = xf:QName-from-uri("http://www.w3.org/1999/XMLSchema", "attribute")
children(E6)   = <loc href="#empty-sequence">empty-sequence</loc>()
attributes(E6) = append(A5, A8)
namespaces(E6) = <loc href="#empty-sequence">empty-sequence</loc>()
type(E6)       = reference-node(xs:attribute)

name(A5)       = xf:QName("name")
value(A5)      = "name"

name(A8)       = xf:QName("type")
value(A8)      = xf:QName-from-uri("http://www.w3.org/1999/XMLSchema", "string")
</p>
<p>
For conciseness, we eliminate the definitions of 
builtin schema components, e.g., <emph>complexType</emph>,
and of primitive simple types, e.g., <emph>xs:string</emph>.
</p>
-->
<!--  infoset-document-document-element  : (<loc href="#DocumentItem">DocumentItem</loc>) -> Sequence&lt;<loc href="#ElementItem">ElementItem</loc>&gt;  /* unused */
  infoset-document-notations         : (<loc href="#DocumentItem">DocumentItem</loc>) -> Sequence&lt;<loc href="#InfoItem">NotatioNamespaceItem</loc>&gt;  /* unused */
infoset-document-unparsed-entities : (<loc href="#DocumentItem">DocumentItem</loc>) -> Sequence&lt;<loc href="#InfoItem">UnparsedEntityItem</loc>&gt;  /* unused */
-->  
<!--  infoset-document-character-encoding-scheme
                                : (<loc href="#DocumentItem">DocumentItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>  /* unused */
  infoset-document-standalone        : (<loc href="#DocumentItem">DocumentItem</loc>) -> <loc href="#dt-simple-typed-value">xs:boolean</loc>  /* unused */
  infoset-document-version           : (<loc href="#DocumentItem">DocumentItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>  /* unused */
  infoset-document-all-declarations-processed
                                : (<loc href="#DocumentItem">DocumentItem</loc>) -> <loc href="#dt-simple-typed-value">xs:boolean</loc>  /* unused */-->

<!--  infoset-attribute-prefix           : (<loc href="#AttributeItem">AttributeItem</loc>) -> <loc href="#dt-simple-typed-value">xs:string</loc>   /* unused */ -->
<!--  infoset-attribute-specified        : (<loc href="#AttributeItem">AttributeItem</loc>) -> SpecifiedFlag   /* unused */
  infoset-attribute-attribute-type   : (<loc href="#AttributeItem">AttributeItem</loc>) -> DTDAttributeType   /* unused */
  infoset-attribute-references       : (<loc href="#AttributeItem">AttributeItem</loc>) -> Sequence&lt;<loc href="#ElementItem">ElementItem</loc> 
                                  | <loc href="#InfoItem">UnparsedEntityItem</loc> | <loc href="#InfoItem">NotationItem</loc>  /* unused */-->

