<?xml version="1.0"?>
<!DOCTYPE spec SYSTEM "../schema/xsl-query.dtd" [

<!ENTITY dm-example.xml SYSTEM "build/dm-example.xml.cdata">
<!ENTITY dm-example.xsd SYSTEM "build/dm-example.xsd.cdata">
<!ENTITY dm-example.tbl SYSTEM "build/dm-example.tbl.xml">

<!ENTITY date.year "2003">
<!ENTITY date.month "May">
<!ENTITY date.MM "05">
<!ENTITY date.day "02">
<!ENTITY date.DD "&date.day;">
<!ENTITY doc.date "&date.year;&date.MM;&date.DD;">
<!ENTITY doc.prefix "WD-xpath-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 dm.prop.attributes   "<emph role='dm-node-property'>attributes</emph>">
<!ENTITY dm.prop.base-uri     "<emph role='dm-node-property'>base-uri</emph>">
<!ENTITY dm.prop.children     "<emph role='dm-node-property'>children</emph>">
<!ENTITY dm.prop.content      "<emph role='dm-node-property'>content</emph>">
<!ENTITY dm.prop.namespaces   "<emph role='dm-node-property'>namespaces</emph>">
<!ENTITY dm.prop.nilled	      "<emph role='dm-node-property'>nilled</emph>">
<!ENTITY dm.prop.node-name    "<emph role='dm-node-property'>node-name</emph>">
<!ENTITY dm.prop.parent	      "<emph role='dm-node-property'>parent</emph>">
<!ENTITY dm.prop.prefix	      "<emph role='dm-node-property'>prefix</emph>">
<!ENTITY dm.prop.string-value "<emph role='dm-node-property'>string-value</emph>">
<!ENTITY dm.prop.target	      "<emph role='dm-node-property'>target</emph>">
<!ENTITY dm.prop.type	      "<emph role='dm-node-property'>type</emph>">
<!ENTITY dm.prop.uri          "<emph role='dm-node-property'>uri</emph>">

<!ENTITY document.node.base-uri.type        "xs:anyURI?">
<!ENTITY document.node.base-uri.returns     "The value of the &dm.prop.base-uri; property">
<!ENTITY document.node.node-kind.type       "xs:string">
<!ENTITY document.node.node-kind.returns    '"document"'>
<!ENTITY document.node.node-name.type       "()">
<!ENTITY document.node.node-name.returns    "()">
<!ENTITY document.node.parent.type          "()">
<!ENTITY document.node.parent.returns       "()">
<!ENTITY document.node.string-value.type    "xs:string">
<!ENTITY document.node.string-value.returns "The concatenation of the string-values of all the text node descendants of the document in document order">
<!ENTITY document.node.typed-value.type     "xdt:untypedAtomic">
<!ENTITY document.node.typed-value.returns  "The string value of the document node as an <code>xdt:untypedAtomic</code> value">
<!ENTITY document.node.type.type            "()">
<!ENTITY document.node.type.returns         "()">
<!ENTITY document.node.children.type        "Node+">
<!ENTITY document.node.children.returns     "The children of the document node">
<!ENTITY document.node.attributes.type      "()">
<!ENTITY document.node.attributes.returns   "()">
<!ENTITY document.node.namespaces.type      "()">
<!ENTITY document.node.namespaces.returns   "()">
<!ENTITY document.node.nilled.type          "()">
<!ENTITY document.node.nilled.returns       "()">

<!ENTITY element.node.base-uri.type         "xs:anyURI?">
<!ENTITY element.node.base-uri.returns      "The value of the &dm.prop.base-uri; property or its parent's base URI">
<!ENTITY element.node.node-kind.type        "xs:string">
<!ENTITY element.node.node-kind.returns     '"element"'>
<!ENTITY element.node.node-name.type        "xs:QName">
<!ENTITY element.node.node-name.returns     "The xs:QName of the element">
<!ENTITY element.node.parent.type           "Node?">
<!ENTITY element.node.parent.returns        "The parent element or document node">
<!ENTITY element.node.string-value.type     "xs:string">
<!ENTITY element.node.string-value.returns  "The concatenation of the string-values of all the text node descendants of the element in document order">
<!ENTITY element.node.typed-value.type      "Value?">
<!ENTITY element.node.typed-value.returns   "The typed value of the node">
<!ENTITY element.node.type.type             "xs:QName">
<!ENTITY element.node.type.returns          "The name of the type of the element">
<!ENTITY element.node.children.type         "Node*">
<!ENTITY element.node.children.returns      "The children of the element node">
<!ENTITY element.node.attributes.type       "Node*">
<!ENTITY element.node.attributes.returns    "The attributes of the element node">
<!ENTITY element.node.namespaces.type       "Node*">
<!ENTITY element.node.namespaces.returns    "The namespaces of the element node">
<!ENTITY element.node.nilled.type           "xs:boolean">
<!ENTITY element.node.nilled.returns        "The status of the &dm.prop.nilled; property of the element node">

<!ENTITY attribute.node.base-uri.type        "()">
<!ENTITY attribute.node.base-uri.returns     "()">
<!ENTITY attribute.node.node-kind.type       "xs:string">
<!ENTITY attribute.node.node-kind.returns    '"attribute"'>
<!ENTITY attribute.node.node-name.type       "xs:QName">
<!ENTITY attribute.node.node-name.returns    "The xs:QName of the attribute">
<!ENTITY attribute.node.parent.type          "Node?">
<!ENTITY attribute.node.parent.returns       "The parent element node">
<!ENTITY attribute.node.string-value.type    "xs:string">
<!ENTITY attribute.node.string-value.returns "The value of the attribute">
<!ENTITY attribute.node.typed-value.type     "Value?">
<!ENTITY attribute.node.typed-value.returns  "The typed value of the attribute">
<!ENTITY attribute.node.type.type            "xs:QName">
<!ENTITY attribute.node.type.returns         "The name of the type of the attribute">
<!ENTITY attribute.node.children.type        "()">
<!ENTITY attribute.node.children.returns     "()">
<!ENTITY attribute.node.attributes.type      "()">
<!ENTITY attribute.node.attributes.returns   "()">
<!ENTITY attribute.node.namespaces.type      "()">
<!ENTITY attribute.node.namespaces.returns   "()">
<!ENTITY attribute.node.nilled.type          "()">
<!ENTITY attribute.node.nilled.returns       "()">

<!ENTITY namespace.node.base-uri.type        "()">
<!ENTITY namespace.node.base-uri.returns     "()">
<!ENTITY namespace.node.node-kind.type       "xs:string">
<!ENTITY namespace.node.node-kind.returns    '"namespace"'>
<!ENTITY namespace.node.node-name.type       "xs:QName">
<!ENTITY namespace.node.node-name.returns    "A xs:QName with the namespace <emph>prefix</emph> in the local-name and an empty URI">
<!ENTITY namespace.node.parent.type          "Node?">
<!ENTITY namespace.node.parent.returns       "The parent element node">
<!ENTITY namespace.node.string-value.type    "xs:string">
<!ENTITY namespace.node.string-value.returns "The namespace name (URI) of the node">
<!ENTITY namespace.node.typed-value.type     "xdt:untypedAtomic">
<!ENTITY namespace.node.typed-value.returns  "The string value of the namespace node as an <code>xdt:untypedAtomic</code> value">
<!ENTITY namespace.node.type.type            "()">
<!ENTITY namespace.node.type.returns         "()">
<!ENTITY namespace.node.children.type        "()">
<!ENTITY namespace.node.children.returns     "()">
<!ENTITY namespace.node.attributes.type      "()">
<!ENTITY namespace.node.attributes.returns   "()">
<!ENTITY namespace.node.namespaces.type      "()">
<!ENTITY namespace.node.namespaces.returns   "()">
<!ENTITY namespace.node.nilled.type          "()">
<!ENTITY namespace.node.nilled.returns       "()">

<!ENTITY pi.node.base-uri.type               "xs:anyURI?">
<!ENTITY pi.node.base-uri.returns            "The value of the &dm.prop.base-uri; property or its parent's base URI">
<!ENTITY pi.node.node-kind.type              "xs:string">
<!ENTITY pi.node.node-kind.returns           '"processing-instruction"'>
<!ENTITY pi.node.node-name.type              "xs:QName">
<!ENTITY pi.node.node-name.returns           "A xs:QName with the processing-instruction target in the local-name and an empty URI">
<!ENTITY pi.node.parent.type                 "Node?">
<!ENTITY pi.node.parent.returns              "The parent element or document node">
<!ENTITY pi.node.string-value.type           "xs:string">
<!ENTITY pi.node.string-value.returns        "The content of the processing-instruction">
<!ENTITY pi.node.typed-value.type            "xdt:untypedAtomic">
<!ENTITY pi.node.typed-value.returns         "The string value of the processing-instruction as an <code>xdt:untypedAtomic</code> value">
<!ENTITY pi.node.type.type                   "()">
<!ENTITY pi.node.type.returns                "()">
<!ENTITY pi.node.children.type               "()">
<!ENTITY pi.node.children.returns            "()">
<!ENTITY pi.node.attributes.type             "()">
<!ENTITY pi.node.attributes.returns          "()">
<!ENTITY pi.node.namespaces.type             "()">
<!ENTITY pi.node.namespaces.returns          "()">
<!ENTITY pi.node.nilled.type                 "()">
<!ENTITY pi.node.nilled.returns              "()">

<!ENTITY comment.node.base-uri.type          "xs:anyURI?">
<!ENTITY comment.node.base-uri.returns       "The base URI of its parent">
<!ENTITY comment.node.node-kind.type         "xs:string">
<!ENTITY comment.node.node-kind.returns      '"comment"'>
<!ENTITY comment.node.node-name.type         "()">
<!ENTITY comment.node.node-name.returns      "()">
<!ENTITY comment.node.parent.type            "Node?">
<!ENTITY comment.node.parent.returns         "The parent element or document node">
<!ENTITY comment.node.string-value.type      "xs:string">
<!ENTITY comment.node.string-value.returns   "The content of the comment">
<!ENTITY comment.node.typed-value.type       "xdt:untypedAtomic">
<!ENTITY comment.node.typed-value.returns    "The string-value of the comment node">
<!ENTITY comment.node.type.type              "()">
<!ENTITY comment.node.type.returns           "()">
<!ENTITY comment.node.children.type          "()">
<!ENTITY comment.node.children.returns       "()">
<!ENTITY comment.node.attributes.type        "()">
<!ENTITY comment.node.attributes.returns     "()">
<!ENTITY comment.node.namespaces.type        "()">
<!ENTITY comment.node.namespaces.returns     "()">
<!ENTITY comment.node.nilled.type            "()">
<!ENTITY comment.node.nilled.returns         "()">

<!ENTITY text.node.base-uri.type             "xs:anyURI?">
<!ENTITY text.node.base-uri.returns          "The base URI of its parent">
<!ENTITY text.node.node-kind.type            "xs:string">
<!ENTITY text.node.node-kind.returns         '"text"'>
<!ENTITY text.node.node-name.type            "xs:string">
<!ENTITY text.node.node-name.returns         "()">
<!ENTITY text.node.parent.type               "Node?">
<!ENTITY text.node.parent.returns            "The parent element or document node">
<!ENTITY text.node.string-value.type         "xs:string">
<!ENTITY text.node.string-value.returns      "The text content">
<!ENTITY text.node.typed-value.type          "Value">
<!ENTITY text.node.typed-value.returns       "The string value of the node as <code>xdt:untypedAtomic</code>">
<!ENTITY text.node.type.type                 "xdt:untypedAtomic">
<!ENTITY text.node.type.returns              "xdt:untypedAtomic">
<!ENTITY text.node.children.type             "()">
<!ENTITY text.node.children.returns          "()">
<!ENTITY text.node.attributes.type           "()">
<!ENTITY text.node.attributes.returns        "()">
<!ENTITY text.node.namespaces.type           "()">
<!ENTITY text.node.namespaces.returns        "()">
<!ENTITY text.node.nilled.type               "()">
<!ENTITY text.node.nilled.returns            "()">
]>
<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>
  </publoc>
  <altlocs>
    <loc href="&url.this;data-model.xml">XML</loc>
  </altlocs>
  <latestloc>
    <loc href="http://www.w3.org/TR/xpath-datamodel/">http://www.w3.org/TR/xpath-datamodel/</loc>
  </latestloc>
  <prevlocs role="private">
    <loc href="http://www.w3.org/TR/2002/WD-query-datamodel-20021115/">http://www.w3.org/TR/2002/WD-query-datamodel-20021115/</loc>
    <loc href="http://www.w3.org/TR/2002/WD-query-datamodel-20020816/">http://www.w3.org/TR/2002/WD-query-datamodel-20020816/</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>Ashok Malhotra (XML Query and XSL WGs)</name>
      <affiliation>Microsoft</affiliation>
      <email href="mailto:ashokma@microsoft.com">ashokma@microsoft.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>
    <author>
      <name>Norman Walsh (XSL WG)</name>
      <affiliation>Sun Microsystems</affiliation>
      <email href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</email>
    </author>
  </authlist>

<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>The XQuery 1.0 and XPath 2.0 Data Model has been defined jointly by
the <loc href="http://www.w3.org/XML/Query">XML Query Working Group</loc>
and the
<loc href="http://www.w3.org/Style/XSL/">XSL Working Group</loc>
(both part of the <loc href="http://www.w3.org/XML/Activity.html">XML Activity</loc>).
</p>

<p>This is a
<loc href="http://www.w3.org/Consortium/Process-20010719/tr.html#last-call">Last Call
Working Draft</loc>. Comments on this document are
due on 30 June 2003. Comments should be sent to the W3C mailing list
<loc href="mailto:public-qt-comments@w3.org">public-qt-comments@w3.org</loc>.
(archived at
<loc href="http://lists.w3.org/Archives/Public/public-qt-comments/">http://lists.w3.org/Archives/Public/public-qt-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>

<p>
Patent disclosures relevant to this specification may be found on the
XML Query Working Group's patent disclosure page at
<loc href="http://www.w3.org/2002/08/xmlquery-IPR-statements">http://www.w3.org/2002/08/xmlquery-IPR-statements</loc>
and the XSL Working Group's patent disclosure page at
<loc href="http://www.w3.org/Style/XSL/Disclosures.html">http://www.w3.org/Style/XSL/Disclosures.html</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="XPath2"/>,
<bibref ref="XSLT2"/>, and <bibref ref="XQuery"/>, and any other
specifications that reference it. This data model is based on the
<bibref ref="XPath"/> data model and earlier work on an
<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>
<p>See the CVS changelog.</p>
</revisiondesc>
</header>

<body>

<div1 id="intro">
<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="XPath2"/>, <bibref ref="XSLT2"/> and
  <bibref ref="XQuery"/></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>Every value handled by the data model is a <emph>sequence</emph> of
  zero or more <emph>item</emph>s. An <emph>item</emph> is either a
  <emph>node</emph> or an <emph>atomic value</emph>.

  A node is defined in <specref ref="Node"/> and is one of seven node kinds.
  An atomic value encapsulates an XML Schema atomic type
  and a corresponding value of that type. They are defined in
  <specref ref="AtomicValue"/>.
  A sequence is an ordered collection of nodes, atomic values, or any
  mixture of nodes and atomic values.  A sequence cannot be a member of
  a sequence.  A single item appearing on its own is modeled as a sequence
  containing one item.  Sequences are defined in <specref ref="sequences"/>.
  </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>The data model can represent various
  values including not only the input and the output of a stylesheet or 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 an atomic value),
  a sequence expression resulting in a sequence of items, etc.
  </p>

  <p>In this document, we provide a precise definition of the properties of nodes
  in the XQuery 1.0 and XPath 2.0 Data Model, how they are 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 id="notation">
  <head>Notation</head>

  <p>In addition to prose, we define a set of accessor functions to explain the
data model. The accessors defined by the data
model are shown with the prefix <emph>dm</emph>. The prefix is always shown in
italics to emphasize that these functions are abstract; they exist to
explain the interface between the data model and specifications that
rely on the data model: they are not and cannot be made accessible
directly from the host language.</p>

<p>The signature of accessors is shown using the same
style as <bibref ref="XFO"/>. For example:</p>

<example role="signature">
  <proto class="dm" name="typed-value" return-type="xdt:anyAtomicType" returnSeq="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>In the notation syntax, the term <emph>Node</emph> denotes
the category of node values and <emph>Item</emph> refers to the
category of either node values or atomic values.</p>

<p>Some accessors can accept or return sequences.
The following notation is used to denote sequence values:</p>

<ulist>
<item><p><emph>V*</emph> denotes a sequence of zero or more items of type
<emph>V</emph>.
</p></item>
<item><p><emph>V?</emph> denotes a sequence of exactly zero or one items of type
<emph>V</emph>.
</p></item>
<item><p><emph>V+</emph> denotes a sequence of one or more items of type
<emph>V</emph>.
</p></item>
</ulist>

<p>In a sequence, <emph>V</emph> may be a <emph>Node</emph> or
<emph>AtomicValue</emph>, or the union (choice) of several categories of
<emph>Items</emph>.</p>

<p>There are some functions in the data model that are <emph>partial
functions</emph>. We use the occurrence indicators <emph>?</emph> or
<emph>*</emph> when specifying the return type of such functions.
For example, a node may have one parent node or no parent.
If the node argument has a parent, the
<function>parent</function> accessor returns a singleton sequence.  If the node
argument does not have a parent, it returns the empty sequence.
The signature of <function>parent</function> specifies that it returns
an empty sequence or a sequence containing one node:</p>

<example role="signature">
  <proto class="dm" name="parent" return-type="Node" returnEmptyOk="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<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 frequently uses the term <emph>expanded-QName</emph>.
  <termdef id="dt-expanded-qname" term="expanded-QName">An <term>expanded-QName</term>
  is a pair of values consisting of a namespace URI and
  a local name. They belong to the value space of the XML Schema type
  xs:QName. When this document refers to xs:QName we always
  mean the value space, i.e. a namespace URI, local name pair (and not
  the lexical space referring to constructs of the form prefix:local-name).</termdef>
  </p>

</div1>

<div1 id="concepts">
<head>Concepts</head>

<div2 id="node-identity">
<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, directed graph, in which each node has a unique
identity. Every node in the data model is unique: identical to itself,
and not identical to any other node.
</p>

<p>This concept should not be confused with the concept of a
unique ID, which is a unique name assigned to an
element by the author to represent references using ID/IDREF
correlation.</p>
</div2>

<div2 id="document-order">
<head>Document Order</head>

<p><termdef id="dt-document-order" term="document order">A
<term>document order</term> is defined on all the nodes in a document.
Document order is a total ordering, although the relative order of
some nodes is implementation-dependent. Informally, document order is
the order returned by an in-order, depth-first, left-to-right
traversal of the data model.</termdef> There is precisely one document
order and it satisfies the following constraints.</p>

<ulist>
<item><p>The document node is the first node.</p>
</item>
<item><p>The relative order of siblings is determined by their order in
the XML representation. A node N1 occurs before a node N2 in
document order if and only if the start of N1 occurs before the start of N2 in
the XML document.</p>
</item>
<item><p>Element nodes occur before their children; children occur before
following-siblings.</p>
</item>
<item><p>Namespace nodes immediately follow the element node with which
they are associated. The relative order of namespace nodes is stable but
implementation-dependent.</p>
</item>
<item><p>Attribute nodes immediately follow the namespace nodes of the element
with which they are associated. The relative order of attribute nodes is stable but
implementation-dependent.</p>
</item>
</ulist>

<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>

<p>The relative order of free-standing nodes (elements, attributes,
and other nodes created outside the context of a particular document) is also
implementation-dependent but stable.</p>

</div2>

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

<p>This document describes how to construct an instance of the data
model from an <bibref ref="xml-infoset"/>. Some aspects of the data
model are dependent upon XML Schema validity assessment; this document
describes how to determine those aspects of the data model from
a Post Schema Validation Infoset.
<termdef id="dt-psvi" term="PSVI">A Post Schema Validation Infoset,
or <term>PSVI</term>, is the augmented infoset produced by an XML Schema validation
episode.</termdef>.</p>

<p>Although we describe construction of a data model in terms of
infoset properties, an infoset is not an absolutely necessary
precondition for building an instance of the Data Model. Purely
synthetic data model instances are entirely appropriate as long as
they obey all of the constraints described in this document.</p>

<p>The data model supports well-formed XML documents conforming to
<bibref ref="xml-names"/>. XML documents that are not well-formed are
not XML, by definition. XML documents that do not conform to <bibref
ref="xml-names"/> are not supported (nor are they supported by
<bibref ref="xml-infoset"/>).</p>

<p>In other words, the data model supports the following classes
of XML documents:</p>

<ulist>
  <item>
    <p>Well-formed documents conforming to <bibref ref="xml-names"/>,</p>
  </item>
  <item>
    <p>DTD-valid documents conforming to <bibref ref="xml-names"/>, and</p>
  </item>
  <item>
    <p>W3C XML Schema-validated documents.</p>
  </item>
</ulist>

<p>The data model supports
some kinds of values that are not supported by <bibref ref="xml-infoset"/>.
Examples of these are well-formed document fragments, sequences of
fragments or sequences of documents. The data model also
supports values that are not nodes. Examples of these are atomic
values, sequences of atomic values, or sequences mixing nodes and
atomic values. These are necessary to be able to represent the results
of intermediate expressions in the data model during expression
processing.
</p>

<p>Schema-validated documents include documents in which some elements
or attributes have been validated by "lax" or "skip" validation
(<bibref ref="xmlschema-1"/>).</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, but
inconsistent data models are forbidden. Elements and attributes that
are not valid are treated as untyped.</p>

<p>In addition to specifying the transformation from the Post Schema
Validation Infoset (PSVI) to the data model, this document also specifies
the transformation from the data model back to the XML Information Set.
This is a useful notion that can be used for defining serialization and
validation.
Serialization can be viewed as a two step process, first transforming
to the XML Infoset and then to an XML document.
Validation is described conceptually as a process of mapping the data
model to the XML Infoset followed by XML Schema validation producing
a PSVI which is then loaded into the data model.</p>
  </div2>

<div2 id="types">
<head>Types</head>

<p>The data model supports a representation of named types as
stipulated by <bibref ref="XQFS"/>.</p>

<p>For named types, which includes both the built-in types defined by
<bibref ref="xmlschema-2"/> and named user-defined types declared in a
schema and imported by a stylesheet or query, the data model uses
<termref def="dt-expanded-qname">expanded-QNames</termref> to represent
their names. Since named types in XML Schema are global, an expanded-QName
uniquely identifies such a type.
The namespace name of the expanded-QName is the target namespace
of the schema and its local name is the name of the type.</p>

<p>For anonymous types, the processor must construct an
<termref def="dt-anonymous-type-name">anonymous type name</termref>
that is distinct from the name of every named type and the name of
every other anonymous type.
<termdef id="dt-anonymous-type-name" term="anonymous type name">An
<term>anonymous type name</term> is an implementation-defined,
globally unique type name provided by the processor for every anonymous
type declared in an imported schema.</termdef></p>

<p>In either case, the type names must also appear in the In-scope Schema
Definitions (as defined in <bibref ref="XPath2"/>) available to the processor.</p>

<p>The data model associates type information with element nodes,
attribute nodes and atomic values. The item is guaranteed to be a
valid instance of that type as defined by XML Schema.
</p>

<p>The data model defines an accessor <function>type</function> that
returns an expanded-QName corresponding to the type of the element
node, attribute node or atomic value. It returns
<code>xs:anyType</code> or <code>xs:anySimpleType</code> if no type
information exists, or if it failed W3C XML Schema validity
assessment.</p>

<p>When no type information exists for an element or an attribute node
we frequently use the terminology <quote>element with unknown type</quote>
or <quote>attribute with unknown simple type</quote>.
</p>

<p>The data model does not represent element or attribute declaration
schema components, but it supports various type-related operations.
The semantics of such operations, e.g. checking if a particular
instance of an element node has a given type is defined in
<bibref ref="XQFS"/>.
</p>

</div2>

<div2 id="typed-value">
<head>Typed Value and String Value</head>

<p>The content of a text, attribute, or element node can be interpreted
in two ways: as a string value or as a typed value.
For these types of nodes, the typed value can be extracted by the
<function>typed-value</function> accessor, and the string value can be
extracted by the <function>string-value</function> accessor.</p>

<p>The string value of a node is a single <code>xs:string</code>
derived from the content of the node as described in the definitions
of the accessor functions for each kind of node.</p>

<p>The typed value of a node is a sequence of atomic values derived
from its string value and its type in a way that is consistent with
schema validation, as described in the definitions of the accessor
functions for each kind of node.
</p>

</div2>

<div2 id="PSVI2Types">
<head>Mapping PSV Infoset additions to Types</head>

<p>This section specifies how the type of an element or attribute node
is computed from the <termref def="dt-psvi">PSVI</termref> properties that
specify validity and type
assessment for the node's corresponding information item.</p>

<p>A PSVI element or attribute information item has a
<emph role="infoset-property">validity</emph> property.
The <emph role="infoset-property">validity</emph> property may be
"<emph>valid</emph>", "<emph>invalid</emph>", or "<emph>notKnown</emph>"
and reflects the outcome of schema-validity assessment.
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 some general
type information with the element or attribute node if it is not known
to be valid.
</p>

<p>The precise definition of the type of an element or attribute
information item depends on the properties of the Infoset or PSVI.
In a PSVI,
XML Schema only guarantees the existence of either the
<emph role="infoset-property">type definition</emph> property,
or the
<emph role="infoset-property">type definition namespace</emph>,
<emph role="infoset-property">type definition name</emph> and
<emph role="infoset-property">type definition anonymous</emph>
properties.
If the type definition refers to a union type, there
are further properties defined, that refer to the type definition
which actually validated the item's normalized value.
These properties are either the
<emph role="infoset-property">member type definition</emph>,
or the
<emph role="infoset-property">member type definition namespace</emph>,
<emph role="infoset-property">member type definition name</emph> and
<emph role="infoset-property">member type definition anonymous</emph>
properties.
If these are available, the type of an element or attribute will
refer to the member type that actually validated the schema
normalized value.
</p>

<p>If a PSVI is not available, then the data model is constructed from the
Infoset in a manner that is compatible with the expectations of well-formed
or DTD-validated parsing of an XML document.</p>

<p>The <emph>type</emph> of an element information item is
represented by an <termref def="dt-expanded-qname">expanded-QName</termref>
whose namespace and local name correspond
to the first applicable items in the following list:
</p>

<ulist>
<item><p>If the <emph role="infoset-property">validity</emph> property exists
and is "<emph>valid</emph>":</p>

<ulist>
<item><p>If <emph role="infoset-property">member type definition</emph>
exists and its {name} property is present:</p>
  <ulist>
    <item><p>The {target namespace} and {name} properties of the
<emph role="infoset-property">member type definition</emph> property.</p></item>
   </ulist>
</item>

<item><p>If the <emph role="infoset-property">type definition</emph> property
exists and its {name} property is present:</p>
  <ulist>
    <item><p>The {target namespace} and {name} properties of the
<emph role="infoset-property">type definition</emph> property.</p></item>
   </ulist>
</item>

<item><p>If <emph role="infoset-property">member type definition anonymous</emph>
exists:</p>
  <ulist>
    <item><p>If it is <emph>false</emph>:
the <emph role="infoset-property">member type definition namespace</emph>
and the <emph role="infoset-property">member type definition name</emph>.
</p></item>
    <item><p>Otherwise, the namespace and local name of the appropriate
<termref def="dt-anonymous-type-name">anonymous type name</termref>.</p>
    </item>
  </ulist>
</item>

<item><p>If <emph role="infoset-property">type definition anonymous</emph>
exists:</p>
  <ulist>
    <item><p>If it is <emph>false</emph>:
the <emph role="infoset-property">type definition namespace</emph>
and the <emph role="infoset-property">type definition name</emph>
</p></item>
    <item><p>Otherwise, the namespace and local name of the appropriate
<termref def="dt-anonymous-type-name">anonymous type name</termref>.</p>
    </item>
  </ulist>
</item>
</ulist>
</item>

<item><p>If the <emph role="infoset-property">validity</emph> property
<emph>does not exist</emph> on this node or any of its ancestors,
Infoset-only processing is applied:</p>

<ulist>
<item><p>If the <emph role="infoset-property">attribute type</emph>
property exists and has one of the following values:
ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, or NMTOKENS,
the {target namespace} is "http://www.w3.org/2001/XMLSchema" and the
{name} is the [attribute type].</p>
</item>
</ulist>

<p>Note that this processing is only performed if no part of the
subtree that contains the node was schema validated. In particular,
Infoset-only processing does not apply to subtrees that are "skip"
validated in a document.</p>
</item>

<item><p>Otherwise, <code>xs:anyType</code> for elements or
<code>xs:anySimpleType</code> for attributes.
</p></item>
</ulist>

<p>If the expanded-QName that results from this derivation is not available
in the processor's In-Scope Schema Definitions, the expanded-QName is promoted
to <code>xs:anyType</code> for elements or
<code>xs:anySimpleType</code> for attributes. This can occur, for example, if the
processor does not support the schema import feature or if it was unable to
import the necessary schema.</p>

<p>Attributes from the XML Schema instance namespace,
"<code>http://www.w3.org/2001/XMLSchema-instance</code>",
(<att>xsi:schemaLocation</att>,
<att>xsi:type</att>, etc.) appear as ordinary attributes in the data model.
They will be validated appropriately by schema processors and will simply appear
as attributes of type <code>xs:anySimpleType</code> if they haven't been
schema validated.</p>

<div3 id="timezones">
<head>Mapping <code>xs:dateTime</code>, <code>xs:date</code>, and <code>xs:time</code> Values</head>

<p><bibref ref="xmlschema-2"/> permits <code>xs:dateTime</code>,
<code>xs:date</code>, and <code>xs:time</code>
values both with and without timezones. In the context of validation,
this is a purely lexical distinction. In order to compare dates and times,
an XML Schema validator converts all times to Coordinated Universal Time
(UTC or timezone Z). But in the data model, it is
necessary to preserve timezone information.</p>

<p>In order to achieve this goal
<code>xs:dateTime</code>, <code>xs:date</code>, and
<code>xs:time</code> values are represented as tuples in the data model: a time value
normalized to UTC and a timezone represented as a
<code>xdt:dayTimeDuration</code>.</p>

<p>The lexical representation of the value is converted to UTC
as defined by <bibref ref="xmlschema-2"/> and the timezone in the
lexical representation is converted to a <code>xdt:dayTimeDuration</code> value.
These two values are stored in the tuple.
</p>

<p>Lexical representations that do not have a timezone are assumed to be
in UTC for the purposes of normalization. An empty sequence is used for their
timezone in the tuple.</p>

<p>Thus, for the purpose of validation, <quote>2003-01-02T11:30:00-05:00</quote>
is converted to <quote>2003-01-02T16:30:00Z</quote>, but the data model stores
it as <quote>(2003-01-02T16:30:00Z, -PT5H0M)</quote>. The value
<quote>2003-01-16T16:30:00</quote> is stored as
it is <quote>(2003-01-02T16:30:00Z, ())</quote> because it has no timezone.
</p>

</div3>

<div3 id="nillable">
<head>Mapping <code>xsi:nil</code> on Element Nodes</head>

<p><bibref ref="xmlschema-2"/> introduced a mechanism for signaling
that an element should be accepted as valid when it has no content
despite a content type which does not require or even necessarily
allow empty content. That mechanism is the <att>xsi:nil</att> attribute.</p>

<p>The data model exposes this special semantic in the
&dm.prop.nilled; property.</p>

<p>If the <emph role="infoset-property">validity</emph> property exists on
an element node and is "<emph>valid</emph>" then
&dm.prop.nilled; may be set. The
&dm.prop.nilled; property is never set for
nodes that have not been successfully schema validated.</p>

<p>If the element is valid and has a PSVI
<emph role="infoset-property">nil</emph> property and that property is true,
then &dm.prop.nilled; is true. In all other cases, &dm.prop.nilled; is
false.</p>

</div3>
  </div2>

<div2 id="flags">
  <head>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>An instance of the data model can be constructed from an Infoset,
a PSVI, or from some other data source entirely. Different
applications may or may not choose to construct nodes in the data
model to represent comments, processing instructions, and
insignificant white space. These decisions are considered outside the
scope of the data model. Consequently the data model makes no attempt
to control or identify the sort of processing in this regard that an
application uses to construct a data model instance.</p>
</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>A tree contains a root plus all nodes that are reachable
  directly or indirectly from the root via the <function>children</function>,
  <function>attributes</function>, and <function>namespaces</function> 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="accessors">
<head>Accessors</head>

<p>A set of accessors is defined on all seven kinds of Nodes. Some
accessors return a constant empty sequence on certain node kinds. Some node
kinds have additional accessors that are not summarized here.</p>

<p>In order for applications to be able to operate on instances of the
data model, the model must expose properties of the items it contains.
The data model does this by defining a family of accessor functions.
These are not functions in the literal sense, they are not available
for users or applications to call directly, rather they are
descriptions of the interface that an implementation of the data model
must expose to applications. Functions and operators available to end-users
are described in <bibref ref="XFO"/>.</p>

<div3 id="dm-base-uri">
<head><code>base-uri</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="base-uri" return-type="xs:anyURI" returnEmptyOk="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>base-uri</function> accessor returns a sequence containing
zero or one uri references.</p>

<p>Document, element, and processing-instruction nodes have a base-uri
property. The base-uri of all other node types is the empty sequence.</p>

<p>If the base-uri property of a document, element, or
processing-instruction node is non-empty, its value is returned.</p>

<p>If the accessor is called on a node that does not have a base-uri
property, or whose base-uri property is empty, the base-uri of that
node's parent is returned. If the node has no parent, the empty sequence
is returned.</p>

</div3>

<div3 id="dm-node-kind">
<head><code>node-kind</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="node-kind" return-type="xs:string" returnEmptyOk="no">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>node-kind</function> accessor returns a string value identifying the
kind of node on which the accessor was called. One of the following values
is returned:</p>

<ulist>
<item><p>"<code>document</code>" for document nodes.</p></item>
<item><p>"<code>element</code>" for element nodes.</p></item>
<item><p>"<code>attribute</code>" for attribute nodes.</p></item>
<item><p>"<code>text</code>" for text nodes.</p></item>
<item><p>"<code>namespace</code>" for namespace nodes.</p></item>
<item><p>"<code>processing-instruction</code>" for processing instruction nodes.</p></item>
<item><p>"<code>comment</code>" for comment nodes.</p></item>
</ulist>

</div3>

<div3 id="dm-node-name">
<head><code>node-name</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="node-name" return-type="xs:QName" returnEmptyOk="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>node-name</function> accessor returns a sequence of zero or one
xs:QNames.</p>

<ulist>
<item><p>For element and attribute nodes, <function>node-name</function> returns the
qualified name of the element or attribute.</p></item>
<item><p>For processing-instructions nodes, <function>node-name</function> returns an
xs:QName with the processing instruction target name in the local-name and
no namespace URI.</p></item>
<item><p>For namespace nodes, <function>node-name</function> returns an xs:QName with
the <emph>prefix</emph> of the namespace declaration in the local-name and
no namespace URI. If the namespace declaration declares the default namespace,
which has no prefix, an empty sequence is returned.</p>
<p>Some implementations may
not preserve information about the prefixes declared. In these cases,
the <function>node-name</function> accessor returns the empty
sequence when applied to namespace nodes.</p>
</item>
</ulist>
</div3>

<div3 id="dm-parent">
<head><code>parent</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="parent" return-type="Node" returnEmptyOk="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>parent</function> accessor returns a sequence containing
zero or one nodes.</p>

<p>For nodes that have a parent, <function>parent</function> returns the
parent node. For all other nodes, it returns the empty sequence.</p>

<p>If the return value is not the empty sequence, it will always be
either an element node or a document node.</p>
</div3>

<div3 id="dm-string-value">
<head><code>string-value</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="string-value" return-type="xs:string" returnEmptyOk="no">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>Every node has a string value; the way in which the string value of
a node is computed is different for each kind of node and is specified
in the sections on nodes below.</p>

<p>The string value of an atomic value is computed by casting it to an
<code>xs:string</code> as per the rules described in <bibref ref="XFO"/>.</p>

</div3>

<div3 id="dm-typed-value">
<head><code>typed-value</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="typed-value" return-type="xdt:anyAtomicType" returnSeq="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>typed-value</function> accessor returns the
typed-value of the node, which is a sequence of zero or more atomic
values derived from the string-value of the node and its type in
such a way as to be consistent with validation.</p>

<ulist>
<item>
<p>If the node is a comment, document, namespace,
processing-instruction, or text node, then its typed value is equal to
its string value as an instance of <code>xdt:untypedAtomic</code>.
</p>
</item>
<item>
<p>If the node is an attribute node with type
<code>xs:anySimpleType</code>, then its typed value is equal to its
string value as an instance of <code>xdt:untypedAtomic</code>. The
typed value of an attribute node with any other type is derived from
its string value and type annotation in a way that is consistent with
XML Schema validation.</p>
</item>
<item>
<p>If the node is an element node with type <code>xs:anyType</code>,
then its typed value is equal to its string value, as an instance of
<code>xdt:untypedAtomic</code>.</p></item>

<item>
<p>If the node is an element node with a simple type or with a complex
type of simple content, then its typed value is derived from its
string value and type in a way that is consistent with XML Schema
validation.</p>
</item>

<item>
<p>If the item is an element node with complex type of empty content,
then its typed value is the empty sequence.</p>
</item>

<item>
<p>If the node is an element node with a complex type of mixed
content, then its typed value is its string value as an instance of
xdt:untypedAtomic.</p>
</item>

<item>
<p>If the item is an element node with complex type of complex
content, then its typed value is undefined and
<function>typed-value</function> raises a type error, which may be
handled by the host language.</p>
</item>
</ulist>

<p>For detailed semantics see <bibref ref='XQFS'/>.</p>

<p>For <code>xs:dateTime</code>, <code>xs:date</code> and
<code>xs:time</code>, the typed value is the atomic value
that is determined from its tuple representation as follows:</p>

<ulist>
<item><p>If the timezone component is not the empty sequence, then the value
contains the time component, normalized to the timezone specified by
the timezone component, as well as the timezone component. The tuple
"(2003-01-02T16:30:00Z, -PT5H0M)" produces the value
"2003-01-02T11:30:00-05:00".</p></item>
<item><p>If the timezone component is the empty sequence, then the time
component without any indication of timezone. The tuple
"(2003-01-02T16:30:00Z, ())"  produces the value "2003-01-02T16:30:00".</p>
</item>
</ulist>

</div3>

<div3 id="dm-type">
<head><code>type</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="type" return-type="xs:QName" returnEmptyOk="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>type</function> accessor returns the name of the type
of a node.</p>

<p>For element nodes and attribute nodes, <function>type</function>
returns the name of the type of the node (as an <code>xs:QName</code>) if it has
one. If the type is anonymous, or if no type information exists, the
name returned will be unique but implementation defined.</p>

<note>
  <p>The use of <code>xs:QName</code> in this signature is part of the
data model formalism. In practice, implementations are not required to use
xs:QNames to represent the implementation-defined names of anonymous types.</p>
</note>

<p>For text nodes, <function>type</function> returns
<code>xdt:untypedAtomic</code>.
</p>

<p>For other node kinds, it always returns the empty sequence. </p>

</div3>

<div3 id="dm-children">
<head><code>children</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="children" return-type="Node" returnSeq="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>children</function> accessor returns a sequence containing
zero or more nodes.</p>

<p>For document and element nodes, it returns the nodes that are the
children of that node in document order. It returns the empty sequence for document and
element nodes that have no children. If children exist, they will
always consist exclusively of element, processing-instruction,
comment, and text nodes. Attribute, namespace, and document nodes can
never appear as children.</p>

<p>For all other nodes, it always returns the empty sequence.</p>

<p>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>

<p>The sequence of children will never contain adjacent text nodes.</p>

</div3>

<div3 id="dm-attributes">
<head><code>attributes</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="attributes" return-type="AttributeNode" returnSeq="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>attributes</function> accessor returns a sequence containing
zero or more attribute nodes.</p>

<p>For element nodes, these are the attributes of the node. For all other nodes,
it always returns the empty sequence.</p>

</div3>

<div3 id="dm-namespaces">
<head><code>namespaces</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="namespaces" return-type="NamespaceNode" returnSeq="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>namespaces</function> accessor returns a sequence containing
zero or more namespace nodes.</p>

<p>For element nodes, these are the namespaces of the node. For all other nodes,
it always returns the empty sequence.</p>
</div3>

<div3 id="dm-nilled">
<head><code>nilled</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="nilled" return-type="xs:boolean" returnSeq="no">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>nilled</function> accessor returns the setting of the
&dm.prop.nilled; property of an element node.
See <specref ref="nillable"/>.</p>

<p>For all other nodes, it always returns the emtpy sequence.</p>

</div3>

<!--
<div3 id="dm-unique-ID">
<head><code>unique-ID</code> Accessor</head>

<example role="signature">
  <proto class="dm" name="unique-ID" return-type="xs:ID" returnEmptyOk="yes">
    <arg name="n" type="Node"/>
  </proto>
</example>

<p>The <function>unique-ID</function> accessor returns a sequence containing
zero or one xs:ID values.</p>

<p>For element nodes, this is the value of the attribute or child
element with that is of type xs:ID, if it exists. For all other nodes,
it always returns the empty sequence.</p>
</div3>
-->
</div2>

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

<div3 id="DocumentNodeOverview">
  <head>Overview</head>

<p>Document nodes encapsulate XML documents. Documents have the following
properties:</p>

<ulist>
<item><p>&dm.prop.base-uri;, possibly empty.
</p></item>
<item><p>&dm.prop.children;, possibly empty.
</p></item>
<item><p><emph role='dm-node-property'>unparsed-entities</emph>, possibly empty.
</p></item>
<item><p><emph role='dm-node-property'>document-uri</emph>, possibly empty.
</p></item>
</ulist>

<p>Document nodes must satisfy the following constraints.</p>

<olist>
<item><p>Every document node must have a unique identity, distinct from all other nodes.
</p></item>
<item><p>The &dm.prop.children; must consist exclusively
of element, processing instruction, comment, and text nodes if it is not empty.
Attribute, namespace, and document nodes can never appear as children
</p></item>
<item><p>The sequence of nodes in the &dm.prop.children;
property is ordered and must be in document order.
</p></item>
<item><p>The &dm.prop.children; property must not
contain two consecutive text nodes.</p>
</item>
<item><p>If a node <emph>N</emph> is a child of a document <emph>D</emph>,
then the parent of <emph>N</emph> must be <emph>D</emph>.</p></item>
<item><p>If a node <emph>N</emph> has a parent document <emph>D</emph>, then
<emph>N</emph> must be among the children of <emph>D</emph>.</p></item>
<item><p>Every child of a document must be distinct.</p></item>
</olist>

<p>In a well-formed document, the children of the document node must
not be empty and 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 may be empty and it allows more than one
element node as a child and also permits text nodes as children.
</p>

  <note>
    <p>Document nodes and XPath 1.0 root nodes are essentially
    identical.</p>
  </note>

<p>Implementations that support DTD processing and access to the
unparsed entity accessors, use the <emph
role='dm-node-property'>unparsed-entities</emph> property to associate
information about an unordered collection of unparsed entities with a
document node.</p>

</div3>

<div3 id="DocumentNodeAccessors">
  <head>Accessors</head>

<table border="1" cellspacing="0" summary="Accessor summary">
  <thead>
    <tr>
      <td>Accessor</td>
      <td>Returns:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><function>base-uri</function></td>
      <td>&document.node.base-uri.returns;</td>
    </tr>
    <tr>
      <td><function>node-kind</function></td>
      <td>&document.node.node-kind.returns;</td>
    </tr>
    <tr>
      <td><function>node-name</function></td>
      <td>&document.node.node-name.returns;</td>
    </tr>
    <tr>
      <td><function>parent</function></td>
      <td>&document.node.parent.returns;</td>
    </tr>
    <tr>
      <td><function>string-value</function></td>
      <td>&document.node.string-value.returns;</td>
    </tr>
    <tr>
      <td><function>typed-value</function></td>
      <td>&document.node.typed-value.returns;</td>
    </tr>
    <tr>
      <td><function>type</function></td>
      <td>&document.node.type.returns;</td>
    </tr>
    <tr>
      <td><function>children</function></td>
      <td>&document.node.children.returns;</td>
    </tr>
    <tr>
      <td><function>attributes</function></td>
      <td>&document.node.attributes.returns;</td>
    </tr>
    <tr>
      <td><function>namespaces</function></td>
      <td>&document.node.namespaces.returns;</td>
    </tr>
    <tr>
      <td><function>nilled</function></td>
      <td>&document.node.nilled.returns;</td>
    </tr>
  </tbody>
</table>

<p>Three additional accessors are defined on document nodes:</p>

<example role="signature">
  <proto class="dm" name="unparsed-entity-system-id" return-type="xs:string" returnEmptyOk="yes">
    <arg name="node" type="DocumentNode"/>
    <arg name="entityname" type="xs:string"/>
  </proto>
</example>

<p>The <function>unparsed-entity-system-id</function> accessor returns the
system identifier of an unparsed external entity declared in the
specified document. If no entity with the name specified in <code>$entityname</code>
exists, or if the entity is not an external unparsed entity, the empty sequence
is returned.</p>

<example role="signature">
  <proto class="dm" name="unparsed-entity-public-id" return-type="xs:string" returnEmptyOk="yes">
    <arg name="node" type="DocumentNode"/>
    <arg name="entityname" type="xs:string"/>
  </proto>
</example>

<p>The <function>unparsed-entity-public-id</function> accessor returns the
public identifier of an unparsed external entity declared in the
specified document.  If no entity with the name specified in <code>$entityname</code>
exists, or if the entity is not an external unparsed entity, or if the entity
has no public identifier, the empty sequence
is returned.</p>

<example role="signature">
  <proto class="dm" name="document-uri" return-type="xs:string" returnEmptyOk="yes">
    <arg name="node" type="DocumentNode"/>
  </proto>
</example>

<p>The <function>document-uri</function> accessor returns the
absolute URI of the resource from which the document node was constructed, if
the absolute URI is available. If there is no URI available, or if it cannot
be made absolute when the data model is constructed, the empty sequence is returned.
</p>

<p>For example, if a collection of documents is
returned by the <code>fn:collection</code> function, the
<function>document-uri</function> may serve to distinguish between them
even though each has the same <function>base-uri</function>.</p>

</div3>

<div3 id="DocumentNodeIS2DM">
<head>PSVI to Data Model Mapping</head>

<p>When a data model fragment is created from the PSVI, a
<emph role="info-item">document information item</emph> is mapped
to a Document Node. The precise transformation is described
by specifying the PSVI property corresponding to each property of a
document node.</p>

<glist>
<gitem>
<label>&dm.prop.base-uri;</label>
<def>
<p>The value of the <emph role="infoset-property">base URI</emph> property.</p>
</def>
</gitem>

<gitem>
<label>&dm.prop.children;</label>
<def>
<p>The sequence of nodes constructed from the information
items found in the <emph role="infoset-property">children</emph>
property.</p>
</def>
</gitem>
</glist>

<p>To construct the value of the &dm.prop.children; property, for
each element, processing instruction, comment, and maximal sequence of
adjacent character information items found in the
<emph role="infoset-property">children</emph> property, a corresponding
Element, Processing Instruction, Comment, and Text node is constructed
and that sequence of nodes is used as the value. If present among the
<emph role="infoset-property">children</emph>, the
<emph role="infoset-property">document type declaration</emph> information item
is ignored.
</p>

</div3>

<div3 id="DocumentNodeDM2IS">
  <head>Data Model to Infoset Mapping</head>

<p>The mapping of the data model to the XML Information Set maps a
Document Node to a <emph role="info-item">document information item</emph>.
The properties of the <emph role="info-item">document information item</emph>
are constructed as follows:</p>

<table border="1" cellspacing="0" summary="PSVI mapping summary">
  <colgroup>
    <col width="35%"/>
    <col width="65%"/>
  </colgroup>
  <thead>
    <tr>
      <td>Property</td>
      <td>Value:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><emph role="infoset-property">base URI</emph></td>
      <td>The value returned by the <function>base-uri</function> accessor</td>
    </tr>
    <tr>
      <td valign="top"><emph role="infoset-property">children</emph></td>
      <td>The sequence of information items constructed from the nodes
returned by the <function>children</function> accessor. In other
words, for each node returned by the <function>children</function>
accessor, a corresponding information item is constructed and that
sequence of information items is used as the value for the
<emph role="infoset-property">children</emph> property.</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">document element</emph></td>
      <td rowspan="7">The values of these properties are implementation-defined but
must be consistent with the rest of the Infoset constructed.</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">notations</emph></td>
    </tr>
    <tr>
      <td><emph role="infoset-property">unparsed entities</emph></td>
    </tr>
    <tr>
      <td><emph role="infoset-property">character encoding scheme</emph></td>
    </tr>
    <tr>
      <td><emph role="infoset-property">standalone</emph></td>
    </tr>
    <tr>
      <td><emph role="infoset-property">version</emph></td>
    </tr>
    <tr>
      <td><emph role="infoset-property">all declarations processed</emph></td>
    </tr>
  </tbody>
</table>

<note>
<p>Since Document Nodes are more permissive than
<emph role="info-item">document information item</emph>s, the
resulting Infoset may be invalid.</p>
</note>

</div3>

</div2>


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

<div3 id="ElementNodeOverview">
<head>Overview</head>

<p>Element nodes encapsulate XML elements. Elements have the following properties:</p>

<ulist>
<item><p>&dm.prop.base-uri;, possibly empty.
</p></item>
<item><p>&dm.prop.node-name;
</p></item>
<item><p>&dm.prop.parent;, possibly empty
</p></item>
<item><p>&dm.prop.type;
</p></item>
<item><p>&dm.prop.children;, possibly empty
</p></item>
<item><p>&dm.prop.attributes;, possibly empty
</p></item>
<item><p>&dm.prop.namespaces;, possibly empty
</p></item>
<item><p>&dm.prop.nilled;
</p></item>
</ulist>

<p>Element nodes must satisfy the following constraints.</p>

<olist>
<item><p>Every element node must have a unique identity, distinct from all other nodes.
</p></item>
<item><p>The &dm.prop.children; must consist exclusively
of element, processing instruction, comment, and text nodes if it is not empty.
Attribute, namespace, and document nodes can never appear as children
</p></item>
<item><p>The sequence of nodes in the &dm.prop.children;
property is ordered and must be in document order.
</p></item>
<item><p>The &dm.prop.children; property must not
contain two consecutive text nodes.</p>
</item>
<item><p>Every child of an element must be distinct.
</p></item>
<item><p>The attributes of an element must have distinct names.
</p></item>
<item><p>The namespace nodes of an element must have distinct names.
At most one of the namespace nodes of an element has no name (this is the
default namespace). A namespace node whose namespace URI is the zero-length
string must have no name.
No namespace node may have the name "<code>xmlns</code>".
</p></item>
<item><p>If a node <emph>N</emph> is a child of an element <emph>E</emph>,
then the parent of <emph>N</emph> must be <emph>E</emph>.
</p></item>
<item><p>Exclusive of attribute nodes, if a node <emph>N</emph> has a
parent element <emph>E</emph>, then <emph>N</emph> must be among the children
of <emph>E</emph>. (Attribute nodes have a parent, but they do not appear
among the children of their parent.)</p>
<p>The data model permits element nodes without parents
(to represent partial results during expression processing, for example).
Such elements must not
appear among the children of any other node.
</p>
</item>
<item><p>If an attribute node <emph>A</emph> has a
parent element <emph>E</emph>, then <emph>A</emph> must be among the attributes
of <emph>E</emph>.</p>
<p>The data model permits attribute nodes without parents
(to represent partial results during expression processing, for example).
Such attributes must not
appear among the attributes of any element node.
</p>
</item>
</olist>

<p>The data model does not enforce a constraint that the namespaces of an
element must be a superset of the namespaces of its parent, nor does it
enforce a constraint that the namespaces of an element must include
namespace nodes for each of the namespace URIs used in the element name and
the names of its attributes, or of namespace URIs used in the content of
elements and attributes of type xs:QName. Applications of the data model
(such as XSLT and XQuery) may enforce such constraints in particular
circumstances, but these constraints are not part of the data model.
</p>

</div3>

<div3 id="ElementNodeAccessors">
  <head>Accessors</head>

<table border="1" cellspacing="0" summary="Accessor summary">
  <thead>
    <tr>
      <td>Accessor</td>
      <td>Returns:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><function>base-uri</function></td>
      <td>&element.node.base-uri.returns;</td>
    </tr>
    <tr>
      <td><function>node-kind</function></td>
      <td>&element.node.node-kind.returns;</td>
    </tr>
    <tr>
      <td><function>node-name</function></td>
      <td>&element.node.node-name.returns;</td>
    </tr>
    <tr>
      <td><function>parent</function></td>
      <td>&element.node.parent.returns;</td>
    </tr>
    <tr>
      <td><function>string-value</function></td>
      <td>&element.node.string-value.returns;</td>
    </tr>
    <tr>
      <td><function>typed-value</function></td>
      <td>&element.node.typed-value.returns;</td>
    </tr>
    <tr>
      <td><function>type</function></td>
      <td>&element.node.type.returns;</td>
    </tr>
    <tr>
      <td><function>children</function></td>
      <td>&element.node.children.returns;</td>
    </tr>
    <tr>
      <td><function>attributes</function></td>
      <td>&element.node.attributes.returns;</td>
    </tr>
    <tr>
      <td><function>namespaces</function></td>
      <td>&element.node.namespaces.returns;</td>
    </tr>
    <tr>
      <td><function>nilled</function></td>
      <td>&element.node.nilled.returns;</td>
    </tr>
  </tbody>
</table>

<p>The <function>base-uri</function> accessor returns the
&dm.prop.base-uri; property of the element node,
if it exists. If it does not exist, the base URI of the element's parent is
returned.</p>

<p>The accessors <function>namespaces</function> and <function>attributes</function>
return the same set of namespace and attribute nodes (respectively) associated
with the element. They are not constrained to return them
in any particular order.</p>

<p>The <function>parent</function> accessor returns the empty sequence
if the element has no parent.</p>

<p>If the element node's type is <code>xs:anyType</code>, the
<function>typed-value</function> accessor returns the node's string value
as <code>xs:anySimpleType</code>. If the type is a complex type with complex content,
invoking <function>typed-value</function> raises an error.</p>

<p>The <function>typed-value</function> accessor returns the typed-value
of the node, which is a sequence of zero or more atomic values.
The typed-value is closely related to the node's string-value and its
type. For example:</p>

<ulist>
<item><p>When the node's string-value is "3.14" and its type
is <code>xs:decimal</code>, the typed-value is a sequence containing the
atomic value 3.14 of type decimal.</p></item>
<item><p>When the node's string-value is "foo bar baz" and its type
is <code>xs:IDREFS</code>, the typed-value is a sequence containing the
atomic values "foo", "bar", and "baz", each of type xs:IDREF.</p></item>
<item><p>When the node's string-value is "17" and its type
is <code>xs:anyType</code>, the typed-value is a sequence containing the
atomic value "17" of type xs:anySimpleType.</p></item>
</ulist>

<p>In fact, when the type is an atomic type, typed-value is always the
atomic-value constructed from the string-value and the type.</p>

<p>In the general case, <function>typed-value</function> constructs a
sequence of atomic values. These values are derived from the
string-value of the element and its type, in such a way as to be
consistent with validation.
</p>

<p>One additional accessors is defined on element nodes:</p>

<example role="signature">
  <proto class="dm" name="element-declaration" return-type="xs:string"
         returnSeq="yes">
    <arg name="node" type="ElementNode"/>
  </proto>
</example>

<p>The <function>element-declaration</function> accessor returns the
xs:QName of the global element declaration associated with this
element. If the element declaration is local, it returns a sequence
consisting of the xs:QName of the local element declaration and the
<xspecref href="http://www.w3.org/TR/xpath20/#doc-SchemaGlobalContext">SchemaGlobalContext</xspecref>
of the declaration.</p>

<p>This declaration can be used by implementations to identify
substitution groups, nillability, and other aspects of the declaration.</p>

</div3>

<div3 id="ElementNodePSVI2DM">
<head>PSVI to Data Model Mapping</head>

<p>When a data model fragment is created from the PSVI, an
<emph role="info-item">element information item</emph> is mapped
to an Element Node. The precise transformation is described
by specifying the PSVI property corresponding to each property of an
element node.</p>

<glist>
<gitem>
<label>&dm.prop.base-uri;</label>
<def>
<p>The value of the <emph role="infoset-property">base URI</emph> property.</p>
</def>
</gitem>

<gitem>
<label>&dm.prop.node-name;</label>
<def>
<p>An <code>xs:QName</code> constructed from the
<emph role="infoset-property">local name</emph> property
and the
<emph role="infoset-property">namespace name</emph> property</p>
</def>
</gitem>

<gitem>
<label>&dm.prop.parent;</label>
<def>
<p>The value of the <emph role="infoset-property">parent</emph> property.</p>
</def>
</gitem>

<gitem>
<label>&dm.prop.type;</label>
<def><p>The <code>xs:QName</code> computed as described in
<specref ref="PSVI2Types"/>.
Note that if the type referenced would be a union type then
type refers to the member type that actually validated the
schema normalized value.</p>
</def>
</gitem>

<gitem>
<label>&dm.prop.children;</label>
<def>
<ulist>
<item>
<p>If the <emph role="infoset-property">schema normalized value</emph>
PSVI property exists and is not absent, the processor may,
depending on the implementation, use
a sequence of nodes containing the Processing
Instruction and Comment nodes corresponding to the
<emph role="info-item">processing instruction</emph> and
<emph role="info-item">comment</emph>
information items found in the
<emph role="infoset-property">children</emph>
property, plus a single text node whose string value is the
the <emph role="infoset-property">schema normalized value</emph>.
The order of these nodes is implementation defined.</p>
</item>

<item>
<p>Otherwise, a sequence of nodes constructed in the
following way from the information items found in the 
<emph role="infoset-property">children</emph>
property: for each element, processing instruction, comment, and
maximal sequence of adjacent character information items found in
the
<emph role="infoset-property">children</emph>
property, a corresponding Element, Processing
Instruction, Comment, and Text node is constructed.</p>
</item>
</ulist>

<p>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>
</def>
</gitem>

<gitem>
<label>&dm.prop.attributes;</label>
<def><p>A set of Attribute Nodes constructed from the
<emph role="info-item">attribute information items</emph>
appearing in the <emph role="infoset-property">attributes</emph>
property. This includes all of the <quote>special</quote> attributes
(<att>xml:lang</att>, <att>xml:space</att>, <att>xsi:type</att>, etc.)
but does not include namespace declarations (because they are not attributes).</p>
</def>
</gitem>

<gitem>
<label>&dm.prop.namespaces;</label>
<def><p>A set of Namespace Nodes constructed from the
<emph role="info-item">namespace information items</emph>
appearing in the <emph role="infoset-property">in-scope namespaces</emph>
property.</p>

<p>Some implementations may choose to use only a subset of the
namespaces present in the PSVI. In particular, they may exclude
namespace nodes for namespaces which do not appear in the qualified
name of any element or attribute information item. This can arise when
xs:QNames are used in content.</p>
</def>
</gitem>

<gitem>
<label>&dm.prop.nilled;</label>
<def><p>If the <emph role="infoset-property">validity</emph> property exists
and is <quote><emph>valid</emph></quote> and the
<emph role="infoset-property">attributes</emph> property contains an attribute with the
local-name <quote><code>nil</code></quote> and the namespace URI
<quote><code>http://www.w3.org/2001/XMLSchema-instance</code></quote>,
then <quote><emph>true</emph></quote>, otherwise <quote><emph>false</emph></quote>.</p>
</def>
</gitem>
</glist>
</div3>

<div3 id="ElementNodeDM2IS">
<head>Data Model to Infoset Mapping</head>

<p>The mapping of the data model to the XML Information Set maps an
Element Node to an <emph role="info-item">element information item</emph>.
The properties of the <emph role="info-item">element information item</emph>
are constructed as follows:</p>

<table border="1" cellspacing="0" summary="PSVI mapping summary">
  <colgroup>
    <col width="35%"/>
    <col width="65%"/>
  </colgroup>
  <thead>
    <tr>
      <td>Property</td>
      <td>Value:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><emph role="infoset-property">namespace name</emph></td>
      <td>The namespace name of the xs:QName returned by the <function>node-name</function> accessor</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">local name</emph></td>
      <td>The local name of the xs:QName returned by the <function>node-name</function> accessor</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">prefix</emph></td>
      <td>An appropriate namespace prefix, as described below</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">children</emph></td>
      <td>The sequence of information items constructed from the nodes
      returned by the <function>children</function> accessor. In other
      words, for each node returned by the
      <function>children</function> accessor, a corresponding
      information item is constructed and that sequence of information
      items is used as the value for the
      <emph role="infoset-property">namespace name</emph> property.</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">attributes</emph></td>
      <td>The sequence of <emph role="info-item">attribute information item</emph>s
constructed from the nodes returned by the <function>attributes</function> accessor.</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">in-scope namespaces</emph></td>
      <td>The sequence of <emph role="info-item">namespace information item</emph>s
constructed from the nodes returned by the <function>namespaces</function> accessor.</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">base URI</emph></td>
      <td>The value returned by the <function>base-uri</function> accessor</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">parent</emph></td>
      <td>The information item constructed from the node returned by the
<function>parent</function> accessor. If the node has no parent, the property
must be left absent and the resulting Infoset will not be valid.</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">namespace attributes</emph></td>
      <td>The sequence of <emph role="info-item">namespace information item</emph>s
constructed from the nodes that are present in the difference between the
sequence of nodes returned by the <function>namespaces</function> accessor
on this element and the sequence of nodes returned by the
<function>namespaces</function> accessor of this element's
<function>parent</function>; see below.</td>
    </tr>
  </tbody>
</table>

<p>An implementation must construct the value of the
<emph role="infoset-property">prefix</emph> property as if the following
algorithm was applied: if
the element has at least one namespace node whose namespace URI is the
same as the namespace name of the xs:QName returned by the <function>node-name</function>
accessor, it returns the local part of the name of that namespace node or
the empty string if the namespace node has no name. If there are several
such namespace nodes, it chooses one of them arbitrarily. If there is no
such namespace node, it generates an arbitrary prefix that is distinct from
the <function>node-name</function> of any of the element's namespaces. The
<emph role="infoset-property">prefix</emph> is the empty string if the
element has an empty <emph role="infoset-property">namespace name</emph>
(if it is in the null namespace).
</p>

<p>If a new prefix is generated, a corresponding
<emph role="info-item">namespace information item</emph>
must be added to the
<emph role="infoset-property">in-scope namespaces</emph> property of the
<emph role="info-item">element information item</emph>. The
<emph role="info-item">namespace information item</emph> must associate
the generated prefix with the namespace name of the xs:QName returned by
the element's <function>node-name</function> accessor.</p>

<note><p>If the implementation has allowed in-scope namespaces to be discarded
from the data model, then these namespaces may need to be reintroduced when
creating an Infoset in order to ensure that the Infoset corresponds to a
document that is namespace well-formed as defined in <bibref ref="xml-names"/>. </p>
</note>

<note><p>The algorithm used to calculate namespace attributes
will need to be adjusted to cater for XML Namespaces 1.1, which allows
the "undeclaration" of all namespaces, whether they have a
prefix or not.</p>
</note>

<p>The <emph role="infoset-property">namespace attributes</emph> property
is computed so that it contains the smallest possible set of namespace attributes.
For example, suppose that the <function>namespaces</function> accessor for
this element returns namespace nodes for the <quote>foo</quote>, <quote>bar</quote>,
and <quote>baz</quote> namespaces and the <function>namespaces</function> accessor for
this element's parent returns namespace nodes for the <quote>foo</quote> and
<quote>bar</quote> namespaces. In this case, the
<emph role="infoset-property">namespace attributes</emph> property will contain
a single <emph role="info-item">namespace information item</emph> for the
<quote>baz</quote> namespace.</p>

</div3>
</div2>


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

<div3 id="AttributeNodeOverview">
  <head>Overview</head>

  <p>Attribute nodes encapsulate XML attributes. Attributes have the
following properties:</p>

  <ulist>
  <item><p>&dm.prop.node-name;
  </p></item>
  <item><p>&dm.prop.string-value;
  </p></item>
  <item><p>&dm.prop.parent;, possibly empty
  </p></item>
  <item><p>&dm.prop.type;
  </p></item>
  </ulist>

<p>Attribute nodes must satisfy the following constraints.</p>

<olist>
<item><p>Every attribute node must have a unique identity, distinct from all other nodes.
</p></item>
<item><p>If a attribute node <emph>A</emph> has a
parent element <emph>E</emph>, then <emph>A</emph> must be among the attributes
of <emph>E</emph>.</p>
<p>The data model permits attribute nodes without parents
(to represent partial results during expression processing, for example).
Such attributes must not
appear among the attributes of any element node.
</p>
</item>
</olist>

<p>For convenience, the element node that owns this attribute is called
its "parent" even though an attribute node is not a "child" of its
parent element. </p>

</div3>

<div3 id="AttributeNodeAccessors">
  <head>Accessors</head>

<table border="1" cellspacing="0" summary="Accessor summary">
  <thead>
    <tr>
      <td>Accessor</td>
      <td>Returns:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><function>base-uri</function></td>
      <td>&attribute.node.base-uri.returns;</td>
    </tr>
    <tr>
      <td><function>node-kind</function></td>
      <td>&attribute.node.node-kind.returns;</td>
    </tr>
    <tr>
      <td><function>node-name</function></td>
      <td>&attribute.node.node-name.returns;</td>
    </tr>
    <tr>
      <td><function>parent</function></td>
      <td>&attribute.node.parent.returns;</td>
    </tr>
    <tr>
      <td><function>string-value</function></td>
      <td>&attribute.node.string-value.returns;</td>
    </tr>
    <tr>
      <td><function>typed-value</function></td>
      <td>&attribute.node.typed-value.returns;</td>
    </tr>
    <tr>
      <td><function>type</function></td>
      <td>&attribute.node.type.returns;</td>
    </tr>
    <tr>
      <td><function>children</function></td>
      <td>&attribute.node.children.returns;</td>
    </tr>
    <tr>
      <td><function>attributes</function></td>
      <td>&attribute.node.attributes.returns;</td>
    </tr>
    <tr>
      <td><function>namespaces</function></td>
      <td>&attribute.node.namespaces.returns;</td>
    </tr>
    <tr>
      <td><function>nilled</function></td>
      <td>&attribute.node.nilled.returns;</td>
    </tr>
  </tbody>
</table>

<p>If the attribute node's type is <code>xs:anySimpleType</code>, the
<function>typed-value</function> accessor returns the node's string value
as <code>xdt:untypedAtomic</code>.</p>

<p>The <function>typed-value</function> accessor returns the typed-value
of the node, which is a sequence of zero or more atomic values.
The typed-value is closely related to the node's string-value and its
type. For example:</p>

<ulist>
<item><p>When the node's string-value is "3.14" and its type
is <code>xs:decimal</code>, the typed-value is a sequence containing the
atomic value 3.14 of type decimal.</p></item>
<item><p>When the node's string-value is "foo bar baz" and its type
is <code>xs:IDREFS</code>, the typed-value is a sequence containing the
atomic values "foo", "bar", and "baz", each of type xs:IDREF.</p></item>
<item><p>When the node's string-value is "17" and its type
is <code>xs:anyType</code>, the typed-value is a sequence containing the
atomic value "17" of type xs:untypedAtomic.</p></item>
</ulist>

<p>In fact, when the type is an atomic type, typed-value is always the
atomic-value constructed from the string-value and the type.</p>

<p>In the general case, <function>typed-value</function> constructs a
sequence of atomic values. These values are derived from the
string-value of the element and its type, in such a way as to be
consistent with validation.
</p>

</div3>

<div3 id="AttributeNodePSVI2DM">
<head>PSVI to Data Model Mapping</head>

<p>When a data model fragment is created from the PSVI an
<emph role="info-item">attribute information item</emph> is mapped
to an Attribute Node. The precise transformation is described
by specifying the PSVI property corresponding to each property of an
attribute node.</p>

<glist>
<gitem>
<label>&dm.prop.node-name;</label>
<def>
<p>An <code>xs:QName</code> constructed from the
<emph role="infoset-property">local name</emph> property
and the
<emph role="infoset-property">namespace name</emph> property</p>
</def>
</gitem>

<gitem>
  <label>&dm.prop.string-value;</label>
  <def>
  <ulist>
  <item><p>The <emph role="infoset-property">schema normalized value</emph>
PSVI property if that exists, or
  </p></item>
  <item><p>the <emph role="infoset-property">normalized value</emph> property.
  </p></item>
  </ulist>
  </def>
</gitem>

<gitem>
  <label>&dm.prop.parent;</label>
  <def>
    <p>The value of the <emph role="infoset-property">parent</emph> property.</p>
  </def>
</gitem>

<gitem>
  <label>&dm.prop.type;</label>
  <def><p>The <code>xs:QName</code> computed as described in
<specref ref="PSVI2Types"/>.
Note that if the type referenced would be a union type then
type refers to the member type that actually validated the
schema normalized value.</p>
  </def>
</gitem>
</glist>
</div3>

<div3 id="AttributeNodeDM2IS">
  <head>Data Model to Infoset Mapping</head>

<p>The mapping of the data model to the XML Information Set maps an
Attribute Node to an <emph role="info-item">attribute information item</emph>.
The properties of the corresponding
<emph role="info-item">attribute information item</emph> are constructed
as follows:
</p>

<table border="1" cellspacing="0" summary="PSVI mapping summary">
  <colgroup>
    <col width="35%"/>
    <col width="65%"/>
  </colgroup>
  <thead>
    <tr>
      <td>Property</td>
      <td>Value:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><emph role="infoset-property">namespace name</emph></td>
      <td>The namespace name of the xs:QName returned by the <function>node-name</function> accessor</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">local name</emph></td>
      <td>The local name of the xs:QName returned by the <function>node-name</function> accessor</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">prefix</emph></td>
      <td>An appropriate namespace prefix, as described below</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">normalized value</emph></td>
      <td>The value returned by the <function>string-value</function> accessor</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">owner element</emph></td>
      <td>The information item constructed from the node returned by the
<function>parent</function> accessor. If the node has no parent, the property
must be left absent and the resulting Infoset will not be valid.</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">specified</emph></td>
      <td rowspan="3">The values of these properties are implementation-defined but
must be consistent with the rest of Infoset constructed.</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">attribute type</emph></td>
    </tr>
    <tr>
      <td><emph role="infoset-property">references</emph></td>
    </tr>
  </tbody>
</table>

<p>An implementation must construct
the value of the
<emph role="infoset-property">prefix</emph> property in the following 
way: if
the attribute has a parent, in the same way that a prefix would be
constructed for that element, otherwise a non-empty prefix is chosen arbitrarily, and no
attempt is made to associate the prefix with the namespace URI.</p>

</div3>

</div2>

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

<div3 id="NamespaceNodeOverview">
  <head>Overview</head>

  <p>Namespace nodes encapsulate XML namespaces. Namespaces have the
following properties:</p>

<ulist>
<item><p>&dm.prop.prefix;, possibly empty.
</p></item>
<item><p>&dm.prop.uri;
</p></item>
<item><p>&dm.prop.parent;, possibly empty
</p></item>
</ulist>

<p>Namespace nodes must satisfy the following constraints.</p>

<olist>
<item><p>Every namespace node must have a unique identity, distinct from all other nodes.
</p></item>
<item><p>The namespace prefix may be the empty sequence. If the URI is the
zero-length string, the prefix must be the empty sequence.</p>
</item>
</olist>

<p>In XPath 1.0, namespace nodes were directly accessible by applications, by
means of the namespace axis. In XPath 2.0 the namespace axis is deprecated,
and it is not available at all in XQuery 1.0. XPath 2.0 implementations are
not required to expose the namespace axis, though they may do so if they
wish to offer backwards compatibility. The information held in namespace
nodes is instead made available to applications using two functions defined
in <bibref ref="XFO"/>, namely <code>fn:get-in-scope-namespaces</code> and
<code>fn:get-namespace-uri-for-prefix</code>. Certain properties of namespace nodes are
not exposed by these functions: in particular, properties related to the
identity of namespace nodes, their parentage, and their position in document
order. Implementations that do not expose the namespace axis can therefore
avoid the overhead of maintaining this information.</p>

</div3>

<div3 id="NamespaceNodeAccessors">
  <head>Accessors</head>

<table border="1" cellspacing="0" summary="Accessor summary">
  <thead>
    <tr>
      <td>Accessor</td>
      <td>Returns:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><function>base-uri</function></td>
      <td>&namespace.node.base-uri.returns;</td>
    </tr>
    <tr>
      <td><function>node-kind</function></td>
      <td>&namespace.node.node-kind.returns;</td>
    </tr>
    <tr>
      <td><function>node-name</function></td>
      <td>&namespace.node.node-name.returns;</td>
    </tr>
    <tr>
      <td><function>parent</function></td>
      <td>&namespace.node.parent.returns;</td>
    </tr>
    <tr>
      <td><function>string-value</function></td>
      <td>&namespace.node.string-value.returns;</td>
    </tr>
    <tr>
      <td><function>typed-value</function></td>
      <td>&namespace.node.typed-value.returns;</td>
    </tr>
    <tr>
      <td><function>type</function></td>
      <td>&namespace.node.type.returns;</td>
    </tr>
    <tr>
      <td><function>children</function></td>
      <td>&namespace.node.children.returns;</td>
    </tr>
    <tr>
      <td><function>attributes</function></td>
      <td>&namespace.node.attributes.returns;</td>
    </tr>
    <tr>
      <td><function>namespaces</function></td>
      <td>&namespace.node.namespaces.returns;</td>
    </tr>
    <tr>
      <td><function>nilled</function></td>
      <td>&namespace.node.nilled.returns;</td>
    </tr>
  </tbody>
</table>
</div3>

<div3 id="NamespaceNodePSVI2DM">
  <head>PSVI to Data Model Mapping</head>

<p>When a data model fragment is created from the PSVI a
<emph role="info-item">namespace information item</emph> is mapped
to a Namespace Node. The precise transformation is described
by specifying the PSVI property corresponding to each property of a
namespace node.</p>

<glist>
<gitem>
  <label>&dm.prop.prefix;</label>
  <def>
    <p>The <emph role="infoset-property">prefix</emph> property.</p>
  </def>
</gitem>
<gitem>
  <label>&dm.prop.uri;</label>
  <def>
    <p>The <emph role="infoset-property">namespace name</emph> property.</p>
  </def>
</gitem>
</glist>
</div3>

<div3 id="NamespaceNodeDM2IS">
  <head>Data Model to Infoset Mapping</head>

<p>The mapping of the data model to the XML Information Set maps a
Namespace Node to a <emph role="info-item">namespace information item</emph>.
The properties of the <emph role="info-item">namespace information item</emph>
are constructed as follows:</p>

<table border="1" cellspacing="0" summary="PSVI mapping summary">
  <colgroup>
    <col width="35%"/>
    <col width="65%"/>
  </colgroup>
  <thead>
    <tr>
      <td>Property</td>
      <td>Value:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><emph role="infoset-property">prefix</emph></td>
      <td>An appropriate namespace prefix, as described below</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">namespace name</emph></td>
      <td>The value returned by the <function>string-value</function> accessor</td>
    </tr>
  </tbody>
</table>

</div3>

</div2>

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

<div3 id="ProcessingInstructionNodeOverview">
<head>Overview</head>

<p>Processing instruction nodes encapsulate XML processing instructions.
Processing instructions have the following properties:</p>

<ulist>
<item><p>&dm.prop.target;
</p></item>
<item><p>&dm.prop.content;
</p></item>
<item><p>&dm.prop.base-uri;, possibly empty
</p></item>
<item><p>&dm.prop.parent;, possibly empty
</p></item>
</ulist>

<p>Namespace nodes must satisfy the following constraints.</p>

<olist>
<item><p>Every processing instruction node must have a unique
identity, distinct from all other nodes.</p>
</item>
<item><p>The &dm.prop.target; must be an <code>NCName</code>.
</p>
</item>
<item><p>The string <quote>?&gt;</quote> must not occur within the
&dm.prop.target; or
&dm.prop.content;.</p>
</item>
</olist>

</div3>

<div3 id="ProcessingInstructionNodeAccessors">
  <head>Accessors</head>

<table border="1" cellspacing="0" summary="Accessor summary">
  <thead>
    <tr>
      <td>Accessor</td>
      <td>Returns:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><function>base-uri</function></td>
      <td>&pi.node.base-uri.returns;</td>
    </tr>
    <tr>
      <td><function>node-kind</function></td>
      <td>&pi.node.node-kind.returns;</td>
    </tr>
    <tr>
      <td><function>node-name</function></td>
      <td>&pi.node.node-name.returns;</td>
    </tr>
    <tr>
      <td><function>parent</function></td>
      <td>&pi.node.parent.returns;</td>
    </tr>
    <tr>
      <td><function>string-value</function></td>
      <td>&pi.node.string-value.returns;</td>
    </tr>
    <tr>
      <td><function>typed-value</function></td>
      <td>&pi.node.typed-value.returns;</td>
    </tr>
    <tr>
      <td><function>type</function></td>
      <td>&pi.node.type.returns;</td>
    </tr>
    <tr>
      <td><function>children</function></td>
      <td>&pi.node.children.returns;</td>
    </tr>
    <tr>
      <td><function>attributes</function></td>
      <td>&pi.node.attributes.returns;</td>
    </tr>
    <tr>
      <td><function>namespaces</function></td>
      <td>&pi.node.namespaces.returns;</td>
    </tr>
    <tr>
      <td><function>nilled</function></td>
      <td>&pi.node.nilled.returns;</td>
    </tr>
  </tbody>
</table>
</div3>

<div3 id="ProcessingInstructionNodePSVI2DM">
  <head>PSVI to Data Model Mapping</head>

<p>When a data model fragment is created from the PSVI, a
<emph role="info-item">processing instruction information item</emph>
is mapped to a Processing Instruction Node. The precise transformation is described
by specifying the PSVI property corresponding to each property of a
processing instruction node.</p>

<glist>
<gitem>
  <label>&dm.prop.target;</label>
  <def>
    <p>The value of the <emph role="infoset-property">target</emph> property.</p>
  </def>
</gitem>
<gitem>
  <label>&dm.prop.content;</label>
  <def>
    <p>The value of the <emph role="infoset-property">content</emph> property.</p>
  </def>
</gitem>
<gitem>
  <label>&dm.prop.base-uri;</label>
  <def>
    <p>The value of the <emph role="infoset-property">base URI</emph> property.</p>
  </def>
</gitem>
<gitem>
  <label>&dm.prop.parent;</label>
  <def>
    <p>The value of the <emph role="infoset-property">parent</emph> property.</p>
  </def>
</gitem>
</glist>

<p>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>
</div3>


<div3 id="ProcessingInstructionNodeDM2IS">
  <head>Data Model to Infoset Mapping</head>

<p>The mapping of the data model to the XML Information Set maps a
Processing Instruction Node to a
<emph role="info-item">processing instruction information item</emph>.
The properties of the <emph role="info-item">processing instruction
information item</emph> are constructed as follows:</p>

<table border="1" cellspacing="0" summary="PSVI mapping summary">
  <colgroup>
    <col width="35%"/>
    <col width="65%"/>
  </colgroup>
  <thead>
    <tr>
      <td>Property</td>
      <td>Value:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><emph role="infoset-property">target</emph></td>
      <td>The local name of the xs:QName returned by the <function>node-name</function>
accessor</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">content</emph></td>
      <td>The value of the <function>string-value</function> accessor</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">parent</emph></td>
      <td>The value of the <function>parent</function> accessor.</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">notation</emph></td>
      <td>This property has no value.</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">base URI</emph></td>
      <td>The value of the <function>base-uri</function> accessor</td>
    </tr>
  </tbody>
</table>

</div3>
</div2>

<div2 id="CommentNode">
  <head>Comments</head>

<div3 id="CommentNodeOverview">
<head>Overview</head>

<p>Comment nodes encapsulate XML comments. Comments have the following properties:
</p>

<ulist>
<item><p>&dm.prop.content;
</p></item>
<item><p>&dm.prop.parent;
</p></item>
</ulist>

<p>Comment nodes must satisfy the following constraints.</p>

<olist>
<item><p>Every comment node must have a unique
identity, distinct from all other nodes.</p>
</item>
<item><p>The string <quote>--</quote> must not occur within the
&dm.prop.content;.</p>
</item>
</olist>
</div3>

<div3 id="CommentNodeAccessors">
  <head>Accessors</head>

<table border="1" cellspacing="0" summary="Accessor summary">
  <thead>
    <tr>
      <td>Accessor</td>
      <td>Returns:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><function>base-uri</function></td>
      <td>&comment.node.base-uri.returns;</td>
    </tr>
    <tr>
      <td><function>node-kind</function></td>
      <td>&comment.node.node-kind.returns;</td>
    </tr>
    <tr>
      <td><function>node-name</function></td>
      <td>&comment.node.node-name.returns;</td>
    </tr>
    <tr>
      <td><function>parent</function></td>
      <td>&comment.node.parent.returns;</td>
    </tr>
    <tr>
      <td><function>string-value</function></td>
      <td>&comment.node.string-value.returns;</td>
    </tr>
    <tr>
      <td><function>typed-value</function></td>
      <td>&comment.node.typed-value.returns;</td>
    </tr>
    <tr>
      <td><function>type</function></td>
      <td>&comment.node.type.returns;</td>
    </tr>
    <tr>
      <td><function>children</function></td>
      <td>&comment.node.children.returns;</td>
    </tr>
    <tr>
      <td><function>attributes</function></td>
      <td>&comment.node.attributes.returns;</td>
    </tr>
    <tr>
      <td><function>namespaces</function></td>
      <td>&comment.node.namespaces.returns;</td>
    </tr>
    <tr>
      <td><function>nilled</function></td>
      <td>&comment.node.nilled.returns;</td>
    </tr>
  </tbody>
</table>
</div3>

<div3 id="CommentNodePSVI2DM">
  <head>PSVI to Data Model Mapping</head>

<p>When a data model fragment is created from the PSVI a
<emph role="info-item">comment information item</emph> is mapped
to a Comment Node. The precise transformation is described
by specifying the PSVI property corresponding to each property of a
comment node.</p>

<glist>
<gitem>
  <label>&dm.prop.content;</label>
  <def>
    <p>The value of the <emph role="infoset-property">content</emph> property.</p>
  </def>
</gitem>

<gitem>
<label>&dm.prop.parent;</label>
<def>
<p>The value of the <emph role="infoset-property">parent</emph> property.</p>
</def>
</gitem>
</glist>

<p>There are no comment nodes for comments that are children of a
<emph role="info-item">document type declaration information item</emph>.</p>
</div3>


<div3 id="CommentNodeDM2IS">
  <head>Data Model to Infoset Mapping</head>

<p>The mapping of the data model to the XML Information Set maps a
Comment Node to a <emph role="info-item">comment information item</emph>.
The properties of the corresponding
<emph role="info-item">comment information item</emph> are constructed
as follows:
</p>

<table border="1" cellspacing="0" summary="PSVI mapping summary">
  <colgroup>
    <col width="35%"/>
    <col width="65%"/>
  </colgroup>
  <thead>
    <tr>
      <td>Property</td>
      <td>Value:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><emph role="infoset-property">content</emph></td>
      <td>The value of the <function>string-value</function> accessor</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">parent</emph></td>
      <td>The value of the <function>parent</function> accessor</td>
    </tr>
  </tbody>
</table>

</div3>

</div2>

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

<div3 id="TextNodeOverview">
  <head>Overview</head>

<p>Text nodes encapsulate XML character content. Text has the following properties:
</p>

  <ulist>
  <item><p>&dm.prop.content;
  </p></item>
  <item><p>&dm.prop.parent;
  </p></item>
  </ulist>

  <p>Text nodes must satisfy the following constraint:</p>
  <olist>
  <item><p>A text node cannot contain the empty string as its content.
  </p></item>
  </olist>

<p>In addition, document and element nodes impose the constraint that
two consecutive text nodes can never occur as adjacent siblings.</p>

</div3>

<div3 id="TextNodeAccessors">
  <head>Accessors</head>

<table border="1" cellspacing="0" summary="Accessor summary">
  <thead>
    <tr>
      <td>Accessor</td>
      <td>Returns:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><function>base-uri</function></td>
      <td>&text.node.base-uri.returns;</td>
    </tr>
    <tr>
      <td><function>node-kind</function></td>
      <td>&text.node.node-kind.returns;</td>
    </tr>
    <tr>
      <td><function>node-name</function></td>
      <td>&text.node.node-name.returns;</td>
    </tr>
    <tr>
      <td><function>parent</function></td>
      <td>&text.node.parent.returns;</td>
    </tr>
    <tr>
      <td><function>string-value</function></td>
      <td>&text.node.string-value.returns;</td>
    </tr>
    <tr>
      <td><function>typed-value</function></td>
      <td>&text.node.typed-value.returns;</td>
    </tr>
    <tr>
      <td><function>type</function></td>
      <td>&text.node.type.returns;</td>
    </tr>
    <tr>
      <td><function>children</function></td>
      <td>&text.node.children.returns;</td>
    </tr>
    <tr>
      <td><function>attributes</function></td>
      <td>&text.node.attributes.returns;</td>
    </tr>
    <tr>
      <td><function>namespaces</function></td>
      <td>&text.node.namespaces.returns;</td>
    </tr>
    <tr>
      <td><function>nilled</function></td>
      <td>&text.node.nilled.returns;</td>
    </tr>
  </tbody>
</table>
</div3>

<div3 id="TextNodePSVI2DM">
  <head>PSVI to Data Model Mapping</head>

<p>When a data model fragment is created from the PSVI a maximal sequence of
consecutive <emph role="info-item">character information
items</emph> are mapped to a Text Node. The precise transformation is described
by specifying the PSVI property corresponding to each property of a
text node.</p>

<glist>
<gitem>
  <label>&dm.prop.content;</label>
  <def>
  <p>A string comprised of characters that correspond to the
<emph role="infoset-property">character code</emph> properties of
each of the <emph role="info-item">character information items</emph>.
</p>
  </def>
</gitem>

<gitem>
<label>&dm.prop.parent;</label>
<def>
<p>The value of the <emph role="infoset-property">parent</emph> property.</p>
</def>
</gitem>
</glist>

<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.</p></note>
</div3>

<div3 id="TextNodeDM2IS">
  <head>Data Model to Infoset Mapping</head>

<p>The mapping of the data model to the XML Information Set maps a
Text Node to a sequence of <emph role="info-item">character information item</emph>s.
The properties of the corresponding
<emph role="info-item">character information item</emph>s are constructed
as follows:
</p>

<table border="1" cellspacing="0" summary="PSVI mapping summary">
  <colgroup>
    <col width="35%"/>
    <col width="65%"/>
  </colgroup>
  <thead>
    <tr>
      <td>Property</td>
      <td>Value:</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><emph role="infoset-property">character code</emph></td>
      <td>The ISO 10646 character code of the character in question</td>
    </tr>
    <tr>
      <td><emph role="infoset-property">element content whitespace</emph></td>
      <td><code>false</code></td>
    </tr>
    <tr>
      <td><emph role="infoset-property">parent</emph></td>
      <td>The value of the <function>parent</function> accessor.</td>
    </tr>
  </tbody>
</table>
</div3>

</div2>
</div1>


<div1 id="AtomicValue">
  <head>Atomic Values</head>

<p><termdef id="dt-atomic-value" term="atomic value">An
<term>atomic value</term> is a value in the value space
of an <termref def="dt-atomic-type">atomic type</termref> labeled with that
atomic type.</termdef> The typed value of nodes whose type is unknown
(for instance because they have not been validated)
are labeled with the type <code>xs:anySimpleType</code>.
<termdef id="dt-atomic-type" term="atomic type">An <term>atomic type</term>
is a primitive simple type or a type derived by restriction from a primitive
simple type. Types derived by list or union are not atomic.</termdef></p>

<p>The primitive simple types are those defined by XML Schema
<bibref ref="xmlschema-2"/>:
<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>, and
<emph>xs:NOTATION</emph>.
A derived atomic type is derived by restriction and has a primitive
base type and a set of constraining facets.</p>

<p>The value space of the atomic values is the union of the value
spaces of the nineteen primitive XML Schema types. This value space
clearly includes those atomic values whose type is primitive, but it
also includes those whose type is derived, as derivation by
restriction always limits the value space.
</p>

<p>An XML Schema simple type <bibref ref="xmlschema-2"/> may be
<emph>primitive</emph> or <emph>derived</emph> by <emph>restriction</emph>,
<emph>list</emph>, or <emph>union</emph>.</p>

<ulist>
<item><p>The values of nodes whose type is an XML Schema primitive simple type
or is derived by <emph>restriction</emph> from an XML Schema primitive simple type are
represented as atomic values of that type.</p>
</item>
<item><p>The values of nodes whose type is derived by <emph>list</emph> from
an XML Schema primitive simple type
(or from a type derived by <emph>restriction</emph> from an XML Schema primitive
simple type)
are represented by a sequence of atomic values
whose type is the item type.
</p></item>
<item><p>The values of nodes whose type is derived by <emph>union</emph> from
an XML Schema primitive type are represented by a sequence of atomic values
each of
whose type is one of the individual types from the union. The union type information
is lost and only the specific types of each individual item is retained.
</p></item>
</ulist>

<p>An atomic value can be constructed from the value's lexical
representation. Given a string and an atomic type, the atomic value is
constructed in such a way as to be consistent with validation. In
particular the construction takes into consideration the facets of the
type. If the string does not represent a valid value of the type, an
error is raised. When <code>xs:anySimpleType</code> is specified as the type, no
validation takes place. The details of the construction are described
in the <quote>Constructor Functions</quote> and the related
<quote>Casting Functions</quote> section of <bibref ref="XFO"/>.
</p>

<p>A string value can be constructed from an atomic value.
Such a value is constructed by
converting the atomic value to its string representation as described
in the <quote>Casting Functions</quote> section of <bibref ref="XFO"/>.
Using the canonical lexical representation for atomic values
may not always be compatible with XPath 1.0.</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 an atomic value, i.e.
a sequence may contain nodes, atomic values, or any mixture of
nodes and atomic values.
When a node is added to a sequence its identity remains the same.
Consequently a node may occur in more than one sequence
and a sequence may contain duplicate items.
Sequences are <quote>flat</quote>, they may not contain other sequences.</p>

<p>An important characteristic of the data model is that there is no
distinction between an item (a node or an atomic value) and a
singleton sequence containing that item. 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>

<p>A collection of documents is represented in the data model as a
sequence of document nodes.</p>

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

</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 a data model fragment:</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">type definition</emph>,
    <emph role="infoset-property">type definition namespace</emph>,
    <emph role="infoset-property">type definition name</emph>,
    <emph role="infoset-property">type definition anonymous</emph>,
    <emph role="infoset-property">member type definition</emph>,
    <emph role="infoset-property">member type definition namespace</emph>,
    <emph role="infoset-property">member type definition name</emph>,
    <emph role="infoset-property">member type definition anonymous</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">validity</emph>,
    <emph role="infoset-property">type definition</emph>,
    <emph role="infoset-property">type definition namespace</emph>,
    <emph role="infoset-property">type definition name</emph>,
    <emph role="infoset-property">type definition anonymous</emph>,
    <emph role="infoset-property">member type definition</emph>,
    <emph role="infoset-property">member type definition namespace</emph>,
    <emph role="infoset-property">member type definition name</emph>,
    <emph role="infoset-property">member type definition anonymous</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>

<div2>
<head>Normative 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-names" key="Namespaces in XML">
  World Wide Web Consortium,
  <emph>Namespaces in XML</emph>
  See <loc href="http://www.w3.org/TR/REC-xml-names/">http://www.w3.org/TR/REC-xml-names</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/xpath-functions/">http://www.w3.org/TR/xpath-functions/</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>
</div2>

<div2>
<head>Other 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 key="XPath 1.0" 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 key="XPath 2.0" id="XPath2">
  World-Wide Web Consortium
  <emph>XML Path Language (XPath)</emph>: Version 2.0.
  See <loc href="http://www.w3.org/TR/xpath20/">http://www.w3.org/TR/xpath20/</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="XQFS" key="XQuery 1.0 Formal Semantics">
  World Wide Web Consortium,
  <emph>XQuery 1.0 and XPath 2.0 Formal Semantics</emph>.
  See <loc href="http://www.w3.org/TR/xquery-semantics/">http://www.w3.org/TR/xquery-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/Query">http://www.w3.org/XML/Query</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>.
g  See <loc href="http://www.w3.org/TR/2003/WD-xquery-requirements-20030502">http://www.w3.org/TR/2003/WD-xquery-requirements-20030502</loc>.
</bibl>

</blist>
</div2>
</div1>

<inform-div1 id="glossary">
<head>Glossary</head>
<?glossary?>
</inform-div1>

<inform-div1 id="example">
  <head>Example</head>

  <p>We use the following XML document to illustrate the information
  contained in a data model fragment:</p>

<eg>&dm-example.xml;</eg>

<p>The document is associated with the URI
<quote>http://www.example.com/catalog.xml</quote>,
and is valid with respect to the following XML schema:</p>

<eg>&dm-example.xsd;</eg>

<p>This example exposes the data model for a document that has an associated
schema and has been validated successfully against it.
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 nodes described below.
The value <emph>D1</emph> represents a document node;
the values <emph>E1, E2, etc.</emph> represent element nodes;
the values <emph>A1, A2, etc.</emph> represent attribute nodes;
the values <emph>N1, N2, etc.</emph> represent namespace nodes;
the values <emph>P1, P2, etc.</emph> represent processing-instruction nodes;
the values <emph>T1, T2, etc.</emph> represent text nodes.</p>

<p>For brevity:</p>

<ulist>
<item><p>The data model doesn't include whitespace-only text nodes.</p>
</item>
<item><p>Literal strings are shown without the <code>xs:string()</code>
constructor
</p></item>
<item><p>Literal decimals are shown without the <code>xs:decimal()</code>
constructor
</p></item>
<item><p>Nodes are referred to using the syntax <code>[nodeID]</code>
</p></item>
<item><p>xs:QNames are used with the following prefixes:</p>

<table border="0" summary="Namespace prefixes">
<tbody>
  <tr>
    <td>xs</td><td>http://www.w3.org/2001/XMLSchema</td>
  </tr>
  <tr>
    <td>xsi</td><td>http://www.w3.org/2001/XMLSchema-instance</td>
  </tr>
  <tr>
    <td>cat</td><td>http://www.example.com/catalog</td>
  </tr>
  <tr>
    <td>xlink</td><td>http://www.w3.org/1999/xlink</td>
  </tr>
  <tr>
    <td>html</td><td>http://www.w3.org/1999/xhtml</td>
  </tr>
</tbody>
</table>

</item>
<item><p>The abbreviation <quote><code>\n</code></quote> is used in string literals
to represent a newline character; this isn't supported in XPath, but it makes
this presentation clearer.</p></item>
<item><p>Accessors that return the empty sequence have been omitted.</p>
</item>
</ulist>

&dm-example.tbl;

<p>A graphical representation of the data model for the preceding
example is shown below. Document order in this representation can be
found by following the traditional in-order, left-to-right,
depth-first traversal; however, because the image has been rotated for
easier presentation, this appears to be in-order, bottom-to-top,
depth-first order.</p>

<table border="0" cellspacing="0" summary="Graphic">
  <tbody>
    <tr>
      <td><graphic source="dm-example.png"
                   alt="Graphical depiction of the example data model."/>
      </td>
    </tr>
    <tr>
      <td>Graphic representation of the data model.
[<loc href="dm-example-large.png">large view</loc>]
      </td>
    </tr>
  </tbody>
</table>

</inform-div1>

<inform-div1 id="issues-list">
  <head>Issues List</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.</p>

  <p>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>

  <p>Starting with the November 2002 publication, only issues that are
still open are displayed. All of the issues are still available in the
XML sources for this document.</p>

  <p>As of 26 Mar 2003, there are <emph>no</emph> open issues in this document.
In the future, issues relating to the Data Model will be compiled outside this
document.</p>

<issue id="Issue-0001" date="Oct-2000" raisedby="Datamodel Editors" status="closed">
  <head>PSV Infoset identity constraints</head>
    <p>What should be data-model representation, if any, of PSV Infoset
    identity-constraint tables?</p>
  <resolution date="2001-08-17">
    <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>
    <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>
  <resolution date="2001-01-15"><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>
    <p><emph>Remark Michael:</emph> An IDREF cannot point to an empty
    string.</p>
  <resolution date="2001-08-17">
    <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" status="closed">
  <head>Schema/DTD</head>
    <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>
    <p>Any strategy developed must also address the issue of types
derived from xs:ID.</p>
  <resolution date="2003-02-24">
    <p>Infoset-only processing is performed if and only if schema processing was not.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0117.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0117.html</loc>
    </p>
  </resolution>
</issue>

<issue id="Issue-0005"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
  <head>Lists of Simple Values</head>
    <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>
  <resolution date="2001-10-30">
    <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>
    <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>
  <resolution date="2001-01-15"><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>
    <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>
  <resolution date="2001-10-30">
    <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>
    <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>
  <resolution date="2001-01-15">
    <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" status="closed">
  <head>Schema info</head>
    <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>
  <resolution date="2002-03-26">
    <p>MN: This was an alternate design to the named typing proposal.
    With the acceptance of the named typing this isssue is closed.
    When using a different schemata over the same XML fragment (by
    invoking validate, see <bibref ref="XQFS"/>) a new instance is
    constructed and there is no need for postprocessing.</p>
  </resolution>
</issue>

<issue id="Issue-0010"  date="Oct-2000" raisedby="Datamodel Editors" status="closed">
  <head>Node identity</head>
    <p>Should the data model require that an implementation guarantee
    that the identity of a node is always preserved?</p>
  <resolution date="2001-01-15">
    <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" status="closed">
  <head>Access to facets</head>
    <p>In XML Schema, facets such as "nullable" is associated with
    an <emph>element declaration</emph>, which is an 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>
  <resolution date="2002-03-26">
    <p>MN: The data model represents named types as expanded-QNames.
    This way it supports type-related operations, but the semantics of such
    operations and the information that must be available to support them
    (e.g. facets) is described in the <bibref ref="XQFS"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0012"  date="Oct-2000" raisedby="Michael Rys" status="closed">
  <head>Representation of reference values</head>
    <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>
  <resolution date="2001-08-13">
    <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>
    <p>Equality operators '=' on collections are not defined.</p>
  <resolution date="2001-03-27">
    <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>
    <p>Should the element constructor
    <loc href="#element-node">element-node</loc> also permit bags of
    children?</p>
  <resolution date="2001-04-13">
    <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>
    <p>The semantics of the value equality operator '=' are undefined.</p>
  <resolution date="2001-08-17">
    <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>
    <p><code>Code</code> is undefined. </p>
  <resolution date="2001-04-25">
    <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>
    <p>The relationship between ordered and unordered collections is
    not specified.  Any ordered collection can be treated as an
    unordered collection.</p>
  <resolution date="2001-04-25">
    <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>
    <p>How are IDREF lists and NMTOKEN lists represented in
    data model.</p>
  <resolution date="2001-08-17">
    <p>JM: Duplicate of <specref ref="Issue-0005"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0019" date="15-Mar-2001" raisedby="James Clark" status="closed">
<head>Element constructor that performs schema processing</head>
  <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-atomic-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="#dt-atomic-value">SchemaComponent</loc>)
               -> <loc href="#ElementNode">ElementNode</loc> | <loc href="#AttributeNode">AttributeNode</loc>
  </p>
  <resolution date="2002-07-19">
    <p>MN: The working groups decided not to pursue this alternate design.
    It is noted though that using the current constructors with the type
    set to either xs:anyType or to a more specific type makes them similar
    to either the first or the second function proposed here.</p>
  </resolution>
</issue>

<issue id="Issue-0020" date="27-Mar-2001" raisedby="Michael Kay" status="closed">
  <head>Semantics of <code>copy</code></head>
    <p>Deep copy on a node is defined only informally. For example,
    does deep copy preserve base URI?</p>
  <resolution date="2001-08-17">
    <p>JM: Obsolete - copy function removed (not used).</p>
  </resolution>
</issue>

<issue id="Issue-0021" date="27-Mar-2001" raisedby="XPath 2.0 Task Force" status="closed">
  <head>Declared vs. In-scope namespaces</head>
    <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>
  <resolution date="2001-08-17">
    <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)" status="closed">
  <head>Abstraction of Run-time type information</head>
    <p>The representation of run-time type information is very
    concrete&mdash;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>
  <resolution date="2002-03-26">
    <p>MN: The data model currently represents named types in a more
    abstract manner, as expanded-QNames.</p>
  </resolution>
</issue>

<issue id="Issue-0023" date="27-Mar-2001" raisedby="XPath 2.0 Task Force" status='closed'>
  <head>Support for document repositories</head>
    <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>
   <resolution date="2003-01-09">
    <p>NW: We now have fn:collection(), fn:input(), and fn:document() functions.
Ashok and I believe that these functions satisfy the requirements
raised by this issue.</p>
   </resolution>
</issue>

<issue id="Issue-0024" date="27-Mar-2001" raisedby="Michael Sperberg-McQueen" status='closed'>
  <head>Support for Schema-invalid documents</head>
    <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>
  <resolution date="2001-03-05">
    <p>The data model answers the above issue in the following way:
    Section 3.3 specifically states that the data model supports
    incompletely validated documents.
    Section 3.4 (formerly 8.1) describes a function used in the
    pseudo-code segments that maps the elements with the different
    [validity] properties to the appropriate types.
    The mapping is inline with the solution suggested by the issue
    above.
    For further details see the
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Mar/0029.html">discussion thread</loc>
    and
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Mar/0011.html">decision record</loc>
    (members only).
    </p>
  </resolution>
</issue>

<issue id="Issue-0025" date="27-Apr-2001" raisedby="Mike Kay" status='closed'>
  <head>Types of Sequences</head>
    <p>Should sequence values carry their type as do
    simple typed values and element and attribute nodes?</p>
   <resolution date="2003-01-09">
   <p>NW: Given that sequences are heterogenous, the editors feel that this issue
no longer makes any sense.</p>
   </resolution>
</issue>

<issue id="Issue-0026" date="27-Apr-2001" raisedby="Mary Fernandez" status="closed">
  <head>Schema Component Values vs. Nodes</head>
    <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>
  <resolution date="2002-03-26">
    <p>MN: The data model represents named types as expanded-QNames.
    They can be associated with element nodes, attribute nodes and
    atomic values. Consequently the question raised by the issue no
    longer applies.</p>
  </resolution>
</issue>

<issue id="Issue-0027" date="01-May-2001" raisedby="Mary Fernandez" status="closed">
  <head>Lexical representation of simple-typed values</head>
    <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>
  <resolution date="2001-12-05">
    <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" status="closed">
  <head>Whitespace handling</head>
    <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>
  <resolution date="2002-10-18">
   <p>Closed. <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html</loc>.</p>
</resolution>
</issue>

<issue id="Issue-0029" date="04-May-2001" raisedby="Jonathan Marsh" status="closed">
  <head>Use of Reference Nodes</head>
    <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>
  <resolution date="2001-08-13">
    <p>Removed Reference Nodes.</p>
  </resolution>
</issue>

<issue id="Issue-0030" date="04-May-2001" raisedby="Jonathan Marsh" status="closed">
  <head>Base URI is a property of element nodes</head>
    <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>
  <resolution date="2002-10-18">
   <p>Closed. <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html</loc>.</p>
  </resolution>
</issue>

<issue id="Issue-0031" date="17-May-2001" raisedby="Ashok Malhotra" status="closed">
  <head>Schema component does not reveal [content] property</head>
    <p>Schema component does not reveal [content] property of XML Schema:
   Formal Description 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 XML Schema: Formal Description).  </p>
  <resolution date="2002-03-26">
    <p>MN: The data model represents named types as expanded-QNames.
    This way it supports type-related operations, but the semantics of such
    operations and the information that must be available to support them
    (e.g. [content] property) is described in the <bibref ref="XQFS"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0032" date="17-May-2001" raisedby="Query" status="closed">
  <head>Keys and key references not represented</head>
    <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>
  <resolution date="2002-10-18">
    <p>Not in V1. <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html</loc>.</p>
  </resolution>
</issue>

<issue id="Issue-0033" date="28-April-2001" raisedby="James Clark" status="closed">
  <head>Unclear relationship between values passed to the constructor,
  and those returned by the accessor</head>
    <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>
  <resolution date="2003-02-26">
    <p>Overtaken by events; constructors have been removed.</p>
  </resolution>
</issue>

<issue id="Issue-0034" date="8-May-2001" raisedby="Michael Kay" status="closed">
  <head>Interaction of insignificant whitespace with comments</head>
    <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>
  <resolution date="2002-09-17">
    <p>NW: insignificant whitespace is orthogonal to PIs and comments.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Sep/0043.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Sep/0043.html</loc></p>
  </resolution>
</issue>

<issue id="Issue-0035" date="8-May-2001" raisedby="XSL WG (Michael Kay)" status="closed">
  <head>Eliminate heterogeneous sequences</head>
    <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>
  <resolution date="2002-10-30">
    <p>Heterogeneous sequences are here to stay.</p>
  </resolution>
</issue>

<issue id="Issue-0036" date="19-July-2001" raisedby="XSL WG" status="closed">
  <head>Support for abstract types</head>
    <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>
  <resolution date="2002-07-25">
    <p>MN: The data model now supports xs:anySimpleType and xs:anyType.
    The typed-value() of elements or attributes of this type is the
    string-value() as xs:anySimpleType.
    The semantics of the operations on atomic values of type xs:anySimpleType
    is defined in <bibref ref="XQuery"/> and  <bibref ref="XPath2"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0037" date="19-July-2001" raisedby="XSL WG" status="closed">
  <head>Axis functions</head>
    <p>Define (somewhere other than the data model document?)
    axis functions for non-primitive axes like descendants-or-self.</p>
  <resolution date="2003-01-09">
   <p>NW: This issue seems out of place in the DM document. Closed
with no action.</p>
  </resolution>
</issue>

<issue id="Issue-0038" date="13-August-2001" raisedby="Datamodel Editors" status="closed">
  <head>XPath 1.0 treatment of non-unique IDs</head>
    <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>
  <resolution date="2003-02-26">
    <p>Overtaken by events; the unique-ID() accessor no longer exists.
This is no longer a data model issue.</p>
  </resolution>
</issue>

<issue id="Issue-0039" date="13-August-2001" raisedby="Datamodel Editors" status="closed">
  <head>Parent of namespace nodes</head>
    <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>
    <resolution date="2002-10-18">
      <p>Closed by Mike Kay's
      <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-wg/2002Oct/0101.html">namespace proposal</loc></p>
    </resolution>
</issue>

<issue id="Issue-0040" date="15-August-2001" raisedby="Jim Melton" status="closed">
  <head>Setting and examining construction flags</head>
    <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>
  <resolution date="2003-02-24">
    <p>Overtake by events.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0251.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0251.html</loc>
    </p>
  </resolution>
</issue>

<issue id="Issue-0041" date="15-August-2001" raisedby="Jonathan Marsh" status="closed">
  <head>Document node permissiveness unnecessary</head>
    <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>
  <resolution date="2002-04-04">
    <p>MN: The working groups decided to keep the document node permissiveness
    to support "well-balanced" trees.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Apr/0021.html">decision record</loc> (members only).</p>
  </resolution>
</issue>

<issue id="Issue-0042" date="15-August-2001" raisedby="Jim Melton" status="closed">
  <head>System Id and Public Id are not exposed</head>
    <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>
  <resolution date="2003-02-26">
    <p>The WGs decided not to add this functionality.</p>
  </resolution>
</issue>

<issue id="Issue-0043" date="15-August-2001" raisedby="Jonathan Marsh" status="closed">
  <head>Treatment of common accessors inconsistent</head>
    <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>
  <resolution date="2001-10-30">
    <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" status="closed">
  <head>Unable to construct an element with unique ID</head>
    <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 an 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>
  <resolution date="2003-02-24">
    <p>Overtaken by events.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0253.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0253.html</loc>
    </p>
  </resolution>
</issue>

<issue id="Issue-0045" date="2001-08-17" raisedby="Jim Melton" status="closed">
  <head>Text nodes are not W3C-normalized text</head>
    <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>
  <resolution date="2003-02-26">
    <p>The bottom line is that a well-formed document
can contain unnormalized text, and therefore our data model can also contain
unnormalized text. If normalization happens, it's not done by the data
model.</p>
  </resolution>
</issue>

<issue id="Issue-0046" date="2001-08-17" raisedby="Jim Melton" status="closed">
  <head>Value of derived types?</head>
    <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>
  <resolution date="2001-12-05">
    <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="2001-08-17" raisedby="Jim Melton" status="closed">
  <head>Should errors be allowed in sequences?</head>
    <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>
  <resolution date="2002-07-22">
    <p>MN: The error value has been removed from the data model.
    This issue is now mute.</p>
  </resolution>
</issue>

<issue id="Issue-0048" date="2001-08-17" raisedby="Jim Melton" status="closed">
  <head>Imprecise behavior of errors</head>
    <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>
  <resolution date="2002-07-22">
    <p>MN: The error value has been removed from the data model.
    The error behavior is described in <bibref ref="XPath2"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0049" date="2001-08-17" raisedby="James Clark" status="closed">
  <head>Alternative design of schema components</head>
    <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>
  <resolution date="2002-03-26">
    <p>MN: This proposal is not in the scope of the data model:
    The data model represents named types as expanded-QNames.
    The semantics of the type operations and the information that must be
    available to support them is described in the <bibref ref="XQFS"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0050" date="2001-08-17" raisedby="Jim Melton" status="closed">
  <head>Relative order of free-floating nodes</head>
    <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"&mdash;
    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>
   <resolution date="2003-01-22">
    <p>The relative order of free-floating nodes is implementation-dependent but stable.
    </p>
   </resolution>
</issue>

<issue id="Issue-0051" date="28-August-2001" raisedby="Michael Kay" status="closed">
  <head>Document order of shared namespace nodes</head>
    <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>
    <resolution date="2002-10-14">
      <p>Closed by Mike Kay's
      <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-wg/2002Oct/0101.html">namespace proposal</loc></p>
    </resolution>
</issue>

<issue id="Issue-0052" date="28-August-2001" raisedby="Michael Kay" status="closed">
  <head>Element constructor copies nodes?</head>
    <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>
  <resolution date="2003-02-26">
    <p>Overtaken by events; constructors have been removed.</p>
  </resolution>
</issue>

<issue id="Issue-0053" date="28-August-2001" raisedby="Michael Kay" status="closed">
  <head>Semantics of head and tail on empty sequences</head>
    <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>
  <resolution date="2001-11-18">
    <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" status="closed">
  <head>Complex types with simple content</head>
    <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>
  <resolution date="2001-02-19">
    <p>Now typed-value corresponds to the
    <emph role="infoset-property">schema normalized value</emph>
    PSVI property if that exists, or the empty sequence otherwise.
    This way if an element has a complex type with simple content
    its typed-value may be something other than the empty sequence.
    For further details see the
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Feb/0100.html">discussion thread</loc>
    and
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Feb/0191.html">decision record</loc>
    (members only).
    </p>
  </resolution>
</issue>

<issue id="Issue-0055" date="6-September-2001" raisedby="XSL WG" status="closed">
  <head>Effect of xsi:nil</head>
    <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>
  <resolution date="2002-12-07">
    <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" status="closed">
  <head>Lightweight Schema Components</head>
    <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>
  <resolution date="2002-03-26">
    <p>MN: The data model represents named types as expanded-QNames,
    which is inline with the suggestion of the issue.</p>
  </resolution>
</issue>

<issue id="Issue-0057" date="25-September-2001" raisedby="Michael Kay" status="closed">
  <head>Support for XSLT whitespace stripping</head>
    <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>
  <resolution date="2002-09-17">
    <p>NW: this functionality does not need to be supported in the data model.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Sep/0071.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Sep/0071.html</loc></p>
  </resolution>
</issue>

<issue id="Issue-0058" date="25-September-2001" raisedby="Michael Kay" status="closed">
  <head>Node constructors formalism of questionable value</head>
    <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>
  <resolution date="2003-02-26">
    <p>Overtaken by events; constructors have been removed.</p>
  </resolution>
</issue>

<issue id="Issue-0059" date="25-September-2001" raisedby="Michael Kay" status='closed'>
  <head>Pseudo-formalism provides no value</head>
    <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>
  <resolution date="2001-01-09">
    <p>NW: The psuedo-formalism has largely been removed. Closed
with no action ("overtaken by events")</p>
  </resolution>
</issue>

<issue id="Issue-0060" date="25-September-2001" raisedby="Michael Kay" status="closed">
  <head>Sharing namespace nodes</head>
    <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>
    <resolution date="2002-10-18">
      <p>Closed by Mike Kay's
      <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-wg/2002Oct/0101.html">namespace proposal</loc></p>
    </resolution>
</issue>

<issue id="Issue-0061" date="25-September-2001" raisedby="Michael Kay" status="closed">
  <head>No access to prefix on free-floating attributes</head>
    <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>
    <resolution date="2002-10-18">
      <p>Closed by Mike Kay's
      <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-wg/2002Oct/0101.html">namespace proposal</loc></p>
    </resolution>
</issue>

<issue id="Issue-0062" date="16-October-2001" raisedby="Michael Kay" status="closed">
  <head>Namespace fixups required</head>
    <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>
    <resolution date="2002-10-18">
      <p>Closed by Mike Kay's
      <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-wg/2002Oct/0101.html">namespace proposal</loc></p>
    </resolution>
</issue>

<issue id="Issue-0063" date="16-October-2001" raisedby="Michael Kay" status="closed">
  <head>Is prefix preserved?</head>
    <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>
  <resolution date="2003-03-03">
  <p>No, but you can get back a reasonable prefix from the namespace nodes.</p>
<p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html</loc></p>
  </resolution>
</issue>

<issue id="Issue-0064" date="16-October-2001" raisedby="Jeni Tennison" status="closed">
  <head>Including type definition in element constructors</head>
    <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.
    Should the same be done for attribute node constructors for
    consistency, (even though attributes cannot have xsi:type attributes)?
    <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>
  <resolution date="2002-03-26">
    <p>MN: The definition of the element an attribute constructors have
    been changed to take an xs:QName that represents the type definition
    and not the element or attribute declaration.
    The type definition can be either the [type definition] of the
    element information item or the more specific [type definition] of
    the [element declaration] when xsi:type is used.</p>
  </resolution>
</issue>

<issue id="Issue-0065" date="19-November-2001" raisedby="Mary Fernandez" status="closed">
  <head>Proposal for alternative constructor</head>
    <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>
  <resolution date="2001-12-05">
    <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" status="closed">
  <head>SchemaComponent support for substitutions groups</head>
    <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>
  <resolution date="2002-03-26">
    <p>MN: The data model represents named types as expanded-QNames.
    This way it supports type-related operations, but the semantics of such
    operations and the information that must be available to support them
    (e.g. substitution groups) is described in the <bibref ref="XQFS"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0067" date="5-December-2001" raisedby="Marton Nagy" status="closed">
  <head>Align function call syntax</head>
    <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>
  <resolution date="2002-03-26">
    <p>MN: The pseudo-calls and examples now use the XQuery syntax.</p>
  </resolution>
</issue>

<issue id="Issue-0068" date="4-December-2001" raisedby="XPath Task Force" status="closed">
  <head>Retaining the type of a sequence of heterogeneous simple typed values.</head>
    <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>
  <resolution date="2002-07-22">
    <p>MN: As a result of the adoption of Alternative 1 for element/attribute
    constructors, the data model no longer provides constructors accepting
    a sequence of atomic values as arguments. The current constructors
    can only create instances whose type can be described by XML Schema.
    </p>
  </resolution>
</issue>

<issue id="Issue-0069" date="4-December-2001" raisedby="XPath Task Force" status="closed">
  <head>Canonical form for derived types.</head>
    <p>Should derived types have a canonical form? Should we ask XML Schema
    to fix this?</p>
  <resolution date="2003-03-03">
   <p>When you derive, you restrict its value space. The canonical form maps from
the value space to a lexical form. Hence the canonical form is the mapping from
the restricted value space to the lexical form.</p>
   <p>Note, however, that if the derived type is restricted with a pattern,
the resulting lexical form may not validate.</p>
<p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html</loc></p>
  </resolution>
</issue>

<issue id="Issue-0070" date="5-December-2001" raisedby="XPath Task Force" status="closed">
  <head>Should the name accessor return "" or ()?</head>
    <p>Should the name accessor return "" or () for nodes that have no name?</p>
  <resolution date="2002-10-14">
    <p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-wg/2002Oct/0071.html">Returns ().</loc></p>
  </resolution>
</issue>

<issue id="Issue-0071" date="7-December-2001" raisedby="Michael Rys" status="closed">
  <head>Magic Attributes</head>
    <p>Should the following attributes be represented in
       the data model? xmlns attributes, xml:lang, xml:space,
       xsi:nil (etc). If so, how?
    </p>
  <resolution date="2002-10-18">
    <p>Namespace declarations do not appear in the attributes property. All of
the other attributes <emph>except</emph> <att>xsi:nil</att> do.</p>
    <p>As of Dec 2002, <att>xsi:nil</att> also appears in the attribute list.
It is a normal attribute. In valid documents, it has the side-effect of setting
the nilled property.</p>
  </resolution>
</issue>

<issue id="Issue-0072" date="13-January-2002" raisedby="Jeni Tennison" status="closed">
  <head>Lexical representation of Schema primitive types</head>
    <p>Unfortunately the XML Schema Datatypes Rec doesn't detail the
       canonical lexical representation of all of the primitive types. In
       particular, no canonical lexical representation is specified for:</p>
       <olist>
       <item><p>
       xs:string, xs:base64Binary, xs:anyURI (but that's OK, I think we
       can guess)
       </p></item>
       <item><p>
       xs:duration - presumably the lexical representation contains all
       components of the duration (years, months, days, hours, minutes
       and seconds, even those that occur 0 times? Or are these omitted?
       In the latter case, what's the canonical lexical representation of
       PT0S? Since the number of seconds can be a decimal, is this
       decimal represented with a decimal point (i.e. using the canonical
       lexical representation for xs:decimal)?
       </p></item>
       <item><p>
       xs:date - what happens to the timezone component? Presumably,
       unlike xs:dateTime and xs:time, this isn't normalized to Z?
       (And similarly for xs:gYearMonth, xs:gYear, xs:gMonthDay,
       xs:Month, and xs:Day)
       </p></item>
       <item><p>
       xs:QName and xs:NOTATION - these are the trickiest (their value
       spaces are the same). The XML Schema Rec states that the lexical
       representation of a QName depends on the in-scope namespaces.
       Does this mean the ones in the query/stylesheet or the ones from the
       source document? What if there's more than one namespace
       declaration for the namespace URI? What if there aren't any?
       </p></item>
       </olist>
       <p><loc href="http://lists.w3.org/Archives/Public/www-xml-query-comments/2002Jan/0268.html">http://lists.w3.org/Archives/Public/www-xml-query-comments/2002Jan/0268.html</loc>
    </p>
    <resolution date="2003-03-24">
      <p>Closed. Use the casting tables in F&amp;O:
for xs:string, whatever the user put in;
for xs:anyURI, whatever the user put in after whitespace handling;
for xs:base64Binary, Schema says what to do (Schema 1.0 errata);
for xs:duration, use what's in F&amp;O casting table;
for xs:date, with timezone has one form;
for xs:date w/o timezone serialize without;
for xs:QName, use casting table;
for xs:NOTATION, not on the table (you can't build one);
for xs:boolean = true/false.
</p>
<p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html</loc></p>
    </resolution>

</issue>

<issue id="Issue-0073" date="13-January-2002" raisedby="Jeni Tennison" status="closed">
  <head>Whitespace normalization of the string-value of elements with simple content</head>
    <p>Currently the data model says that the string value of an attribute node
       is normalized (according to the whitespace facet of its type); on
       the other hand, the string value of an element node is not normalized.
       The string value of elements with simple content should also
       be normalized in the same way as the string value of attributes.
       <loc href="http://lists.w3.org/Archives/Public/www-xml-query-comments/2002Jan/0269.html">http://lists.w3.org/Archives/Public/www-xml-query-comments/2002Jan/0269.html</loc>
    </p>
  <resolution date="2002-07-25">
    <p>MN: The mapping from the PSVI to the data model has been updated
    to use the <emph role="infoset-property">schema normalized value</emph>
    PSVI property (if exists) in the case of both attributes or elements.
    </p>
  </resolution>
</issue>

<issue id="Issue-0074" date="12-February-2002" raisedby="Michael Rys" status="closed">
  <head>Do we need Document fragments</head>
    <p>Currently the Document node in the data model is permissive in the
       number of element nodes it can directly contain whereas the infoset
       only allows a single element node.
       Since preserving the single element node constraint is important to
       enforce queries to generate only well-formed documents when generating
       documents, the question is whether the data model needs to introduce a
       docfragment node that is permissive and keep the document node to be
       non-permissive. See
       <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Feb/0111.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Feb/0111.html</loc> (members only).
    </p>
  <resolution date="2003-02-24">
    <p>The constraints on document nodes have been relaxed, so fragments would be
redundant.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0256.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0256.html</loc>
    </p>
  </resolution>
</issue>

<issue id="Issue-0075" date="26-June-2002" raisedby="Michael Kay" status="closed">
  <head>Support for unparsed entities</head>
    <p>
XSL WG has a requirement to access unparsed entities in a document. This is
needed to support the XSLT 1.0 unparsed-entity-uri() function, and the
unparsed-entity-public-id() function which we are adding for XSLT 2.0.

In XSLT 1.0, unparsed entities were not described in the XPath data model,
but in an XSLT addition to the data model. This solution is unsatisfactory:
the data model should describe all the information that is available. The
information is available in the Infoset so there is no architectural problem
in providing it. There is room for debate about how it is best provided (we
don't really want another node type if we can help it), but the information
should be there.

We are not proposing, at this stage, that the functions
unparsed-entity-uri() and unparsed-entity-public-id() be moved from XSLT
into XPath, though that can easily be done if people want them. The
information about unparsed entities in the data model would therefore not be
available to XQuery users or to XPath users outside an XSLT environment.
    </p>
  <resolution date="2002-10-18">
   <p>Closed: added data model accessors.
<loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html</loc></p>
  </resolution>
</issue>

<issue id="Issue-0076" date="29-July-2002" raisedby="Marton Nagy" status="closed">
  <head>PSVI to Type mapping supporting derived types</head>
    <p>
    The last bullet in the definition of the PSVI to Type mapping does
    not handle derived types properly. In those cases we should not bottom
    out at xs:anyType, but attempt to use the rules all over again
    with the type from which the current type is derived.
    Also note that these rules need to be slightly different if we decide
    to use generated type identifiers when no type names are available.
    </p>
  <resolution date="2003-02-24">
    <p>The PSVI to Type Mapping has been extensively reworked since this
issue was raised. I believe it is no longer an issue and the name
of (globally declared) derived types are now properly represented
in the data model.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0257.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0257.html</loc>
    </p>
  </resolution>
</issue>

<issue id="Issue-0077" date="29-July-2002" raisedby="XPath Task Force" status="closed">
  <head>PSVI to Type mapping dependence on conformance levels</head>
    <p>
    The rules specifying the computation of the types from the PSVI
    do not yet reflect that this process depends on the conformance
    level of the processor.
    For Basic, are any type annotations preserved? The Query/XPath
    book says the data types are mapped to the nearest supertype,
    the Data Model needs to agree with this.
    </p>
    <resolution date="2002-03-21">
      <p>Close with no changes. Possibly may require changes to data model to implement
processing model conformance level changes.</p>
<p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html</loc></p>
    </resolution>
</issue>

<issue id="Issue-0078" date="31-July-2002" raisedby="Michael Kay" status="closed">
  <head>Data model does not represent CDATA sections</head>
    <p>
    It is not clear how the current data model can represent or
    accomodate CDATA sections. (This is also captured as Issue 0293 on
    the XPath issue list.)
    </p>
    <resolution date="2002-10-18">
      <p>Subsumed by query issue #293. <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html</loc>.</p>
    </resolution>
</issue>

<issue id="Issue-0079" date="31-July-2002" raisedby="Marton Nagy" status="closed">
  <head>String-value vs. string-value of the typed-value</head>
    <p>
    Note that the current definition of <function>string-value($n)</function> is such that
    it may differ from <function>string-value(dm:typed-value($n))</function> for some
    element or attribute nodes $n.  For instance given a node
    <function>element-node(my:a,(),(),dm:text-node("01"),xs:integer)</function>,
    its string-value gives "01", but the string-value of the typed-value is "1".
    </p>
    <p> The possible resolutions are that we (a) prohibit, (b) allow or (c)
    mandate <function>string-value($n)</function> to be <function>string-value(dm:typed-value($n))</function>.
    The current text reflects (a). Option (b) would result in non-interoperable
    implementations. Option (c) is promising. In that case the element
    constructor would need to be a little smart and change the textnode to
    contain the string value of <function>atomic-value-sequence</function> applied to the
    string-value of the original text node and the type passed to the
    constructor. Similar change would need to be done to the attribute
    constructor.
    </p>
    <resolution date="2003-03-24">
      <p>Further clarification of typed-value() and string-value() have been made in the document.
It is not a goal to make string-value() be the same as string-value(typed-value()).
Nor is it a goal to make them different.
Jan 31, Mary, 097-02, xsl-query</p>
<p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html</loc></p>
    </resolution>
</issue>

<issue id="Issue-0080" date="1-August-2002" raisedby="Mary Fernandez" status="closed">
  <head>Typed value of Document, PI and Comment nodes</head>
    <p>
    There is currently an asymmetry between the data model and the
    F&amp;O documents.
    In the data model, the typed-value accessor on document,
    comment, PI nodes returns the empty sequence.
    In the F&amp;O document, the data() function applied to
    a document, namespace, comment or processing instruction
    node, raises an  error.
    </p>
    <p>
    My intuition is that data() should be defined on all
    nodes, just as string-value() is defined.  Raising
    an error on document, comment, PI, seems draconian
    and has tripped me up in writing queries that iterate
    over a variety of nodes.  If data() returns error on
    such nodes, one ends up with a lot of code checking
    what kind of node is bound to a variable, etc.
    </p>
    <resolution date="2003-01-17">
    <p>Made consistent with F&amp;O.</p>
    </resolution>
</issue>

<issue id="Issue-0081" date="10-Sep-2002" raisedby="Editors" status="closed">
  <head>Schema-less documents with a DTD</head>
    <p>If a document has a DTD, do we really have to lose the IDness of
all ID attributes and other information that's available from DTD validation?</p>
  <resolution date="2003-02-24">
    <p>See Issue-0004.
    </p>
  </resolution>
</issue>

<issue id="Issue-0082" date="17-Aug-2002" raisedby="Jeni Tennison" status="closed">
  <head>Identifying element/attribute type</head>
  <p>Note that currently the last bullet point cannot be reached from a
legal PSVI because every element in a PSVI must have one of the
combinations of properties listed. Elements whose type definition is
<emph>anonymous</emph> still have a [type definition] property, it's just that
the type definition's [name] is absent (the property exists, I
think, but it has no value). Under the scheme above, such elements
would have type whose namespace was the target namespace of the schema
and whose name was nothing.
  <loc href="http://lists.w3.org/Archives/Public/public-qt-comments/2002Aug/0018.html">http://lists.w3.org/Archives/Public/public-qt-comments/2002Aug/0018.html</loc></p>
  <resolution date="2003-02-24">
    <p>The PSVI to type mapping now takes the existence
of the [name] into consideration.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0261.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0261.html</loc>
    </p>
  </resolution>
</issue>

<issue id="Issue-0083" date="17-Aug-2002" raisedby="Jeni Tennison" status="closed">
  <head>Distinction between {name} and [name]</head>
  <p>I'm not sure what distinction you're making between [name] and
 {name}. As I understand it in the XML Schema spec, {name} is a
 property on a schema component while [name] is a property on an
 information item in the PSVI. Since you're talking about properties in
 the PSVI, I believe you should be using the notation [name] rather
 than {name}.
  <loc href="http://lists.w3.org/Archives/Public/public-qt-comments/2002Aug/0018.html">http://lists.w3.org/Archives/Public/public-qt-comments/2002Aug/0018.html</loc></p>
  <resolution date="2003-02-26">
    <p>This editorial issue has been resolved.</p>
  </resolution>
</issue>

<issue id="Issue-0084" date="26-Sep-2002" raisedby="Norman Walsh" status="closed">
  <head>How are unparsed entities represented?</head>
  <p>Suppose I have an attribute that has the type xs:ENTITY and the value "foo".
 How can I find out the public and system identifiers of the external unparsed
 entity "foo"?</p> 
  <resolution date="2002-10-29">
    <p>Duplicate of <specref ref="Issue-0075"/>.</p>
  </resolution>
</issue>

<issue id="Issue-0085" date="2002-10-23" raisedby="Norman Walsh" status="closed">
  <head>Globally declared namespaces in the infoset</head>
  <p>There is an open issue about how to map namespaces declared globally in the
query prolog during the data model to infoset transformation.</p>
  <p>This issue replaces an editorial note in the previous draft that said there
was an issue.</p>
  <resolution date="2003-02-26">
    <p>Since constructors have been removed, this is now simply a matter of setting
up the data model correctly.</p>
  </resolution>
</issue>

<issue id="Issue-0086" date="2002-10-17" raisedby="Jonathan Marsh" status="closed">
  <head>Nodes returned by <function>namespaces</function> and <function>attributes</function></head>
  <p>Does the constraint that the same set of nodes is returned restrict the
possibilities for implementation?  Should this constraint be relaxed?</p>
  <p>For instance, an XML 1.0 store such as a DOM stores namespace
information as attributes, and has no mechanism for undeclaring
arbitrary namespaces.  If a series of constructor functions are called
to construct a data model instance that has fewer namespaces on children
then on a parent element, the store will be unable to represent this,
and might return extra namespace nodes.  I claim (without proof :-) that
these extra namespace nodes are harmless, and constraining
implementations in this way is a burden.</p>
  <resolution date="2003-02-26">
    <p>Overtaken by events; constructors have been removed so the constraint no longer
exists.</p>
  </resolution>
</issue>

<issue id="Issue-0087" date="2002-10-29" raisedby="Norman Walsh" status='closed'>
  <head><function>base-uri</function> should return ()?</head>
  <p>Calling <function>base-uri</function> on a node that has no (transitive)
base URI property raises an error. Would it be better to return ()?</p>
  <p>See <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Oct/att-0275/01-2002-10-16-pres.html</loc>.</p>
  <resolution date="2003-01-09">
   <p>NW: The empty sequence is a better and more consistent answer than an error.</p>
  </resolution>
</issue>

<issue id="Issue-0088" date="2002-10-30" raisedby="Norman Walsh" status="closed">
  <head>Content type is not preserved</head>
  <p>Calculating the value of <emph role="infoset-property">element content whitespace</emph> requires knowing the element's content type which doesn't seem to be available.</p>
  <resolution date="2003-02-26">
    <p>The <emph role="infoset-property">element content whitespace</emph> property
of an infoset constructed from the data model is always false.</p>
  </resolution>
</issue>

<issue id="Issue-0089" date="2002-11-01" raisedby="Norman Walsh" status="closed">
  <head>How is typed-value calculated?</head>
  <p>I don't think the spec is clear enough on how typed-value is calculated.
I think the following proposal would work, but perhaps I'm wrong or perhaps
we've already got another proposal somewhere else.</p>
<ulist>
<item><p>If the element has a
<emph role="infoset-property">schema normalized value</emph> property:</p>
<ulist>
<item><p>() if the property is <quote>absent</quote></p></item>
<item><p>Otherwise the result of casting the
<emph role="infoset-property">schema normalized value</emph> to the
appropriate type (the element type or its content type).</p>
</item>
</ulist>
</item>
<item><p>Otherwise ().</p>
</item>
</ulist>
  <resolution date="2003-01-23"><p>NW: AM provided new text for the typed-value
accessor for the 17 Jan draft.</p></resolution>
</issue>

<issue id="Issue-0090" date="2002-11-04" raisedby="Michael Kay" status="closed">
  <head>Documents can be empty</head>
  <p>I notice that there's a requirement that a document node has at least one
child. This seems to have been in previous drafts, but I overlooked it. In
XSLT it's legal to create a document node with no children.</p>
  <p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-wg/2002Nov/0005.html">http://lists.w3.org/Archives/Member/w3c-xsl-wg/2002Nov/0005.html</loc></p>
  <resolution date="2003-02-24">
    <p>Constraint removed.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0260.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0260.html</loc>
    </p>
  </resolution>
</issue>

<issue id="Issue-0091" date="2002-11-01" raisedby="Jeni Tennison" status="closed">
  <head>Support for substitution groups</head>
  <p>I suggest that we add a dm:substitution-groups() accessor to the
data model that returns a sequence of xs:QNames derived from the
{substitution group affiliations} of the [element declaration]
reported for the element and use this list to work out whether an
element "has been validated and found to be a member of a
substitution group whose head element has the required name" rather
than guessing on the basis of the element's name (and type).</p>
<p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Nov/0007.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2002Nov/0007.html</loc>.</p>
<resolution date="2003-03-26">
<p>Return the element declaration and schema context in 
element-declaration()</p>
<p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html</loc></p>
</resolution>
</issue>

<issue id="Issue-0092" date="2003-01-15" raisedby="Norman Walsh" status="closed">
  <head>Anonymous type names must be expanded QNames?</head>
  <p>Does the DM have to return QNames for anonymous types, or is it sufficient
to return any{Simple}Type when the underlying type is anonymous. Or should the
closest non-anonymous supertype be returned? What does the Formal Semantics
need? (MFF has action to investigate from the 21 Jan 2003 XPath TF telcon.)</p>
  <resolution date="2003-02-24">
    <p>Reworded.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0435.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0435.html</loc>
    </p>
  </resolution>
</issue>

<issue id="Issue-0093" date="2003-01-15" raisedby="Norman Walsh" status="closed">
  <head>dm:typed-value of complex types</head>
  <p>The F&amp;O document says fn:data() on nodes of complex type raises an
error. What should DM say?</p>
  <resolution date="2003-02-28">
    <p>Closed by TF revisions of F&amp;O and DM.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Feb/0274.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Feb/0274.html</loc>
    </p>
  </resolution>
</issue>

<issue id="Issue-0094" date="2003-01-15" raisedby="Norman Walsh" status="closed">
  <head>Namespaces 1.0 or 1.1?</head>
  <p>Are we building the document model on top of Namespaces 1.0 or 1.1?
In Namespaces 1.1, namespaces may be undeclared.</p>
    <resolution date="2002-03-21">
      <p>Closed with no action in the data model. Will be dealt with at the language level.</p>
<p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html</loc></p>
    </resolution>
</issue>

<issue id="Issue-0095" date="2003-01-22" raisedby="Norman Walsh" status="closed">
  <head>Expose validation in DM?</head>
  <p>At present, there's no way to tell from the DM what if any validation
was performed. Should it be possible to tell?</p>
  <resolution date="2003-02-24">
    <p>Not in this version.
    <loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0264.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Jan/0264.html</loc>
    </p>
  </resolution>
</issue>

<issue id="Issue-0096" date="2003-01-22" raisedby="Norman Walsh" status="closed">
  <head>Unparsed-entity-* in DM?</head>
  <p>There are accessors for unparsed-entity-public-id() and unparsed-entity-system-id(),
but there aren't actually any properties in the DM to suppor them. Nor is there
any description of how they're obtained from the Infoset. This is probably
editorial.</p>
  <resolution date="2003-02-26">
    <p>Overtaken by events; constructors have been removed so these are simply
properties of the data model.</p>
  </resolution>
</issue>

<issue id="Issue-0097" date="2003-01-29" raisedby="Norman Walsh" status="closed">
  <head>Type information for xsi:schemaLocation, xsi:type, etc.</head>
  <p>W3C XML Schema always allow xsi:schemaLocation, xsi:type, etc. What
are the types of those attributes in the data model?</p>
    <resolution date="2003-03-24">
      <p>They are handled correctly by schema. They will be normal
attributes in untyped documents.</p>
    </resolution>
</issue>

<issue id="Issue-0098" date="2003-02-18" raisedby="Don Chamberlin" status="closed">
  <head>Relationship between xs:anySimpleType and xdt:untypedAtomic</head>
  <p>We have taken it upon ourselves to invent a new type,
xdt:untypedAtomic, which never occurs in a PSVI. Having done this, it
becomes very important to specify clearly the relationship between
this type and xs:anySimpleType, which can occur in a PSVI.</p>
    <resolution date="2003-03-26">
      <p>Closed with following change:
    Modify data model so that well-formed documents are aligned with
    XML Schema skip validation, i.e., attribute nodes from well-formed
    documents are annotated with xs:anySimpleType.</p>
<p><loc href="http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html">http://lists.w3.org/Archives/Member/w3c-xsl-query/2003Mar/0013.html</loc></p>
</resolution>
</issue>

</inform-div1>

</back>
</spec>
