<?xml version='1.0'?>
<!-- Id: datatypes.xml,v 1.7.2.48 2004/07/15 08:25:54 ht Exp  -->
<?xml-stylesheet type='text/xsl' href='xmlschema_nodiffs.xsl'?>
<!DOCTYPE spec SYSTEM "local.dtd" [
<!ENTITY suffix "">
]>
<spec w3c-doctype="wd" status="ext-review">
<header>
<title>XML Schema 1.1 Part 2: Datatypes</title>
    <w3c-designation>wd-20040716</w3c-designation>
   <w3c-doctype>W3C Working Draft</w3c-doctype>
    <pubdate>
      <day>16</day>
      <month>July</month>
      <year>2004</year><!--  Id: datatypes.xml,v 1.7.2.48 2004/07/15 08:25:54 ht Exp  -->
    </pubdate>
<publoc> <loc href="http://www.w3.org/TR/2004/WD-xmlschema11-2-20040716/">http://www.w3.org/TR/2004/WD-xmlschema11-2-20040716/</loc> </publoc>
   <altlocs>
    <loc href="http://www.w3.org/TR/2004/WD-xmlschema11-2-20040716/datatypes.xml">XML</loc>
    <loc href="http://www.w3.org/TR/2004/WD-xmlschema11-2-20040716/datatypes-with-errata.html">XHTML with visible change markup</loc>
    <loc href="http://www.w3.org/2001/XMLSchema.xsd">Independent copy of the schema for schema documents</loc>
    <loc href="http://www.w3.org/2001/XMLSchema-datatypes.xsd">A schema for built-in datatypes only, in a separate namespace</loc>
    <loc href="http://www.w3.org/2001/XMLSchema.dtd">Independent copy of the DTD for schema documents</loc>
   </altlocs>
   <latestloc><loc diff="del" href="http://www.w3.org/TR/xmlschema-2/">http://www.w3.org/TR/xmlschema-2/</loc><loc diff="add" href="http://www.w3.org/TR/xmlschema11-2/">http://www.w3.org/TR/xmlschema11-2/</loc></latestloc>
<prevlocs>
<!--* 
	<loc href="http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/">
		http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/
	</loc>
*-->
</prevlocs>
<authlist>
<author>
<name>David Peterson</name>
<affiliation>invited expert (SGML<emph>Works!</emph>)</affiliation>
<email href="mailto:davep@iit.edu">davep@iit.edu</email>
</author>
<author>
<name>Paul V. Biron</name>
<affiliation>Kaiser Permanente, for Health Level Seven</affiliation>
<email href="mailto:Paul.V.Biron@kp.org">Paul.V.Biron@kp.org</email>
</author>
<author>
<name>Ashok Malhotra</name>
<affiliation>invited expert (formerly of Microsoft)</affiliation>
<email href="mailto:ashokmalhotra@alum.mit.edu">ashokmalhotra@alum.mit.edu</email>
</author>
</authlist>
<status>
    <p><emph>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the <loc href="http://www.w3.org/TR/">W3C technical reports index</loc> at http://www.w3.org/TR/.</emph></p>
 <p diff="chg">This is the <xspecref
href="http://www.w3.org/2004/02/Process-20040205/tr.html#first-wd">First
Public Working Draft</xspecref> of XML Schema 1.1.  It is here made
available for review by W3C members and the public.  It is intended to
give an indication of the W3C XML Schema Working Group's intentions
for this new version of the XML Schema language.  It attempts to be
complete in indicating <emph>what</emph> will change from version 1.0,
but is <emph>not</emph> complete in terms of fully specifying
<emph>how</emph> things will change.</p>
 <p diff="add">For those primarily interested in the changes since version 1.0,
the <specref ref="changes"/> appendix, which summarizes both changes already
made and also those in prospect, with links to the relevant sections of this
draft, is the recommended starting point.</p>
 <p>Please send comments on this Working Draft to <loc href="mailto:www-xml-schema-comments@w3.org">www-xml-schema-comments@w3.org</loc> (<loc href="http://lists.w3.org/Archives/Public/www-xml-schema-comments/">archive</loc>).</p>
<p>Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p>

    <p>
    This document has been produced by the <loc href="http://www.w3.org/XML/Schema">W3C XML Schema Working Group</loc> as
    part of the W3C <loc href="http://www.w3.org/XML/Activity">XML Activity</loc>. The
    goals of the XML Schema language version 1.1 are discussed in the <loc href="http://www.w3.org/TR/2003/WD-xmlschema-11-req-20030121/">Requirements for XML Schema 1.1</loc> document. The authors of this document are the
    members of the XML Schema Working Group.  Different parts of this
    specification have different editors.
    </p>
 <p diff="chg">Patent disclosures relevant to this specification may be found
on the Working Group's <loc role="disclosure"
href="http://www.w3.org/2004/01/pp-impl/19482/status">Patent
disclosure page</loc> in conformance with the <loc
href="http://www.w3.org/Consortium/Patent-Policy-20040205/">W3C Patent
Policy</loc> of 5 February 2004.  An individual who has actual
knowledge of a patent which the individual believes contains Essential
Claim(s) with respect to this specification should disclose the
information in accordance with <loc
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
6 of the W3C Patent Policy</loc>.</p>
      
      <p diff="add">Per <loc
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Exclusion">section
4 of the W3C Patent Policy</loc>, Working Group participants have 150
days from the title page date of this document to exclude essential
claims from the W3C RF licensing requirements with respect to this
document series. Exclusions are with respect to the exclusion
reference document, defined by the <loc
href="http://www.w3.org/Consortium/Patent-Policy-20040205/">W3C Patent
Policy</loc> to be the latest
version of a document in this series that is published no later than
90 days after the title page date of this document.</p>
    <p>The English version of this specification is the only normative
    version. Information about translations of this document is available
    at <loc href="http://www.w3.org/2001/05/xmlschema-translations">http://www.w3.org/2001/05/xmlschema-translations</loc>.</p>
</status>
<abstract>
<p>
<emph>XML Schema: Datatypes</emph> is part 2 of the specification of the XML
Schema language. It defines facilities for defining datatypes to be used
in XML Schemas as well as other XML specifications.
The datatype language, which is itself represented in
XML<phrase diff="del"> 1.0</phrase>, provides a superset of the capabilities found in XML<phrase diff="del"> 1.0</phrase>
document type definitions (DTDs) for specifying datatypes on elements
and attributes.
<issue id="RQ-152i" role="1.1">
  <p><loc href="&reqs;#xml1.1" target="reqs">RQ-152 (xml1.1)</loc></p>
  <p>How should this specification be aligned with XML 1.1?  The changes in
character set and name characters, and the question of what determines which
ones to use, must be addressed.</p>
 </issue></p>
</abstract>
<langusage>
<language id="EN">English</language>
      <language id="ebnf">Extended Backus-Naur Form (formal grammar)</language>
</langusage>
<revisiondesc>
<slist><sitem/></slist>
</revisiondesc>
</header>
<body>


<div1 role="1.0" id="Intro">
<head>Introduction</head>

<issue id="RQ-21i" role="1.1">
<p><loc href="&reqs;#bnf" target="reqs">RQ-21 (regex/BNF for all primitive types)</loc></p>
<p>Current plan is that all datatypes defined herein will have EBNF productions at least approximately defining their lexical space,
and will include a nonnormative regex derived from the EBNF if a user wishes to copy it directly.</p>
</issue>

<issue id="RQ-24-2i" role="1.1">
<p><loc href="&reqs;#fundamentals" target="reqs">RQ-24 (systematic facets: canonical representations for all datatypes)</loc></p>
<p>It is not possible for all datatypes to have canonical representations of all values without violating the rules of derivation
or adding special-purpose &cfacet;s which the WG does not deem appropriate.&nbsp; The WG has not yet decided how to deal with
datatypes whose lexical and/or canonical mappings are context sensitive.</p>
</issue>

<issue id="RQ-148i" role="1.1">
<p><loc href="&reqs;#Truncation-not-defined" target="reqs">RQ-148 (clarify use of "truncation)</loc></p>
<p>The word will probably be removed.</p>
</issue>

<issue id="RQ-120i" role="1.1">
<p><loc href="&reqs;#term-derived" target="reqs">RQ-120 (consistent use of "derived)</loc></p>
<p>"Derivations" other than "derivations by restriction" will be renamed "constructions".</p>
</issue>



<issue id="RQ-24-4i" role="1.1">
<p><loc href="&reqs;#fundamentals" target="reqs">RQ-24 (systematic facets: assignment of datatype to nodes without components)</loc></p>
</issue>
    <div2 id="intro1.1" diff="add">
   <head>Introduction to Version 1.1</head>
     <p>The Working Group has two main goals for this version of W3C XML Schema:</p>
     <ulist>
<item><p>Significant improvements in simplicity of design and clarity of
   exposition <emph>without</emph> loss of backward <emph>or</emph> forward compatibility;

 </p></item>
<item><p>Provision of support for versioning of XML languages defined using
   the XML Schema specification, including the XML transfer syntax for
   schemas itself.</p></item>
</ulist>
<p>These goals are slightly in tension with one another -- the following
summarizes the Working Group's strategic guidelines for changes
between versions 1.0 and 1.1:</p>
<olist>
<item><p>Add support for versioning (acknowledging that this <emph>may</emph>
    be slightly disruptive to the XML transfer syntax at the margins)</p></item>
<item><p>Allow bug fixes (unless in specific cases we decide that the fix
    is too disruptive for a point release)</p></item>
<item><p>Allow editorial changes</p></item>
<item><p>Allow design cleanup to change behavior in edge cases</p></item>
<item><p>Allow relatively non-disruptive changes to type hierarchy (to
    better support current and forthcoming international standards and
W3C recommendations)</p></item>
<item><p>Allow design cleanup to change component structure (changes
    to functionality restricted to edge cases)</p></item>
<item><p>Do not allow any significant changes in functionality</p></item>
<item><p>Do not allow any changes to XML transfer syntax except those
    required by version control hooks and bug fixes</p></item>
</olist>
<p>The overall aim as regards compatibility is that</p>

<ulist>
<item><p>All schema documents conformant to version 1.0 of this
    specification should also conform to version 1.1, and should have
    the same validation behaviour across 1.0 and 1.1 implementations
    (except possibly in edge cases and in the details of the resulting
    PSVI);</p></item>
<item><p>The vast majority of schema documents conformant to version 1.1 of
    this specification should also conform to version 1.0, leaving
    aside any incompatibilities arising from support for versioning,
    and when they are conformant to version 1.0 (or are made
    conformant by the removal of versioning information), should have
    the same validation behaviour across 1.0 and 1.1 implementations
    (again except possibly in edge cases and in the details of the
    resulting PSVI);
 </p></item>
</ulist>
    </div2>
      <div2 role="1.0" id="purpose">
<head>Purpose</head>
<p>
The <bibref ref="XML"/> specification defines limited
facilities for applying datatypes to document content in that documents
may contain or refer to DTDs that assign types to elements and attributes.
However, document authors, including authors of traditional
<emph>documents</emph> and those transporting <emph>data</emph> in XML,
often require a higher degree of type checking to ensure robustness in
document understanding and data interchange.
</p>
<p>
The table below offers two typical examples of XML instances
in which datatypes are implicit: the instance on the left
represents a billing invoice, the instance on the
right a memo or perhaps an email message in XML.
</p>
<table class="dtdemo" border="1">
<thead>
<tr>
<th>Data oriented</th>
<th>Document oriented</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<eg><![CDATA[<invoice>
  <orderDate>1999-01-21</orderDate>
  <shipDate>1999-01-25</shipDate>
  <billingAddress>
   <name>Ashok Malhotra</name>
   <street>123 Microsoft Ave.</street>
   <city>Hawthorne</city>
   <state>NY</state>
   <zip>10532-0000</zip>
  </billingAddress>
  <voice>555-1234</voice>
  <fax>555-4321</fax>
</invoice>]]></eg>
</td>
<td>
<eg><![CDATA[<memo importance='high'
      date='1999-03-23'>
  <from>Paul V. Biron</from>
  <to>Ashok Malhotra</to>
  <subject>Latest draft</subject>
  <body>
    We need to discuss the latest
    draft <emph>immediately</emph>.
    Either email me at <email>
    mailto:paul.v.biron@kp.org</email>
    or call <phone>555-9876</phone>
  </body>
</memo>]]></eg>
</td>
</tr>
</tbody>
</table>
<p>
The invoice contains several dates and telephone numbers, the postal
abbreviation for a state
(which comes from an enumerated list of sanctioned values), and a ZIP code
(which takes a definable regular form).&nbsp; The memo contains many
of the same types of information: a date, telephone number, email address
and an "importance" value (from an enumerated
list, such as "low", "medium" or "high").&nbsp; Applications which process
invoices and memos need to raise exceptions if something that was
supposed to be a date or telephone number does not conform to the rules
for valid dates or telephone numbers.
</p>
<p>
In both cases, validity constraints exist on the content of the
instances that are not expressible in XML DTDs.&nbsp; The limited datatyping
facilities in XML have prevented validating XML processors from supplying
the rigorous type checking required in these situations.&nbsp; The result
has been that individual applications writers have had to implement type
checking in an ad hoc manner.&nbsp; This specification addresses
the need of both document authors and applications writers for a robust,
extensible datatype system for XML which could be incorporated into
XML processors.&nbsp; As discussed below, these datatypes could be used in other
XML-related standards as well.
</p>
</div2>
<div2 role="1.0" id="requirements">
<head>Requirements</head>
<p>
The <bibref ref="schema-requirements"/> document spells out
concrete requirements to be fulfilled by this specification,
which state that the XML Schema Language must:
</p>
<olist>
<item>
<p>
provide for primitive data typing, including byte, date,
integer, sequence, SQL and Java primitive datatypes, etc.;
</p>
</item>
<item>
<p>
define a type system that is adequate for import/export
from database systems (e.g., relational, object, OLAP);
</p>
</item>
<item>
<p>
distinguish requirements relating to lexical data representation
vs. those governing an underlying information set;
</p>
</item>
<item>
<p>
allow creation of user-defined datatypes, such as
datatypes that are derived from existing datatypes and which
may constrain certain of its properties (e.g., range,
precision, length, format).
</p>
</item>
</olist>
</div2>
<div2 role="1.0" id="scope">
<head>Scope</head>
<p>
This portion of the XML Schema Language discusses datatypes that can be
used in an XML Schema.&nbsp; These datatypes can be specified for element
content that would be specified as
<xspecref href="&xmlspec;#dt-chardata">#PCDATA</xspecref> and attribute
values of <xspecref href="&xmlspec;#sec-attribute-types">various
types </xspecref> in a DTD.&nbsp; It is the intention of this specification
that it be usable outside of the context of XML Schemas for a wide range
of other XML-related activities such as <bibref ref="XSL"/> and
<bibref ref="RDFSchema"/>.
</p>
</div2>
<div2 role="1.0" id="terminology">
<head>Terminology</head>
<p>
The terminology used to describe XML Schema Datatypes is defined in the
body of this specification. The terms defined in the following list are
used in building those definitions and in describing the actions of a
datatype processor:
</p>
<glist>
<gitem>
<label>
<termdef id="dt-compatibility" term="for compatibility">
for compatibility</termdef>
</label>
<def>
<p>
A feature of this specification included solely to ensure that schemas
which use this feature remain compatible with <bibref ref="XML"/>
</p>
</def>
</gitem>
<gitem>
<label>
<termdef id="dt-may" term="may"><term>may</term></termdef>
</label>
<def>
<p>
Conforming documents and processors are permitted to but need
not behave as described.
</p>
</def>
</gitem>
<gitem>
<label>
<termdef id="dt-match" term="match"><term>match</term></termdef>
</label>
<def>
<p>
(Of strings or names:) Two strings or names being compared must be
identical. Characters with multiple possible representations in ISO/IEC 10646 (e.g.
characters with both precomposed and base+diacritic forms) match only if they have
the same representation in both strings. No case folding is performed. (Of strings and
rules in the grammar:) A string matches a grammatical production if it belongs to the
language generated by that production.
</p>
</def>
</gitem>
<gitem>
<label>
 <termdef id="dt-must" term="must"><term>must</term></termdef>
</label>
<def>
<p>
Conforming documents and processors are required to behave as
described; otherwise they are in <termref def="dt-error">error</termref>.
</p>
</def>
</gitem>
<gitem>
<label>
<termdef id="dt-error" term="error"><term>error</term></termdef>
</label>
<def>
<p>
A violation of the rules of this specification; results are undefined.
Conforming software <termref def="dt-may"/> detect and report an
<term>error</term> and <termref def="dt-may"/> recover from it.
</p>
</def>
</gitem>
</glist>
</div2>

<div2 role="1.0" id="constraints-and-contributions">
<head>Constraints and Contributions</head>
<p>
This specification provides three different kinds of normative
statements about schema components, their representations in XML and
their contribution to the schema-validation of information items:
</p>
<glist>
<gitem>
<label>
<termdef id="dt-cos" term="Constraint on Schemas">
<term>Constraint on Schemas</term>
</termdef>
</label>
<def>
<p>
Constraints on the schema components themselves, i.e. conditions
components <termref def="dt-must"/> satisfy to be components at all.
Largely to be found in <specref ref="datatype-components"/>.
</p>
</def>
</gitem>
<gitem>
<label>
<termdef id="dt-src" term="Schema Representation Constraint">
<term>Schema Representation Constraint</term>
</termdef>
</label>
<def>
<p>
Constraints on the representation of schema components in XML.&nbsp; Some but
not all of these are expressed in <specref ref="schema"/> and
<specref ref="dtd-for-datatypeDefs"/>.
</p>
</def>
</gitem>
<gitem>
<label>
<termdef id="dt-cvc" term="Validation Rule">
<term>Validation Rule</term>
</termdef>
</label>
<def>
<p>
Constraints expressed by schema components which information
items <termref def="dt-must"/> satisfy to be schema-valid.&nbsp; Largely
to be found in <specref ref="datatype-components"/>.
</p>
</def>
</gitem>
</glist>
</div2>
</div1>

 <!-- ****************************** BEGIN NEW 1.1 MATERIAL (DATATYPES/FACETS) ********************************* -->

<div1 id="typesystem">
<head diff="add">Datatype System</head>

<!--ednote><edtext>I don't want to use the word <mention>type</mention> without some prefix or adjective.</edtext></ednote-->

<p>This section describes the conceptual framework behind the <phrase diff="add">data</phrase>type system
defined in this specification.&nbsp; The framework has been influenced by the
<bibref ref="ISO11404"/> standard on language-independent datatypes as
well as the datatypes for <bibref ref="SQL"/> and for programming
languages such as Java.</p>

<!--ednote><edtext>Our datatypes are <emph>not</emph> <unusual>computer representations</unusual>.&nbsp; Our value spaces are the
abstract concepts; appropriate computer representations are determined by the implementers.</edtext></ednote-->

<p>The datatypes discussed in this specification are <phrase diff="del">computer
representations of</phrase><phrase diff="add">for the most part</phrase> well known abstract concepts such as
<emph>integer</emph> and <emph>date</emph>. It is not the place of this
specification to <phrase diff="add">thoroughly </phrase>define these abstract concepts; many other publications
provide excellent definitions.<phrase diff="add">  However, this specification will attempt to
describe the abstract concepts well enough that they can be readily recognized
and distinguished from other abstractions with which they may be confused.</phrase></p>

<note diff="add">
<p>Only those operations and relations needed for schema processing are defined in this
specification. Applications using these datatypes are generally expected to implement
appropriate additional functions and/or relations to make the datatype generally
useful.&nbsp; For example, the description herein of the <dtref ref="float"/> datatype
does not define addition or multiplication, much less all of the operations defined for
that datatype in <bibref ref="ieee754"/> on which it is based.</p>
</note>

<div2 id="datatype">
<head>Datatype</head>
<p diff="del">
<termdef id="dt-datatype-delled" term="datatype">In this specification,
a <term>datatype</term> is a 3-tuple, consisting of
a) a set of distinct values, called its <termref def="dt-value-space"/>,
b) a set of lexical representations, called its
<termref def="dt-lexical-space"/>, and c) a set of <termref def="dt-facet"/>s
that characterize properties of the <termref def="dt-value-space"/>,
individual values or lexical items.
</termdef>
</p>



<p diff="add"><termdef term="datatype" id="dt-datatype">In this specification, 
a <term>datatype</term> is a thing with four properties</termdef>:

<ulist><item>
<p>A <termref def="dt-value-space"></termref>, which is 
simply a set.  What the members of this set are called (beyond being generically called <quote>values</quote>)
is influenced by the set of value-space operations and relations used therewith.</p>
</item>




<item>
<p>A <termref def="dt-lexical-space"></termref>, which is the domain of the
<termref def="dt-lexical-mapping"></termref>.&nbsp; <phrase role="UNSURE">Some
<termref def="dt-lexical-mapping">lexical mappings</termref> are context sensitive,
so that the <termref def="dt-lexical-space"></termref> depends on the context in which the
lexical representation occurs.</phrase></p>
</item>

<item>
<p>A small collection of <emph>functions, relations, and procedures</emph> associated with the datatype.&nbsp; Included are equality and order relations on the <termref def="dt-value-space"></termref>, and a <termref def="dt-lexical-mapping"></termref>, which is a function on the <termref def="dt-lexical-space"></termref> onto the <termref def="dt-value-space"></termref>.</p>



<note>
<p>This specification only defines the operations and relations needed for schema processing.&nbsp; The
choice of terminology for describing/naming the datatypes is selected to guide users and implementers
in how to expand the datatype to be generally useful&mdash;i.e., how to recognize the <quote>real world</quote>
datatypes and their variants for which the datatypes defined herein are
meant to be used for data interchange.</p>
</note>
</item><item>
<p>A <compref ref="dc-defn"/>, which serves to define and/or identify the datatype.</p>
</item>


</ulist>Along with the <termref def="dt-lexical-mapping"></termref> it is often useful
to have an inverse which provides a standard <termref def="dt-lexical-representation"></termref> for
each value.&nbsp; Such a <termref def="dt-canonical-mapping"></termref> is not required for schema
processing, but is described herein for the benefit of users of this specification, and other
specifications which might find it useful to reference these descriptions normatively.</p>
</div2>

<div2 id="value-space"><head>Value space</head>

<p diff="del"><termdef id="dt-value-space-delled" term="value space">A <term>value
space</term> is the set of values for a given datatype.
Each value in the <term>value space</term> of a datatype is denoted by
one or more literals in its <termref def="dt-lexical-space"/>.
</termdef></p>

<p diff="add"><termdef term="value space" id="dt-value-space">The <term>value space</term> <emph>of 
a datatype</emph> is the set of values for that datatype.</termdef>&nbsp; Associated
with each value space are selected operations and 
relations necessary to permit proper schema processing.&nbsp; Each value in the value space 
of a datatype is denoted by one or more character strings in its 
<termref def="dt-lexical-space"></termref>, according 
to <termref role="the" def="dt-lexical-mapping">the lexical mapping</termref>.&nbsp; (If
the mapping is restricted during a derivation in such a way 
that a value has no denotation, that value is dropped from the value space.)</p>

<p diff="add">The value spaces of datatypes are abstractions, and are defined 
in <specref ref="built-in-datatypes"/> to the 
extent needed to clarify them for readers.&nbsp; For example, in defining the numerical datatypes, we assume 
some general numerical concepts such as number and integer are known.&nbsp; In many cases we provide 
references to other documents providing more complete definitions.</p>

<note diff="add">
<p><emph>The value spaces and the values therein are abstractions.</emph>&nbsp; This specification does not 
prescribe any particular internal representations that must be used when implementing these datatypes.&nbsp; 
In some cases, there are references to other specifications which do prescribe specific internal 
representations; these specific internal representations must be used to comply with those other 
specifications, but need not be used to comply with this specification.</p>

<p>In addition, other applications are expected to define additional appropriate
operations and/or relations on these value spaces (e.g., addition and multiplication
on the various numerical datatypes&apos; value spaces), and are permitted where
appropriate to even redefine the operations and relations defined within this
specification, provided that <emph>for schema processing the relations and operations
used are those defined herein</emph>.</p>
</note>

<!--ednote><edtext>Could we do away with the following paragraph?&nbsp; Does it really add anything?</edtext></ednote-->

<p>The <termref def="dt-value-space"/> of a <phrase diff="del">given </phrase>datatype can
be defined in one of the following ways:
<ulist>
<item><p>defined<phrase diff="add"> elsewhere</phrase> axiomatically from fundamental notions
(intensional definition)
[see <termref def="dt-primitive"/>]</p>
</item>
<item><p>enumerated outright<phrase diff="add"> from values of an already defined
datatype</phrase> (extensional definition)
[see <termref def="dt-enumeration"/>]</p>
</item>
<item><p>defined by restricting the <termref def="dt-value-space"/> of
an already defined datatype to a particular subset with a given set
of properties [see <termref def="dt-derived"/>]</p>
</item>
<item><p>defined as a combination of values from one or more already defined
<termref def="dt-value-space"/>(s) by a specific construction procedure
[see <termref def="dt-list"/> and <termref def="dt-union"/>]</p>
</item></ulist></p>

<p diff="del">
<termref def="dt-value-space"/>s have certain properties.&nbsp; For example,
they always have the property of <termref def="dt-cardinality"/>,
some definition of <emph>equality</emph>
and might be <termref def="dt-ordered"/>, by which individual
values within the <termref def="dt-value-space"/> can be compared to
one another.&nbsp; The properties of <termref def="dt-value-space"/>s that
are recognized by this specification are defined in
<specref ref="fundamental-facets-delled"/>.
</p>

<p diff="add">The relations of <emph>identity</emph>, <emph>equality</emph>, and <emph>order</emph> are 
required for each value space.&nbsp; A very few datatypes have other relations or operations prescribed for the purposes of this 
specification.</p>

<div3 diff="add" id="identity">
<head> Identity</head>

<p>The identity relation is always defined. Every value space inherently has an 
identity relation. Two things are 
<emph>identical</emph> if they are actually the same thing: i.e., if there is no way whatever to 
tell them apart.&nbsp; The identity relation is used when making restrictions by <emph>enumeration</emph>, and when checking <phrase role="UNSURE">identity constraints</phrase>.&nbsp; These are the only uses of <emph>identity</emph> for schema processing.</p>

<note>
<p>This does not preclude implementing datatypes by using more than one 
<emph>internal</emph> representation for a given value, provided no mechanism inherent in 
the datatype implementation (i.e., other than bit-string-preserving &quot;casting&quot; of 
the datum to a different datatype) will distinguish between the two representations.</p>
</note>

<p>In the identity relation defined herein, values
from different <termref def="dt-primitive"/> datatypes&apos; <termref def="dt-value-space">value
spaces</termref> are made artificially distinct if they
might otherwise be considered identical.&nbsp; For example, there is a
number <emph>two</emph> in the <dtref ref="decimal"/>
datatype and a number <emph>two</emph> in the <dtref ref="float"/>
datatype.&nbsp; In the identity relation defined herein, these
two values are considered distinct.&nbsp; Other applications
making use of these datatypes may choose to consider values such as these identical, but for the
view of <termref def="dt-primitive"/> datatypes&apos; <termref def="dt-value-space">value
spaces</termref> used herein, they are distinct.</p>

<p><emph>WARNING:</emph>&nbsp; Care must be taken when identifying values across distinct primitive
datatypes.&nbsp; It turns out that, for example, 0.1 and 0.10000000009 are effectively identical in
<dtref ref="float"/> but not in <dtref ref="decimal"/>.&nbsp; (Neither 0.1 nor 0.10000000009 are in
the <dtref ref="float"/> value space, but <termref role="the" def="dt-lexical-mapping">the lexical mapping</termref>
of <dtref ref="float"/> maps both <string>0.1</string> and <string>0.10000000009</string> to
the same number (0.100000001490116119384765625) that <emph>is</emph> in the <dtref ref="float"/> value space.)</p>

</div3>

<div3 diff="add" id="equality"><head>Equality</head>

<p>Each <termref def="dt-primitive"></termref> datatype has prescribed an equality relation for its value 
space.&nbsp; The equality relation for most datatypes is the identity relation.&nbsp; In the few cases
where it is not, it has been carefully defined so as to be a <emph>congruence relation</emph> for most
other operations of interest to the datatype.&nbsp; (This means simply that if two values are equal
and one is substituted for the other as an argument to any of the operations, the results will always
also be equal.&nbsp; 
For example, identity is <emph>by definition</emph> a congruence relation for all other operations
of interest.)&nbsp; Equality is always a congruence for the order relation.</p><p>On the other hand,
equality need not cover the entire value space of the 
datatype (though it usually does).</p><p>The equality relation is used in conjunction with
order when making restrictions involving order.&nbsp; This is the only use of
<emph>equality</emph> for schema processing.</p>

<note>
<p>In the prior version of
this specification (1.0), equality was always identity.&nbsp; This has been changed
to permit the datatypes defined herein to more closely match the <unusual>real
world</unusual> datatypes for which  they are intended to be used as transmission formats.</p>

<p>For example, the <dtref ref="float"/> datatype has an equality which is not the 
identity (&nbsp;&minus;0&nbsp;=&nbsp;+0&nbsp;, but they are not identical&mdash;although
they <emph>were</emph> identical in the 1.0 version of this specification), and whose
domain excludes one value, NaN, so that&nbsp; NaN&nbsp;&ne;&nbsp;NaN&nbsp;.</p>

<p>For another example, the <dtref ref="dateTime"/> datatype previously lost any timezone
information in the <termref def="dt-lexical-representation"></termref> as the value was
converted to timezone Z; now the timezone is retained and two values representing the
same <unusual>moment in time</unusual> but with different remembered timezones are now
<emph>equal</emph> but not <emph>identical</emph>.</p>
</note>

<p>In the equality relation defined herein, values
from different primitive data spaces are made artificially unequal even if they might
otherwise be considered equal.&nbsp; For example, there is a number <emph>two</emph> in
the <dtref ref="decimal"/>
datatype and a number <emph>two</emph> in the <dtref ref="float"/> datatype.&nbsp; In the equality
relation defined herein, these two values are considered unequal.&nbsp; Other
applications making use of these datatypes
may choose to consider values such as these equal (and must do so if they choose to consider
them identical); nonetheless, in the equality relation defined herein, they are unequal.</p>

<p>For the purposes of this specification, there is one equality relation for all values
of all datatypes (the union of the various datatype&apos;s individual equalities, if one
consider relations to be sets of ordered pairs).&nbsp; The <emph>equality</emph> relation is denoted 
by <mention>=</mention> and its negation by <mention>&ne;</mention>, each used as an binary
infix predicate:&nbsp; <var>x</var>&nbsp;=&nbsp;<var>y</var>&nbsp;
and&nbsp; <var>x</var>&nbsp;&ne;&nbsp;<var>y</var>&nbsp;.&nbsp; On 
the other hand, <emph>identity</emph> relationships are always described in words.</p>

</div3>

<div3 diff="add" id="order"><head>Order</head>

<p>Each datatype has an order relation prescribed.  This order may be a <emph>partial</emph>
order, which means that there may be values in the <termref def="dt-value-space"></termref>
which are neither equal, less-than, nor greater-than.&nbsp; Such value pairs are
<emph>incomparable</emph>.&nbsp; In many cases, the prescribed order is the <unusual>null
order</unusual>:&nbsp; the ultimate partial order, in which no pairs are less-than or
greater-than; they are all equal or incomparable.&nbsp; The order relation is used in
conjunction with equality when making restrictions involving order.&nbsp; This is the
only use of <emph>order</emph> for schema processing.</p>

<p>In this specification, this less-than order relation is denoted by 
<mention>&lt;</mention> (and its inverse by <mention>&gt;</mention>), the weak order by <mention>&le;</mention> 
(and its inverse by <mention>&ge;</mention>), and the resulting 
<emph>incomparable</emph> relation by <mention>&lt;&gt;</mention>, each used as an binary infix predicate:&nbsp;  
<var>x</var>&nbsp;&lt;&nbsp;<var>y</var>&nbsp;,&nbsp; <var>x</var>&nbsp;&le;&nbsp;<var>y</var>&nbsp;,&nbsp; 
<var>x</var>&nbsp;&gt;&nbsp;<var>y</var>&nbsp;,&nbsp; <var>x</var>&nbsp;&ge;&nbsp;<var>y</var>&nbsp;, 
and&nbsp; <var>x</var>&nbsp;&inc;&nbsp;<var>y</var>&nbsp;.</p>

<note>
<p>The weak order <unusual>less-than-or-equal</unusual> means <unusual>less-than</unusual> or
<unusual>equal</unusual>
<emph>and one can tell which</emph>.&nbsp; For example, the <dtref ref="duration"/> P1M
(one month) is <emph>not</emph> less-than-or-equal P31D (thirty-one
days) because P1M is not less than P31D, nor is P1M equal to P31D.&nbsp; Instead,
P1M is incomparable with P31D.)&nbsp; The formal definition of order for <dtref ref="duration"/>
(<specref ref="duration"/>) insures that this is true.</p>
</note>

<p>The value spaces of primitive datatypes are abstractions, which may have values in common.&nbsp; In
the order relation defined herein, these value spaces are made artificially incomparable.&nbsp; For example,
the numbers two and three are values in both the decimal datatype and the float datatype.&nbsp; In the
order relation defined herein, two in the decimal datatype and three in the float datatype are
incomparable values.&nbsp; Other applications making use of these datatypes may choose to consider 
values such as these comparable.</p>

<p>While it is not an error to attempt to compare values from the
value spaces of two different primitive datatypes, they will alway be incomparable and therefore
unequal:&nbsp; If <var>x</var> and <var>y</var> are in the value spaces of different primitive
datatypes then&nbsp; <var>x</var>&nbsp;&inc;&nbsp;<var>y</var>&nbsp; (and
hence&nbsp; <var>x</var>&nbsp;&ne;&nbsp;<var>y</var>&nbsp;).</p>

</div3>
</div2>

<div2 diff="del"><head>Lexical space</head>

<p>In addition to its <termref def="dt-value-space"></termref>, each datatype also
has a lexical space.
</p>
<p><termdef term="lexical space" id="dt-lexical-space-delled">A
<term>lexical space</term> is the set of valid <emph>literals</emph>
for a datatype.
</termdef></p>
<p>
For example, "100" and "1.0E2" are two different literals from the
<termref def="dt-lexical-space"/> of <dtref ref="float"/> which both
denote the same value. The type system defined in this specification
provides a mechanism for schema designers to control the set of values
and the corresponding set of acceptable literals of those values for
a datatype.
</p>
<note>
<p>
The literals in the <termref def="dt-lexical-space"/>s defined in this specification
have the following characteristics:
</p>
<glist>
<gitem>
<label>
Interoperability:
</label>
<def>
<p>
The number of literals for each value has been kept small; for many
datatypes there is a one-to-one mapping between literals and values.
This makes it easy to exchange the values between different systems.
In many cases, conversion from locale-dependent representations will
be required on both the originator and the recipient side, both for
computer processing and for interaction with humans.
</p>
</def>
</gitem>
<gitem>
<label>
Basic readability:
</label>
<def>
<p>
Textual, rather than binary, literals are used.
This makes hand editing, debugging, and similar activities possible.
</p>
</def>
</gitem>
<gitem>
<label>
Ease of parsing and serializing:
</label>
<def>
<p>
Where possible, literals correspond to those found in common
programming languages and libraries.
</p>
</def>
</gitem>
</glist>
</note><div3 id="canonical-lexical-representation-delled">
<head>Canonical Lexical Representation</head>
<p>
While the datatypes defined in this specification have, for the most part,
a single lexical representation i.e. each value in the datatype's
<termref def="dt-value-space"/> is denoted by a single literal in its
<termref def="dt-lexical-space"/>, this is not always the case.&nbsp; The
example in the previous section showed two literals for the datatype
<dtref ref="float"/> which denote the same value.&nbsp; Similarly, there
<termref def="dt-may"/> be
several literals for one of the date or time datatypes that denote the
same value using different timezone indicators.
</p>
<p>
<termdef term="canonical lexical representation" id="dt-canonical-representation-delled">A
<term>canonical lexical representation</term>
is a set of literals from among the valid set of literals
for a datatype such that there is a one-to-one mapping between literals
in the <term>canonical lexical representation</term> and
values in the <termref def="dt-value-space"/>.
</termdef>
</p>
</div3></div2>

<div2 id="lexical-space" diff="add"><head>The Lexical Space and Lexical Mapping</head>

<!--
<p><termdef term="lexical mapping" id="dt-lexical-mapping">A 
<term>lexical mapping</term> for a datatype is a function whose domain is a set of character 
strings and whose range is a subset of the set of values of that datatype.</termdef>  Lexical 
mappings are designated <emph>active</emph> or <emph>inactive</emph>.&nbsp; Two lexical mappings 
active at the same time must have disjoint domains, or at least must agree on the intersection of their domains; this assures that 
<termref role="the" def="dt-lexical-mapping">the (combined) lexical mapping</termref> is a 
function:  it does not map one lexical representation to more than one value.</p>

<p><termdef term="lexical representation" id="dt-lexical-representation">The 
members of the domain of a lexical mapping are <term>lexical representations</term> (under 
that mapping) of the values to which they are mapped.</termdef></p>

<p><termdef term="the lexical mapping" id="dt-the-lexical-mapping"><term><emph>The</emph> 
lexical mapping</term> of a datatype is the union of all active lexical mappings 
for that datatype.</termdef>&nbsp;  The union of the active lexical mappings will necessarily have as 
its range the <termref def="dt-value-space"></termref>.&nbsp; This
assures that each value has at least 
one <termref def="dt-lexical-representation"></termref>.</p>

<p><termdef term="lexical space" id="dt-lexical-space">The
<term>lexical space</term> of a datatype is the  domain of <termref role="the" def="dt-lexical-mapping">the lexical mapping</termref> 
for that datatype.</termdef>&nbsp;  A datatype may have more than
one<termref def="dt-lexical-mapping"></termref>, and more than 
one may be active, subject to the constraints given above.</p>

<p>Should a datatype have <termref def="dt-lexical-mapping">lexical mappings</termref> whose domains overlap 
and which do not give the same value for character strings in the overlap, then there must be a 
fixed algorithm (possibly dependent on facet values) which selects which lexical mappings are active 
(subject to the constraints above); otherwise there <emph>may</emph> be such an algorithm and 
facet(s).&nbsp; In the absence of such an algorithm all of the datatype's mappings are active.</p>
-->

<ednote><edtext>Some things in this section and elsewhere will need to be rewritten once we decide just how
to deal with context-dependent lexical mappings and lexical spaces.</edtext></ednote>

<p><termdef term="lexical mapping" id="dt-lexical-mapping">The
<term>lexical mapping</term> for a datatype is a prescribed function whose domain is a prescribed set of character 
strings (the <termref def="dt-lexical-space"></termref>) and whose range is the
<termref def="dt-value-space"></termref> of that datatype.</termdef></p>

<p><termdef term="lexical space" id="dt-lexical-space">The
<term>lexical space</term> of a datatype is the prescribed domain of 
<termref role="the" def="dt-lexical-mapping">the lexical mapping</termref> 
for that datatype.</termdef><!-- &nbsp;  A datatype may have more than
one<termref def="dt-lexical-mapping"></termref>, and more than 
one may be active, subject to the constraints given above. --></p>

<p><termdef term="lexical representation" id="dt-lexical-representation">The 
members of the <termref def="dt-lexical-space"></termref> are <term>lexical 
representations</term> of the values to which they are mapped.</termdef></p>

<p>Should a derivation be made using a derivation mechanism that 
removes <termref def="dt-lexical-representation">lexical representations</termref> from
the<termref def="dt-lexical-space"></termref> to the extent that one or more values cease 
to have any <termref def="dt-lexical-representation"></termref>, then those values are
dropped from the <termref def="dt-value-space"></termref>.</p>

<note>
<p>This could happen by means of a <compref ref="dc-pattern"/> facet<!-- or a
<phrase role="UNSURE"><compref ref="NOTATION-facets"/></phrase> facet-->.</p>
</note>

<p>Conversely, should a derivation remove values then their 
<termref def="dt-lexical-representation">lexical representations</termref> are dropped
from the <termref def="dt-lexical-space"></termref> unless there is a facet value whose 
impact is defined to cause the otherwise-dropped <termref def="dt-lexical-representation"></termref>
to be mapped to another value instead.</p>

<note>
<p>There are currently no facets with such an impact.&nbsp; There may be 
in the future.</p>
</note>

<p>For example, &apos;100&apos; and &apos;1.0E2&apos; are two different 
<termref def="dt-lexical-representation">lexical 
representations</termref> from the <dtref ref="float"/> datatype 
which both denote the same value.&nbsp; The datatype 
system defined in this specification provides mechanisms for schema designers
to control the <termref def="dt-value-space"></termref> and the corresponding set of acceptable 
<termref def="dt-lexical-representation">lexical 
representations</termref> of those values for a datatype.</p>

<div3 id="canonical-lexical-representation"><head>Canonical Mapping</head>

<issue id="RQ-129i" role="1.1">
<p><loc href="&reqs;#eliminate-canonical" target="reqs">RQ-129 (remove dependency on canonical representations)</loc></p>
<p>The dependencies are in Part 1; they will be resolved there.&nbsp; Text in this Part will reflect that canonical representation
are provided for the benefit of other users, including other specifications that might want to reference these datatypes.</p>
</issue>

<issue id="RQ-126i" role="1.1">
<p><loc href="&reqs;#restrict-can-forms" target="reqs">RQ-126 (restricting away canonical representations)</loc></p>
<p>Given the "pattern" &cfacet;, restricting away canonical representations cannot be prohibited without undue processing
expense.&nbsp; A warning will be inserted, and RQ-129 will insure that loss of canonical representations will not affect schema processing.</p>
</issue>

<p>While the datatypes defined in this specification generally have
a single <termref def="dt-lexical-representation"></termref> for each value (i.e., each value in the datatype's
<termref def="dt-value-space"></termref> is denoted by a single
<termref def="dt-lexical-representation">representation</termref> in its
<termref def="dt-lexical-space"></termref>), this is not always the case.&nbsp; The
example in the previous section shows two <termref def="dt-lexical-representation">lexical
representations</termref> from the <dtref ref="float"/>
datatype which denote the same value.</p>

<p><termdef id="dt-canonical-mapping" term="canonical mapping">The 
<term>canonical mapping</term> is a prescribed subset of the inverse of a
<termref def="dt-lexical-mapping"></termref> which is 
one-to-one and whose domain (where possible) is the entire range of the
<termref def="dt-lexical-mapping"></termref> (the
<termref def="dt-value-space"></termref>).</termdef>&nbsp; Thus a 
<termref def="dt-canonical-mapping"></termref> selects one
<termref def="dt-lexical-representation"></termref> for each
value in the <termref def="dt-value-space"></termref>.<!-- &nbsp; <phrase role="UNSURE">Most lexical mappings have
an associated canonical mapping; the 
exceptions are a few lexical mappings that are context dependent.</phrase>&nbsp; If
two <termref def="dt-canonical-mapping">canonical mappings</termref> 
with intersecting domains, for a given <termref def="dt-lexical-mapping"></termref>, are
associated with a datatype, then 
there will be a fixed algorithm (possibly dependent on facet values) associated with the 
datatype which resolves any ambiguity of <termref def="dt-canonical-mapping"></termref> in the intersection. --></p>

<p><termdef term="canonical representation" id="dt-canonical-representation">The 
<term>canonical representation</term> of a value in the
<termref def="dt-value-space"></termref> of a datatype is the 
<termref def="dt-lexical-representation"></termref> associated with that value
by the datatype&apos;s <termref def="dt-canonical-mapping"></termref></termdef>.</p>

<!-- <p><termdef id="dt-the-canonical-mapping" term="the canonical mapping"><term><emph>The</emph> 
canonical mapping</term> of a datatype is essentially the union of the
<termref def="dt-canonical-mapping">canonical mappings</termref> 
associated with the active <termref def="dt-lexical-mapping">lexical mappings</termref>,
with values (if any) in the pairwise intersection 
of the domains of those mappings selected according to a fixed algorithm (possibly
having facet values as parameters) associated with the datatype.</termdef></p>
 -->
<p><termref role="the" def="dt-canonical-mapping">Canonical mappings</termref> are not
available for datatypes whose <termref def="dt-lexical-mapping">lexical 
mappings</termref> are context dependent (i.e., mappings for which the value
of a <termref def="dt-lexical-representation"></termref> 
depends on the context in which it occurs, or for which a character string 
may or may not be a valid <termref def="dt-lexical-representation"></termref>
similarly depending on its context)</p><note><p><termref def="dt-canonical-representation">Canonical 
representations</termref> are provided where feasible for the use of other appilications; they are not 
required for schema processing itself.&nbsp; <emph>A conforming schema processor implementation is 
not required to implement <termref def="dt-canonical-mapping">canonical mappings</termref>.</emph></p></note>

</div3>
</div2>

<div2 id="facets">
<head>Facets</head>

<issue id="RQ-24-1i" role="1.1">
<p><loc href="&reqs;#fundamentals" target="reqs">RQ-24 (systematic approach to facets)</loc></p>
<p>This decision is not yet written up herein:&nbsp; The four informational facets, each of which have only one property,
will be lumped into one facet having four properties.&nbsp; This will represent a further technical change to the
facet structure, but will not result in any additional or lost information in a schema.</p>
</issue>

<p diff="del">
<termdef id="dt-facet-delled" term="facet">A <term>facet</term> is a single
defining aspect of a <termref def="dt-value-space"/>.&nbsp; Generally
speaking, each facet characterizes a <termref def="dt-value-space"/>
along independent axes or dimensions.</termdef>
</p>
<p diff="del">
The facets of a datatype serve to distinguish those aspects of
one datatype which <emph>differ</emph> from other datatypes.
Rather than being defined solely in terms of a prose description
the datatypes in this specification are defined in terms of
the <emph>synthesis</emph> of facet values which together determine the
<termref def="dt-value-space"/> and properties of the datatype.
</p>
<p diff="del">
Facets are of two types: <emph>fundamental</emph> facets that define
the datatype and <emph>non-fundamental</emph> or <emph>constraining
</emph> facets that constrain the permitted values of a datatype.
</p>

<p diff="add"><termdef term="facet" id="dt-facet"><term>Facets</term> are designated and named
values that either provide information about an aspect of the datatype (<termref def="dt-fundamental-facet">information
facets</termref>) or control some aspect of the datatype
(<termref def="dt-constraining-facet">&cfacet;s</termref>).</termdef>&nbsp; For example, each datatype has a
<compref ref="dc-cardinality"/> facet whose 
value generally tells something about the finiteness of the datatype, and each datatype has 
a <compref ref="dc-whiteSpace"/>  facet whose value controls the &quot;normalization&quot; of the 
raw data-character string in the XML document undergoes prior to being treated as a potential 
member of the <termref def="dt-lexical-space"></termref>.</p>
				
<p diff="add">
Facets are of two kinds:&nbsp;
<termdef term="information facet" id="dt-fundamental-facet"><term>information facets</term> provide the
application with some information about the datatype</termdef>, and 
<termdef term="&cfacet;" id="dt-constraining-facet"><term>&cfacet;</term> values may be set or changed
during derivation (subject to facet-specific controls) 
and which control various aspects of the derived datatype</termdef>.&nbsp; For example, <compref ref="dc-cardinality"/> 
is an information facet and <compref ref="dc-whiteSpace"/> is a &cfacet;.&nbsp; The various information 
facets are described in <specref ref="rf-fund-facets"/> and &cfacet;s in 
<specref ref="rf-facets"/>.</p>

<!--ednote><edtext>We may require that information facets be tracked,
in which case we will change the following note accordingly.&nbsp; Similarly if we don't add the
new &cfacet;s for precisionDecimal or whatever else might need them.</edtext></ednote-->

<note diff="add">
<p> In the 1.0 version of this specification, information facets were called 
&quot;fundamental facets&quot;<!-- and &cfacet;s were called &quot;constraining 
facets&quot;-->.&nbsp; Information facets are not required for schema processing,
but some applications use them.<!--&nbsp; More &cfacet;s have been added which do 
not constrain the value space of derived datatypes (and the whitespace facet never did).--></p>
</note>

<div3 id="fundamental-facets-delled" diff="del">
<head>Fundamental facets</head>
<p>
<termdef id="dt-fundamental-facet-delled" term="fundamental facet">
A <term>fundamental facet</term> is an abstract property which
serves to semantically characterize the values in a
<termref def="dt-value-space"/>.
</termdef>
</p>
<p>
All <term>fundamental facets</term> are fully described in
<specref ref="rf-fund-facets"/>.
</p>
</div3>

<div3 id="non-fundamental-delled" diff="del">
<head>Constraining or Non-fundamental facets</head>
<p>
<termdef id="dt-constraining-facet-delled" term="constraining facet">A
<term>constraining facet</term> is an optional property that can be
applied to a datatype to constrain its <termref def="dt-value-space"/>.
</termdef>
</p>
<p>
Constraining the <termref def="dt-value-space"/> consequently constrains
the <termref def="dt-lexical-space"/>.&nbsp; Adding
<termref def="dt-constraining-facet"/>s to a <termref def="dt-basetype"/>
is described in <specref ref="derivation-by-restriction"/>.
</p>
<p>
All <term>constraining facets</term> are fully described in
<specref ref="rf-facets"/>.
</p>

</div3>
</div2>

 <!-- ****************************** END NEW 1.1 MATERIAL (DATATYPES/FACETS) ********************************* -->

<div2 role="1.0" id="datatype-dichotomies">
<head>Datatype dichotomies</head>
<p>
It is useful to categorize the datatypes defined in this specification
along various dimensions, forming a set of characterization dichotomies.
</p>
<div3 role="1.0" id="atomic-vs-list">
<head>Atomic vs. list vs. union datatypes</head>
<p>
The first distinction to be made is that between
<termref def="dt-atomic"/>, <termref def="dt-list"/> and <termref def="dt-union"/>
datatypes.
</p>
<ulist>
<item>
<p>
<termdef id="dt-atomic" term="atomic"><term>Atomic</term> datatypes
are those having values which are regarded by this specification as
being indivisible.
</termdef>
</p>
</item>
<item>
<p>
<termdef id="dt-list" term="list"><term>List</term>
datatypes are those having values each of which consists of a
finite-length (possibly empty) sequence of values of an
<termref def="dt-atomic"/> datatype.
</termdef>
</p>
</item>
<item>
<p>
<termdef id="dt-union" term="union"><term>Union</term>
datatypes are those whose <termref def="dt-value-space"/>s and
<termref def="dt-lexical-space"/>s are the union of
the <termref def="dt-value-space"/>s and
<termref def="dt-lexical-space"/>s of one or more other datatypes.
</termdef>
</p>
</item>
</ulist>
<p>
For example, a single token which <termref def="dt-match"/>es
<xspecref href="&xmlspec;#NT-Nmtoken">Nmtoken</xspecref> from
<bibref ref="XML"/> could be the value of an <termref def="dt-atomic"/>
datatype (<dtref ref="NMTOKEN"/>); while a sequence of such tokens
could be the value of a <termref def="dt-list"/> datatype
(<dtref ref="NMTOKENS"/>).
</p>
<div4 role="1.0" id="atomic">
<head>Atomic datatypes</head>
<p>
<termref def="dt-atomic"/> datatypes can be either
<termref def="dt-primitive"/> or <termref def="dt-derived"/>.&nbsp; The
<termref def="dt-value-space"/> of an <termref def="dt-atomic"/> datatype
is a set of "atomic" values, which for the purposes of this specification,
are not further decomposable.&nbsp; The <termref def="dt-lexical-space"/> of
an <termref def="dt-atomic"/> datatype is a set of <emph>literals</emph>
whose internal structure is specific to the datatype in question.
</p>
</div4>
<div4 role="1.0" id="list-datatypes">
<head>List datatypes</head>
<!-- question: are lists ordered? answer should be NO...the sequence
within a single value is ordered, but the value space is a list type
is not ordered
-->
<p>
Several type systems (such as the one described in
<bibref ref="ISO11404"/>) treat <termref def="dt-list"/> datatypes as
special cases of the more general notions of aggregate or collection
datatypes.
</p>
<p>
<termref def="dt-list"/> datatypes are always <termref def="dt-derived"/>.
The <termref def="dt-value-space"/> of a <termref def="dt-list"/>
datatype is a set of finite-length sequences of <termref def="dt-atomic"/>
values. The <termref def="dt-lexical-space"/> of a
<termref def="dt-list"/> datatype is a set of literals whose internal
structure is a space-separated
sequence of literals of the
<termref def="dt-atomic"/> datatype of the items in the
<termref def="dt-list"/>.
</p>
<p>
<termdef id="dt-itemType" term="itemType">
The <termref def="dt-atomic"/> or <termref def="dt-union"/>
datatype that participates in the definition of a <termref def="dt-list"/> datatype
is known as the <term>itemType</term> of that <termref def="dt-list"/> datatype.
</termdef>
</p>
<note role="example">
<eg><![CDATA[
<simpleType name='sizes'>
  <list itemType='decimal'/>
</simpleType>
]]></eg>
<eg><![CDATA[
<cerealSizes xsi:type='sizes'> 8 10.5 12 </cerealSizes>
]]></eg>
</note>
<p>
A <termref def="dt-list"/> datatype can be <termref def="dt-derived"/>
from an <termref def="dt-atomic"/> datatype whose
<termref def="dt-lexical-space"/> allows space
(such as <dtref ref="string"/>
or <dtref ref="anyURI"/>)or a
	<termref def="dt-union"/> datatype any of whose <propref ref="defn-memberTypes"/>'s
	<termref def="dt-lexical-space"/> allows space.
In such a case, regardless of the input, list items
will be separated at space boundaries.
</p>

<note role="example">
<eg><![CDATA[
<simpleType name='listOfString'>
  <list itemType='string'/>
</simpleType>
]]></eg>
<eg>
&lt;someElement xsi:type='listOfString'>
this is not list item 1
this is not list item 2
this is not list item 3
&lt;/someElement>
</eg>
<p>
In the above example, the value of the <emph>someElement</emph> element
is not a <termref def="dt-list"/> of <termref def="dt-length"/> 3;
rather, it is a <termref def="dt-list"/> of <termref def="dt-length"/>
18.
</p>
</note>
<!--
     somehow need to get the <has-facets> concept for abstract lists
	 into builtin.xsd, so that the following can be auto-generated
  -->
<p>
When a datatype is <termref def="dt-derived"/> from a
<termref def="dt-list"/> datatype, the following
<termref def="dt-constraining-facet"/>s apply:
</p>
<ulist>
<item><p><termref def="dt-length"/></p></item>
<item><p><termref def="dt-maxLength"/></p></item>
<item><p><termref def="dt-minLength"/></p></item>
<item><p><termref def="dt-enumeration"/></p></item>
<item><p><termref def="dt-pattern"/></p></item>
<item><p><termref def="dt-whiteSpace"/></p></item>
</ulist>
<p>
For each of <termref def="dt-length"/>, <termref def="dt-maxLength"/>
and <termref def="dt-minLength"/>, the <emph>unit of length</emph> is
measured in number of list items.&nbsp; The value of <termref def="dt-whiteSpace"/>
is fixed to the value <emph>collapse</emph>.
</p>
<p>

For <termref def="dt-list"/> datatypes the <termref def="dt-lexical-space"/>

is composed of space-separated
literals of its <termref def="dt-itemType"/>.&nbsp; Hence, any
<termref def="dt-pattern"/> specified when a new datatype is
<termref def="dt-derived"/> from a <termref def="dt-list"/> datatype is matched against
each literal of the <termref def="dt-list"/> datatype and
not against the literals of the datatype that serves as its
<termref def="dt-itemType"/>.

</p>
<note role="example">
<eg>
<![CDATA[<xs:simpleType name='myList'>
	<xs:list itemType='xs:integer'/>
</xs:simpleType>
<xs:simpleType name='myRestrictedList'>
	<xs:restriction base='myList'>
		<xs:pattern value='123 (\d+\s)*456'/>
	</xs:restriction>
</xs:simpleType>
<someElement xsi:type='myRestrictedList'>123 456</someElement>
<someElement xsi:type='myRestrictedList'>123 987 456</someElement>
<someElement xsi:type='myRestrictedList'>123 987 567 456</someElement>
]]>
</eg>
</note>
<p>
The <dtref ref="canonical-lexical-representation"/> for the
<termref def="dt-list"/> datatype is defined as the lexical form in which
each item in the <termref def="dt-list"/> has the canonical lexical
representation of its  <termref def="dt-itemType"/>.
</p>
</div4>
<div4 role="1.0" id="union-datatypes">
<head>Union datatypes</head>
<p>
The <termref def="dt-value-space"/> and <termref def="dt-lexical-space"/>
of a <termref def="dt-union"/> datatype are the union of the
<termref def="dt-value-space"/>s and <termref def="dt-lexical-space"/>s of
its <termref def="dt-memberTypes"/>.
<termref def="dt-union"/> datatypes are always <termref def="dt-derived"/>.
Currently, there are no <termref def="dt-built-in"/>&nbsp;<termref def="dt-union"/>
datatypes.
</p>
<note role="example">
<p>
A prototypical example of a <termref def="dt-union"/> type is the
<xspecref href="&xsdl;#p-max_occurs">maxOccurs attribute</xspecref> on the
<xspecref href="&xsdl;#element-element">element element</xspecref>
in XML Schema itself: it is a union of nonNegativeInteger
and an enumeration with the single member, the string "unbounded", as shown below.
</p>
<eg><![CDATA[
  <attributeGroup name="occurs">
    <attribute name="minOccurs" type="nonNegativeInteger"]]>
    	use="optional"<![CDATA[ default="1"/>
    <attribute name="maxOccurs"]]>use="optional" default="1"<![CDATA[>
      <simpleType>
        <union>
          <simpleType>
            <restriction base='nonNegativeInteger'/>
          </simpleType>
          <simpleType>
            <restriction base='string'>
              <enumeration value='unbounded'/>
            </restriction>
          </simpleType>
        </union>
      </simpleType>
    </attribute>
  </attributeGroup>
]]></eg>
</note>
<p>
Any number (greater than 1) of <termref def="dt-atomic"/> or <termref def="dt-list"/>
<termref def="dt-datatype"/>s can participate in a <termref def="dt-union"/> type.
</p>
<p>
<termdef id="dt-memberTypes" term="memberTypes">
The datatypes that participate in the
definition of a <termref def="dt-union"/> datatype are known as the
<term>memberTypes</term> of that <termref def="dt-union"/> datatype.
</termdef>
</p>
<p>
The order in which the <termref def="dt-memberTypes"/> are specified in the
definition (that is, the order of the &lt;simpleType> children of the &lt;union>
element, or the order of the <dtref ref="QName"/>s in the <emph>memberTypes</emph>
attribute) is significant.
During validation, an element or attribute's value is validated against the
<termref def="dt-memberTypes"/> in the order in which they appear in the
definition until a match is found.&nbsp; The evaluation order can be overridden
with the use of <xspecref href="&xsdl;#xsi_type">xsi:type</xspecref>.
</p>
<note>
<p>
For example, given the definition below, the first instance of the &lt;size> element
validates correctly as an <specref ref="integer"/>, the second and third as
<specref ref="string"/>.
</p>
<eg><![CDATA[
  <xsd:element name='size'>
    <xsd:simpleType>
      <xsd:union>
        <xsd:simpleType>
          <xsd:restriction base='integer'/>
        </xsd:simpleType>
        <xsd:simpleType>
          <xsd:restriction base='string'/>
        </xsd:simpleType>
      </xsd:union>
    </xsd:simpleType>
  </xsd:element>
]]></eg>
<eg><![CDATA[
  <size>1</size>
  <size>large</size>
  <size xsi:type='xsd:string'>1</size>
]]></eg></note>
<p> The <dtref ref="canonical-lexical-representation"/> for a
<termref def="dt-union"/> datatype is defined as the lexical form in which
the values have the canonical lexical representation
of the appropriate  <termref def="dt-memberTypes"/>.</p>
<note>
<p>
A datatype which is <termref def="dt-atomic"/> in this specification
need not be an "atomic" datatype in any programming language used to
implement this specification.&nbsp; Likewise, a datatype which is a
<termref def="dt-list"/> in this specification need not be a "list"
datatype in any programming language used to implement this specification.
Furthermore, a datatype which is a <termref def="dt-union"/> in this
specification need not be a "union" datatype in any programming
language used to implement this specification.
</p>
</note>
</div4>
</div3>
<div3 role="1.0" id="primitive-vs-derived">
<head>Primitive vs. derived datatypes</head>
<p>
Next, we distinguish between <termref def="dt-primitive"/> and
<termref def="dt-derived"/> datatypes.
</p>
<ulist>
<item>
<p>
<termdef id="dt-primitive" term="primitive"><term>Primitive</term>
datatypes are those that are not defined in terms of other datatypes;
they exist <emph>ab initio</emph>.
</termdef>
</p>
</item>
<item>
<p>
<termdef id="dt-derived" term="derived"><term>Derived</term>
datatypes are those that are defined in terms of other datatypes.
</termdef>
</p>
</item>
</ulist>
<p>
For example, in this specification, <dtref ref="float"/> is a well-defined
mathematical
<!-- find example other than float -->
concept that cannot be defined in terms of other datatypes, while
a <dtref ref="integer"/> is a special case of the more general datatype
<dtref ref="decimal"/>.
</p>
<issue id="RQ-141i" role="1.1">
<p><loc href="&reqs;#anyAtomicType" target="reqs">RQ-141 (add abstract anyAtomicType)</loc>
<loc href="&reqs;#fundamentals" target="reqs">RQ-24 (systematic facets: status and value space of anySimpleType)</loc></p>
<p>A new "magic" datatype will be introduced as a child of anySimpleType and the parent of all primitive atomic datatypes.</p>
</issue>
<p>
<termdef id="dt-anySimpleType" term="anySimpleType" role="local">
The simple ur-type definition is a special restriction of the
<xtermref href="&xsdl;#key-urType">ur-type definition</xtermref>
whose name is <term>anySimpleType</term> in the XML Schema namespace.
<term>anySimpleType</term> can be
considered as the <termref def="dt-basetype"/> of all <termref def="dt-primitive"/>
datatypes.
<term>anySimpleType</term> is considered to have an unconstrained lexical space and a
<termref def="dt-value-space"/> consisting of the union of the
<termref def="dt-value-space"/>s of all the
<termref def="dt-primitive"/>
datatypes and the set of all lists of all members of the
<termref def="dt-value-space"/>s of all the
<termref def="dt-primitive"/> datatypes.
</termdef>
</p>
<p>
The datatypes defined by this specification fall into both
the <termref def="dt-primitive"/> and <termref def="dt-derived"/>
categories.&nbsp; It is felt that a judiciously chosen set of
<termref def="dt-primitive"/> datatypes will serve the widest
possible audience by providing a set of convenient datatypes that
can be used as is, as well as providing a rich enough base from
which the variety of datatypes needed by schema designers can be
<termref def="dt-derived"/>.
</p>
<p>
In the example above, <dtref ref="integer"/> is <termref def="dt-derived"/>
from <dtref ref="decimal"/>.
</p>
<note>
<p>
A datatype which is <termref def="dt-primitive"/> in this specification
need not be a "primitive" datatype in any programming language used to
implement this specification.&nbsp; Likewise, a datatype which is
<termref def="dt-derived"/> in this specification need not be a
"derived" datatype in any programming language used to implement
this specification.
</p>
</note>
<p>
As described in more detail in <specref ref="xr-defn"/>,
each <termref def="dt-user-derived"/> datatype <termref def="dt-must"/>
be defined in terms of another datatype in one of three ways: 1) by assigning
<termref def="dt-constraining-facet"/>s which serve to <emph>restrict</emph> the
<termref def="dt-value-space"/> of the <termref def="dt-user-derived"/>
datatype to a subset of that of the <termref def="dt-basetype"/>; 2) by creating
a <termref def="dt-list"/> datatype whose <termref def="dt-value-space"/>
consists of finite-length sequences of values of its
<termref def="dt-itemType"/>; or 3) by creating a <termref def="dt-union"/>
datatype whose <termref def="dt-value-space"/> consists of the union of the
<termref def="dt-value-space"/>s of its <termref def="dt-memberTypes"/>.
</p>

<div4 role="1.0" id="restriction">
<head>Derived by restriction</head>
<p>
<!-- add the exception for pattern -->
<termdef id="dt-restriction" term="restriction">A datatype is said to be
<termref def="dt-derived"/> by <term>restriction</term> from another datatype
when values for zero or more <termref def="dt-constraining-facet"/>s are specified
that serve to constrain its <termref def="dt-value-space"/> and/or its
<termref def="dt-lexical-space"/> to a subset of those of its
<termref def="dt-basetype"/>.
</termdef>
</p>
<p>
<termdef id="dt-basetype" term="base type">Every
datatype that is <termref def="dt-derived"/> by <term>restriction</term>
is defined in terms of an existing datatype, referred to as its
<term>base type</term>. <term>base type</term>s can be either
<termref def="dt-primitive"/> or <termref def="dt-derived"/>.
</termdef>
</p>
</div4>
<div4 role="1.0" id="list">
<head>Derived by list</head>
<p>
A <termref def="dt-list"/> datatype can be <termref def="dt-derived"/>
from another datatype (its <termref def="dt-itemType"/>) by creating
a <termref def="dt-value-space"/> that consists of a finite-length sequence
of values of its <termref def="dt-itemType"/>.
</p>
</div4>
<div4 role="1.0" id="union">
<head>Derived by union</head>
<p>
One datatype can be <termref def="dt-derived"/> from one or more
datatypes by <termref def="dt-union"/>ing their <termref def="dt-value-space"/>s
and, consequently, their <termref def="dt-lexical-space"/>s.
</p>
</div4>
</div3>
<div3 role="1.0" id="built-in-vs-user-derived">
<head>Built-in vs. user-derived datatypes</head>
<ulist>
<item>
<p>
<termdef id="dt-built-in" term="built-in"><term>Built-in</term>
datatypes are those which are defined in this specification,
and can be either <termref def="dt-primitive"/> or
<termref def="dt-derived"/>;
</termdef>
</p>
</item>
<item>
<p>
<termdef id="dt-user-derived" term="user-derived">
<term>User-derived</term> datatypes are those <termref def="dt-derived"/>
datatypes that are defined by individual schema designers.
</termdef>
</p>
</item>
</ulist>
<p>
Conceptually there is no difference between the
<termref def="dt-built-in"/>&nbsp;<termref def="dt-derived"/> datatypes
included in this specification and the <termref def="dt-user-derived"/>
datatypes which will be created by individual schema designers.
The <termref def="dt-built-in"/>&nbsp;<termref def="dt-derived"/> datatypes
are those which are believed to be so common that if they were not
defined in this specification many schema designers would end up
"reinventing" them.&nbsp; Furthermore, including these
<termref def="dt-derived"/> datatypes in this specification serves to
demonstrate the mechanics and utility of the datatype generation
facilities of this specification.
</p>
<note>
<p>
A datatype which is <termref def="dt-built-in"/> in this specification
need not be a "built-in" datatype in any programming language used
to implement this specification.&nbsp; Likewise, a datatype which is
<termref def="dt-user-derived"/> in this specification need not
be a "user-derived" datatype in any programming language used to
implement this specification.
</p>
</note>
</div3>
</div2>
</div1>
<div1 role="1.0" id="built-in-datatypes">
<head>Built-in datatypes</head>
<graphic source="type-hierarchy.gif" alt="Diagram of built-in type hierarchy" map="typeImage"/>
<!--
	thanx to Asir S Vedamuthu for creating this image map
  -->
  <imagemap source="image-map.html" id="typeImage"/>

<p>
      Each built-in datatype in this specification (both
      <termref def="dt-primitive"/> and
      <termref def="dt-derived"/>) can be uniquely addressed via a
      URI Reference constructed as follows:
</p>
<olist>
<item><p>the base URI is the URI of the XML Schema namespace</p></item>
<item><p>the fragment identifier is the name of the datatype</p></item>
</olist>
<p>
      For example, to address the <dtref ref="int"/> datatype, the URI is:
</p>
<ulist>
      <item><p><code>http://www.w3.org/2001/XMLSchema#int</code></p></item>
</ulist>
<p>
      Additionally, each facet definition element can be uniquely
      addressed via a URI constructed as follows:
</p>
<olist>
<item><p>the base URI is the URI of the XML Schema namespace</p></item>
<item><p>the fragment identifier is the name of the facet</p></item>
</olist>
<p>
      For example, to address the maxInclusive facet, the URI is:
</p>
<ulist>
      <item><p><code>http://www.w3.org/2001/XMLSchema#maxInclusive</code></p></item>
</ulist>
<p>
      Additionally, each facet usage in a built-in datatype definition
      can be uniquely addressed via a URI constructed as follows:
</p>
<olist>
<item><p>the base URI is the URI of the XML Schema namespace</p></item>
<item><p>the fragment identifier is the name of the datatype, followed
	by a period (".") followed by the name of the facet</p></item>
</olist>
<p>
      For example, to address the usage of the maxInclusive facet in
      the definition of int, the URI is:
</p>
<ulist>
      <item><p><code>http://www.w3.org/2001/XMLSchema#int.maxInclusive</code></p></item>
</ulist>
<div2 role="1.0" id="namespaces">
<head>Namespace considerations</head>
<p>
The <termref def="dt-built-in"/> datatypes defined by this specification
are designed to be used with the &schema-language; as well as other
XML specifications.
To facilitate usage within the &schema-language;, the <termref def="dt-built-in"/>
datatypes in this specification have the namespace name:
</p>
<ulist>
<item><p>http://www.w3.org/2001/XMLSchema</p></item>
</ulist>
<p>
To facilitate usage in specifications other than the &schema-language;,
such as those that do not want to know anything about aspects of the
&schema-language; other than the datatypes, each <termref def="dt-built-in"/>
datatype is also defined in the namespace whose URI is:
</p>
<ulist>
<item><p>http://www.w3.org/2001/XMLSchema-datatypes</p></item>
</ulist>
<p>
This applies to both
<termref def="dt-built-in"/>&nbsp;<termref def="dt-primitive"/> and
<termref def="dt-built-in"/>&nbsp;<termref def="dt-derived"/> datatypes.
</p>
<p>
Each <termref def="dt-user-derived"/> datatype is also associated with a
unique namespace.&nbsp; However, <termref def="dt-user-derived"/> datatypes
do not come from the namespace defined by this specification; rather,
they come from the namespace of the schema in which they are defined
(see <xspecref href="&xsdl;#declare-schema">XML Representation of
Schemas</xspecref> in <bibref ref="structural-schemas"/>).
</p>
</div2>
<div2 role="1.0" id="built-in-primitive-datatypes">
<head>Primitive datatypes</head>
<p>
The <termref def="dt-primitive"/> datatypes defined by this specification
are described below.&nbsp; For each datatype, the
<termref def="dt-value-space"/> and <termref def="dt-lexical-space"/>
are defined, <termref def="dt-constraining-facet"/>s which apply
to the datatype are listed and any datatypes <termref def="dt-derived"/>
from this datatype are specified.
</p>
<p>
<termref def="dt-primitive"/> datatypes can only be added by revisions
to this specification.
</p>
<div3 role="1.0" id="string">
<head>string</head>
<p>
<termdef id="dt-string" term="string" role="local">The <term>string</term> datatype
represents character strings in XML.&nbsp; The <termref def="dt-value-space"/>
of <term>string</term> is the set of finite-length sequences of
<xtermref href="&xmlspec;#dt-character">character</xtermref>s (as defined in
<bibref ref="XML"/>) that <termref def="dt-match"/> the
<xnt href="&xmlspec;#NT-Char">Char</xnt> production from <bibref ref="XML"/>.
A <xtermref href="&xmlspec;#dt-character">character</xtermref> is an atomic unit of
communication; it is not further specified except to note that every
<xtermref href="&xmlspec;#dt-character">character</xtermref> has a corresponding
Universal Character Set code point, which is an integer.
</termdef>
</p>
<note>
<p>
Many human languages have writing systems that require
child elements for control of aspects such as bidirectional formating or
ruby annotation (see <bibref ref="ruby"/> and Section 8.2.4
<xspecref href="&html4;struct/dirlang.html#h-8.2.4">Overriding the
bidirectional algorithm: the BDO element</xspecref> of <bibref ref="html4"/>).
Thus, <term>string</term>, as a simple type that can contain only
characters but not child elements, is often not suitable for representing text.
In such situations, a complex type that allows mixed content should be considered.
For more information, see Section 5.5
<xspecref href="http://www.w3.org/TR/2001/REC-xmlschema-0-20010502/#textType">Any Element, Any Attribute</xspecref>
of <bibref ref="schema-primer"/>.
</p>
</note>
<note>
<p>
As noted in <compref ref="dc-ordered"/>, the fact that this specification does
not specify an <termref def="dt-order-relation"/> for <termref def="dt-string"/>
does not preclude other applications from treating strings as being ordered.
</p>
</note>
<div4 role="1.0" id="string-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="string-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="boolean">
<head>boolean</head>
<p>
<termdef id="dt-boolean" term="boolean" role="local"><term>boolean</term> has the
<termref def="dt-value-space"/> required to support the mathematical
concept of binary-valued logic: {true, false}.</termdef>
</p>
<div4 role="1.0" id="boolean-lexical-representation">
<head>Lexical representation</head>
<p>
An instance of a datatype that is defined as <termref def="dt-boolean"/>
can have the following legal literals {true, false, 1, 0}.
</p>
</div4>
<div4 role="1.0" id="boolean-canonical-representation">
<head>Canonical representation</head>
<p>
The canonical representation for <term>boolean</term> is the set of
literals {true, false}.
</p>
</div4>
<div4 role="1.0" id="boolean-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="decimal">
<head>decimal</head>

<issue id="RQ-150i" role="1.1">
<p><loc href="&reqs;#composition" target="reqs">RQ-150 (minimum nbr of digits for decimal)</loc></p>
<p>The minimum will be lowered to 16 digits; a health warning
will be added to indicate that optimized implementations of derived
datatypes may exceed the limits of the base, but are not required
to.</p>
</issue>

<p>
<termdef id="dt-decimal" term="decimal" role="local"><term>decimal</term>
represents a subset of the real numbers, which can be represented by decimal numerals.
The <termref def="dt-value-space"/> of <term>decimal</term>
is the set of 
numbers that can be obtained by multiplying an integer by a non-positive
power of ten, i.e., expressible as <emph role="eq">i &times; 10^-n</emph>
where <emph role="eq">i</emph> and <emph role="eq">n</emph> are integers
and <emph role="eq">n >= 0</emph>.
Precision is not reflected in this value space;
the number 2.0 is not distinct from the number 2.00.
The <termref def="dt-order-relation"/> on <term>decimal</term>
is the order relation on real numbers, restricted
to this subset.
</termdef>
</p>
<p>

</p>
<p>

</p>
<note>
<p>
All <termref def="dt-minimally-conforming"/> processors <termref def="dt-must"/>
support decimal numbers with a minimum of 18 decimal digits (i.e., with a
<termref def="dt-totalDigits"/> of 18).&nbsp; However,
<termref def="dt-minimally-conforming"/> processors <termref def="dt-may"/>
set an application-defined limit on the maximum number of decimal digits
they are prepared to support, in which case that application-defined
maximum number <termref def="dt-must"/> be clearly documented.
</p>
</note>
<div4 role="1.0" id="decimal-lexical-representation">
<head>Lexical representation</head>
<p>
<term>decimal</term> has a lexical representation
consisting of a finite-length sequence of decimal digits (#x30-#x39) separated
by a period as a decimal indicator.

An optional leading sign is allowed.
If the sign is omitted, "+" is assumed.&nbsp; Leading and trailing zeroes are optional.
If the fractional part is zero, the period and following zero(es) can
be omitted.
For example: <code>-1.23, 12678967.543233, +100000.00, 210</code>.
</p>
</div4>
<div4 role="1.0" id="decimal-canonical-representation">
<head>Canonical representation</head>
<p>
The canonical representation for <term>decimal</term> is defined by
prohibiting certain options from the
<specref ref="decimal-lexical-representation"/>.&nbsp; Specifically, the preceding
optional "+" sign is prohibited.&nbsp; The decimal point is required. Leading and
trailing zeroes are prohibited subject to the following: there must be at least
one digit to the right and to the left of the decimal point which may be a zero.
</p>
</div4>
<div4 role="1.0" id="decimal-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="decimal-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>

<div3 role="1.0" id="float">
<head>float</head>

<issue id="RQ-1i" role="1.1">
<p><loc href="&reqs;#canonical-float" target="reqs">RQ-1 (canonical representation of float, double)</loc></p>
<p>The description of canonical representations for float and double needs to be cleaned up.</p>
</issue>

<issue id="RQ-140i" role="1.1">
<p><loc href="&reqs;#negative-positive-zero" target="reqs">RQ-140 (positive and negative zero in float and double)</loc></p>
<p>Two zeros will be provided similar to those in precisionDecimal</p>
</issue>

<p>
<termdef id="dt-float" term="float" role="local"><term>float</term>
is patterned after the IEEE single-precision 32-bit floating point type
<bibref ref="ieee754"/>.&nbsp; The basic <termref def="dt-value-space"/> of
<term>float</term> consists of the values
<emph role="eq">m &times; 2^e</emph>, where <emph role="eq">m</emph>
is an integer whose absolute value is less than
<emph role="eq">2^24</emph>, and <emph role="eq">e</emph> is an integer
between -149 and 104, inclusive.&nbsp; In addition to the basic
<termref def="dt-value-space"/> described above, the
<termref def="dt-value-space"/> of <term>float</term> also contains the
following
three
<emph>special values</emph>:

positive and negative infinity and not-a-number
(NaN).
The <termref def="dt-order-relation"/> on <term>float</term>
is: <emph role="eq">x &lt; y iff y - x</emph> is positive
for x and y in the value space.
Positive infinity is greater than all other non-NaN values.
NaN equals itself but is incomparable with (neither greater than nor less than)
any other value in the <termref def="dt-value-space"/>.

</termdef>
</p>

<note>
<p>

"Equality" in this Recommendation is defined to be "identity" (i.e., values that
are identical in the <termref def="dt-value-space"/> are equal and vice versa).
Identity must be used for the few operations that are defined in this Recommendation.
Applications using any of the datatypes defined in this Recommendation may use different
definitions of equality for computational purposes; <bibref ref="ieee754"/>-based computation systems
are examples. Nothing in this Recommendation should be construed as requiring that
such applications use identity as their equality relationship when computing.

</p>

<p>

Any value incomparable with the value used for the four bounding facets
(<termref def="dt-minInclusive"/>, <termref def="dt-maxInclusive"/>,
<termref def="dt-minExclusive"/>, and <termref def="dt-maxExclusive"/>) will be
excluded from the resulting restricted <termref def="dt-value-space"/>. In particular,
when "NaN" is used as a facet value for a bounding facet, since no other
<term>float</term> values are <termref def="dt-comparable"/> with it, the result is a <termref def="dt-value-space"/>
either having NaN as its only member (the inclusive cases) or that is empty
(the exclusive cases). If any other value is used for a bounding facet,
NaN will be excluded from the resulting restricted <termref def="dt-value-space"/>;
to add NaN back in requires union with the NaN-only space.

</p>

<p>

This datatype differs from that of <bibref ref="ieee754"/> in that there is only one
NaN and only one zero. This makes the equality and ordering of values in the data
space differ from that of <bibref ref="ieee754"/> only in that for schema purposes NaN = NaN.

</p>
</note>

<p>
A literal in the <termref def="dt-lexical-space"/> representing a
decimal number <emph role="eq">d</emph> maps to the normalized value
in the <termref def="dt-value-space"/> of <term>float</term> that is
closest to <emph role="eq">d</emph> in the sense defined by
<bibref ref="clinger1990"/>; if <emph role="eq">d</emph> is
exactly halfway between two such values then the even value is chosen.
</p>
<div4 role="1.0" id="float-lexical-representation">
<head>Lexical representation</head>
<p>
<term>float</term> values have a lexical representation
consisting of a mantissa followed, optionally, by the character
"E" or "e", followed by an exponent.&nbsp; The exponent <termref def="dt-must"/>
be an <dtref ref="integer"/>. The mantissa must be a  <dtref ref="decimal"/> number. The representations
for exponent and mantissa must follow the lexical rules for
<dtref ref="integer"/> and <dtref ref="decimal"/>.&nbsp; If the "E" or "e" and
the following exponent are omitted, an exponent value of 0 is assumed.
</p>
<p>
The <emph>special values</emph>

positive
and negative infinity and not-a-number have lexical representations

<code>INF</code>, <code>-INF</code> and
<code>NaN</code>, respectively.

Lexical representations for zero may take a positive or negative sign.

</p>
<p>
For example, <code>-1E4, 1267.43233E12, 12.78e-2, 12</code>
<code>, -0, 0</code>
and <code>INF</code> are all legal literals for <term>float</term>.
</p>
</div4>
<div4 role="1.0" id="float-canonical-representation">
<head>Canonical representation</head>
<p>
The canonical representation for <term>float</term> is defined by
prohibiting certain options from the
<specref ref="float-lexical-representation"/>.&nbsp; Specifically, the exponent
must be indicated by "E".&nbsp; Leading zeroes and the preceding optional "+" sign
are prohibited in the exponent.

If the exponent is zero, it must be indicated by "E0".

For the mantissa, the preceding optional "+" sign is prohibited
and the decimal point is required.

Leading and trailing zeroes are prohibited subject to the following:
number representations must
be normalized such that there is a single digit
which is non-zero
to the left of the decimal point and at least a single digit to the
right of the decimal point

unless the value being represented is zero. The canonical
representation for zero is 0.0E0.
</p>
</div4>
<div4 role="1.0" id="float-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="double">
<head>double</head>
<p>
<termdef id="dt-double" term="double" role="local">The <term>double</term>
datatype
is patterned after the

IEEE double-precision 64-bit floating point
type <bibref ref="ieee754"/>.&nbsp; The basic <termref def="dt-value-space"/>
of <term>double</term> consists of the values
<emph role="eq">m &times; 2^e</emph>, where <emph role="eq">m</emph>
is an integer whose absolute value is less than
<emph role="eq">2^53</emph>, and <emph role="eq">e</emph> is an
integer between -1075 and 970, inclusive.&nbsp; In addition to the basic
<termref def="dt-value-space"/> described above, the
<termref def="dt-value-space"/> of <term>double</term> also contains
the following
three
<emph>special values</emph>:

positive and negative infinity and not-a-number
(NaN).
The <termref def="dt-order-relation"/> on <term>double</term>
is: <emph role="eq">x &lt; y iff y - x</emph> is positive
for x and y in the value space.
Positive infinity is greater than all other non-NaN values.
NaN equals itself but is incomparable with (neither greater than nor less than)
any other value in the <termref def="dt-value-space"/>.

</termdef>
</p>
<note>
<p>

"Equality" in this Recommendation is defined to be "identity" (i.e., values that
are identical in the <termref def="dt-value-space"/> are equal and vice versa).
Identity must be used for the few operations that are defined in this Recommendation.
Applications using any of the datatypes defined in this Recommendation may use different
definitions of equality for computational purposes; <bibref ref="ieee754"/>-based computation systems
are examples. Nothing in this Recommendation should be construed as requiring that
such applications use identity as their equality relationship when computing.

</p>

<p>

Any value incomparable with the value used for the four bounding facets
(<termref def="dt-minInclusive"/>, <termref def="dt-maxInclusive"/>,
<termref def="dt-minExclusive"/>, and <termref def="dt-maxExclusive"/>) will be
excluded from the resulting restricted <termref def="dt-value-space"/>. In particular,
when "NaN" is used as a facet value for a bounding facet, since no other
<term>double</term> values are <termref def="dt-comparable"/> with it, the result is a <termref def="dt-value-space"/>
either having NaN as its only member (the inclusive cases) or that is empty
(the exclusive cases). If any other value is used for a bounding facet,
NaN will be excluded from the resulting restricted <termref def="dt-value-space"/>;
to add NaN back in requires union with the NaN-only space.

</p>

<p>

This datatype differs from that of <bibref ref="ieee754"/> in that there is only one
NaN and only one zero. This makes the equality and ordering of values in the data
space differ from that of <bibref ref="ieee754"/> only in that for schema purposes NaN = NaN.

</p>
</note>
<p>
A literal in the <termref def="dt-lexical-space"/> representing a
decimal number <emph role="eq">d</emph> maps to the normalized value
in the <termref def="dt-value-space"/> of <term>double</term> that is
closest to <emph role="eq">d</emph>; if <emph role="eq">d</emph> is
exactly halfway between two such values then the even value is chosen.
This is the <emph>best approximation</emph> of <emph role="eq">d</emph>
(<bibref ref="clinger1990"/>, <bibref ref="gay1990"/>), which is more
accurate than the mapping required by <bibref ref="ieee754"/>.
</p>
<div4 role="1.0" id="double-lexical-representation">
<head>Lexical representation</head>
<p>
<term>double</term> values have a lexical representation
consisting of a mantissa followed, optionally, by the character "E" or
"e", followed by an exponent.&nbsp; The exponent <termref def="dt-must"/> be
an integer.&nbsp; The mantissa must be a decimal number. The representations
for exponent and mantissa must follow the lexical rules for
<dtref ref="integer"/> and <dtref ref="decimal"/>.&nbsp; If the "E" or "e"
and the following exponent are omitted, an exponent value of 0 is assumed.
</p>
<p>
The <emph>special values</emph>

positive
and negative infinity and not-a-number have lexical representations

<code>INF</code>, <code>-INF</code> and
<code>NaN</code>, respectively.

Lexical representations for zero may take a positive or negative sign.

</p>
<p>
For example, <code>-1E4, 1267.43233E12, 12.78e-2, 12</code>
<code>, -0, 0</code>
and <code>INF</code>
are all legal literals for <term>double</term>.
</p>
</div4>
<div4 role="1.0" id="double-canonical-representation">
<head>Canonical representation</head>
<p>
The canonical representation for <term>double</term> is defined by
prohibiting certain options from the
<specref ref="double-lexical-representation"/>.&nbsp; Specifically, the exponent
must be indicated by "E".&nbsp; Leading zeroes and the preceding optional "+" sign
are prohibited in the exponent.

If the exponent is zero, it must be indicated by "E0".

For the mantissa, the preceding optional "+" sign is prohibited
and the decimal point is required.

Leading and trailing zeroes are prohibited subject to the following:
number representations must
be normalized such that there is a single digit
which is non-zero
to the left of the decimal point and at least a single digit to the
right of the decimal point

unless the value being represented is zero. The canonical
representation for zero is 0.0E0.
</p>
</div4>
<div4 role="1.0" id="double-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<!-- ****************************** BEGIN NEW 1.1 MATERIAL (PRECISIONDECIMAL) ********************************* -->

<div3 id="precisionDecimal" diff="add"><head>precisionDecimal</head>

<issue id="RQ-31i" role="1.1">
<p><loc href="&reqs;#trailing-zeroes" target="reqs">RQ-31 (precisionDecimal)</loc></p>
<p>precisionDecimal has been added.&nbsp; It is possible that precisionDecimal will replace decimal.</p>
</issue>

<issue id="RQ-30i" role="1.1">
<p><loc href="&reqs;#negative-scale" target="reqs">RQ-30 (negative fractionDigits for decimal)</loc></p>
<p>The WG feels that having this capability for precisionDecimal will be adequate.</p>
</issue>

<issue id="RQ-28i" role="1.1">
<p><loc href="&reqs;#scientific-notn" target="reqs">RQ-28 (scientific notation for decimal)</loc></p>
<p>The WG feels that having this capability for precisionDecimal will be adequate.</p>
</issue>

<p><termdef id="dt-precisionDecimal" term="precisionDecimal">The <term>precisionDecimal</term> 
datatype is similar to <dtref ref="decimal"/>, except that each value carries with 
it a precision as well as a numeric value; it also includes special values for positive and
negative infinity and <unusual>not a number</unusual>, and differentiates between <unusual>positive
zero</unusual> and <unusual>negative zero</unusual>.</termdef>  <unusual>Precision</unusual>
is explained in <specref ref="sec-precision"/>.&nbsp; The special values are introduced to
make the datatype correspond closely to <phrase role="UNSURE">decimal datatypes whose definition
is planned for the next revision of IEEE/ANSI 754</phrase>.</p>

<div4><head>Value Space</head>

<defset><head alt="Properties of precisionDecimal Values">Properties of
<dtref ref="precisionDecimal"/> Values</head>

<vpropdef><name id="vp-pd-numVal">numericalValue</name>
<limits>a &decimal;, <pt>positiveInfinity</pt>,
<pt>negativeInfinity</pt> or <pt>notANumber</pt></limits></vpropdef>

<vpropdef><name id="vp-pd-precision">arthmeticPrecision</name>
<limits>an &integer; or <pt>absent</pt>;
<pt>absent</pt> if and only if <pfref ref="vp-pd-numVal"/> is a <dtref ref="constant"/>.</limits></vpropdef>

<vpropdef><name id="vp-pd-sign">sign</name>
<limits><pt>positive</pt>, <pt>negative</pt>, or <pt>absent</pt>;
must be <pt>positive</pt> if <pfref ref="vp-pd-numVal"/>
is positive or <pt>positiveInfinity</pt>, must be <pt>negative</pt>
if <pfref ref="vp-pd-numVal"/> is negative or <pt>negativeInfinity</pt>,
must be <pt>absent</pt> if and only if <pfref ref="vp-pd-numVal"/> is <pt>notANumber</pt></limits></vpropdef>
</defset>

<note><p>The <pfref ref="vp-pd-sign"/> property is redundant except when <pfref ref="vp-pd-numVal"/>
is zero; in other cases, the <pfref ref="vp-pd-sign"/> value is fully determined by the
<pfref ref="vp-pd-numVal"/> value.&nbsp; Code optimization may well make it desirable
to separate out the <pfref ref="vp-pd-sign"/> and the absolute value of the <pfref ref="vp-pd-numVal"/>,
which will make implementation easier, but the verbal descriptions of such things as equality
and order somewhat more complicated.</p></note><note><p>As explained below, the lexical
representation of the <dtref ref="precisionDecimal"/> value object whose <pfref ref="vp-pd-numVal"/>
is <pt>notANumber</pt> is <string>NaN</string>.&nbsp; Accordingly, in English text we
use <mention>NaN</mention> to refer to that value.&nbsp; Similarly we use <mention>INF</mention>
and <mention>&minus;INF</mention> to refer to the two value objects whose <pfref ref="vp-pd-numVal"/>
is <pt>positiveInfinity</pt> and <pt>negativeInfinity</pt>.&nbsp; These three value objects
are also informally called <quote>not-a-number</quote>, <quote>positive infinity</quote>,
and <quote>negative infinity</quote>.</p></note>

<p>Equality and order for <dtref ref="precisionDecimal"/> are defined as follows:
<ulist>
<item><p>Two numerical <dtref ref="precisionDecimal"/> values
are ordered (or equal) as their
<pfref ref="vp-pd-numVal"/> values are ordered (or equal).&nbsp; (This means the two zeros with
a given <pfref ref="vp-pd-precision"/> but different <pfref ref="vp-pd-sign"/> are <emph>equal</emph>;
negative zeros are <emph>not</emph> ordered less than positive zeros.)</p></item>
<item><p>INF is equal only to itself, and is greater than
&minus;INF and all numerical <dtref ref="precisionDecimal"/> values.</p></item>
<item><p>&minus;INF is equal only to itself, and is less than
INF and all numerical <dtref ref="precisionDecimal"/> values.</p></item>
<item><p>NaN is incomparable with all values, <emph>including itself</emph>.</p></item>
</ulist>
</p>

</div4>

<div4><head>Lexical Mapping</head>

<ednote><edtext>The <phrase role="UNSURE">notation constraining</phrase> facet has not yet been written
up.&nbsp; Its effect will be to remove some portions of the lexical mapping.</edtext></ednote>

<p><dtref ref="precisionDecimal"/>'s lexical space is the set of all 
no-decimal-point, decimal, and scientific numerals, 
plus the character strings <string>INF</string>, <string>+INF</string>, <string>-INF</string>,
and <string>NaN</string>.&nbsp; (Lexical representations of numbers 
are traditionally called <quote>numerals</quote>.)&nbsp; The <phrase role="UNSURE">notation
constraining</phrase> facet can remove any one or two of the three subsets of 
numerals, with corresponding reductions in the value space.&nbsp; Using this facet
rather than <compref ref="dc-pattern"/> will change the canonical
mapping to insure that the resulting datatype will still have canonical
representations of all its values.

<defset role="prod"><head>Lexical Space</head>
<prodgroup><prod id="nt-precDecRep"><lhs>precisionDecimalRep</lhs>
<rhs><nt def="nt-noDecNuml"/>&nbsp;| <nt def="nt-decNuml"/>&nbsp;|
<nt def="nt-sciNuml"/>&nbsp;| <nt def="nt-numSpecReps"/></rhs></prod></prodgroup>
</defset>

<defsetsum ref="defs-precDecLexmap"/>

<note><p>Canonical mappings are not used during schema processing.&nbsp; They are provided in this specification for
the benefit of other users of these datatype definitions who may find them useful, and for other specifications
which might find it useful to reference them normatively.</p>
</note>

<defsetsum ref="defs-precDecCanmap"/>
</p>
<!--
<p> <phrase role="UNSURE">The 
characters <string>+</string> and <string>-</string> are <term>sign
characters</term>.&nbsp; A numeral that begins with a sign 
character is <term>signed</term>; one that does not is <term>unsigned</term>; one 
that is either unsigned or begins with <string>-</string> 
is <term>partially-signed</term>.</phrase></p>

<p><term>Mappings to P-numbers</term>For each of the three mappings defined 
below, the mapping to P-numbers maps each numeral <var>R</var> in the 
domain to the P-number whose numerical value is v(<var>R</var>) and whose 
precision is the number of nonredundant digits in <var>R</var>,  
Only zero can have more than one such P-number; see below for the 
mapping adjustment when the numerical value of the P-number is 
zero.</p>

<ednote><edtext>In this domain, leftmost <string>0</string> digits (after the sign character, if any) other 
than the rightmost digit are <term>redundant</term>. The remaining digits 
are <term>nonredundant</term>.&nbsp; Formally (by recursion), for 
<var>s</var><var>d</var><sub><var>n</var></sub>&nbsp;.&nbsp;.&nbsp;.&nbsp;<var>d</var><sub>0</sub>: 
if&nbsp; <var>n</var>&nbsp;&gt;&nbsp;1&nbsp; and <var>d</var><sub><var>n</var></sub> 
is <string>0</string>, then <var>d</var><sub><var>n</var></sub> is 
redundant; if <var>k</var> is strictly between 0 and <var>n</var>, 
<var>d</var><sub><var>k</var></sub> is <string>0</string>, and 
<var>d</var><sub>(<var>k</var>+1)</sub> is redundant, then 
<var>d</var><sub><var>k</var></sub> is redundant; other digits are 
nonredundant.   <br/>In 
numerals <var>s</var><var>I</var><string>.</string><var>F</var> of this 
domain, the <term>redundant</term> digits are those that are redundant in 
<var>I</var><var>F</var>; the <term>nonredundant</term> digits are those that are 
nonredundant in <var>I</var><var>F</var>.&nbsp; (The redundant and 
nonredundant digits in <var>I</var><var>F</var> are defined in 
<phrase role="UNSURE">3.2.<var>x</var>.1.1</phrase>.)   <br/>In 
numerals <var>D</var><var>e</var><var>E</var> of this domain, the 
<term>redundant</term> digits are those that are redundant in either 
<var>D</var> or <var>E</var>; the <term>nonredundant</term> digits are those that 
are nonredundant in <var>D</var>.&nbsp; (The redundant and 
nonredundant digits in <var>D</var> and <var>E</var> are defined in 
<phrase role="UNSURE">3.2.<var>x</var>.1.2</phrase>,  Nonredundant digits in 
<var>E</var> are neither redundant nor nonredundant in 
<var>D</var><var>e</var><var>E</var>,  This simplifies certain related 
definitions.)</edtext></ednote><note><p>Each mapping is one-to-one modulo 
redundant digits (and sign, for aP-number zero and for P-number zeros 
when signedZeros is <pt>false</pt>).</p></note>

-->

</div4>

<div4><head>&CFacet;s</head>

<ednote><edtext>The <phrase role="UNSURE">notation constraining</phrase> facet has not yet been written
up.&nbsp; It's effect will be to remove some portions of the lexical mapping.</edtext></ednote>

<p>precisionDecimal has the following <termref def="dt-constraining-facet">&cfacet;s</termref>:

<ulist>

<item><p>fractionDigits</p></item>

<item><p>minFractionDigits</p></item>

<item><p>totalDigits</p></item>

<item><p>specials</p></item><item><p><phrase role="UNSURE">notation constraining</phrase></p></item>

<item><p>maxInclusive</p></item>

<item><p>maxExclusive</p></item>

<item><p>minInclusive</p></item>

<item><p>minExclusive</p></item>

<item><p>pattern</p></item>

<item><p>whitespace</p></item>

<item><p>eunmeration</p></item>

</ulist></p>
</div4></div3>
 
 <!-- ****************************** END NEW 1.1 MATERIAL (PRECISIONDECIMAL) ********************************* -->
 
 <!-- ********************************** BEGIN NEW 1.1 MATERIAL (DURATION) ************************************* -->
<div3 id="duration">
<head>duration</head>

<p><termdef id="dt-duration" term="duration" role="local"><term>duration</term> 
is a datatype that represents 
durations of time.</termdef>  The concept of duration being 
captured is drawn from those of <bibref ref="ISO8601"/>, specifically <emph>durations 
without fixed endpoints</emph>.&nbsp; For
example, <unusual>15 days</unusual> (whose most common lexical representation
in <dtref ref="duration"/> is 'P15D') is a <dtref ref="duration"/> value; <unusual>15 days 
beginning 12 July 1995</unusual> and <unusual>15 days ending 12 July 1995</unusual> are not.
<dtref ref="duration"/> can provide addition and subtraction operations between <dtref ref="duration"/> values 
and between <dtref ref="duration"/>/<dtref ref="dateTime"/> value pairs, and can be the result of subtracting 
<dtref ref="dateTime"/> values.&nbsp; However, only addition to and subtraction from <dtref ref="dateTime"/> 
is required for XML Schema processing and is defined in <specref ref="adding-durations-to-dateTimes"/></p>

<div4><head>Value Space</head>
<p>Durations can be modeled in at least two ways: as six-property tuples (similar to
the seven-property model used for other date/time datatypes) or as two-property tuples 
(somewhat similar to the alternative one-property timeOnTimeline model especially useful for 
<dtref ref="dateTime"/> order).&nbsp; For 
durations, it is useful to use the latter: <dtref ref="duration"/> values are two-property 
tuples.&nbsp; (Note, however, that the 
six-property model was implicitly used in Schema 1.0.&nbsp; The only effective difference to the user caused 
by this change is in the canonical representations.)&nbsp; See
<specref ref="theSevenPropertyModel"/> for more information on the seven-property model.

<defset><head>Properties of <dtref ref="duration"/> Values</head>
<vpropdef><name id="vp-du-month">month</name><dtref ref="integer"/></vpropdef>
<vpropdef><name id="vp-du-second">second</name><dtref ref="decimal"/>
<limits><termref def="dt-must">Must</termref> not be negative if <vpropref ref="vp-du-month"/> is positive, and <termref def="dt-must"></termref>
not be positive if <vpropref ref="vp-du-month"/> is negative.</limits>
</vpropdef>
</defset>

<dtref ref="duration"/> is partially ordered.&nbsp; Equality and order are defined in terms of that of 
<dtref ref="dateTime"/>, and are determined by adding each <dtref ref="duration"/> value pair 
in turn to the following four  <dtref ref="dateTime"/> values:

<ulist>
<item><p>1696-09-01T00:00:00Z</p></item>
<item><p>1697-02-01T00:00:00Z</p></item>
<item><p>1903-03-01T00:00:00Z</p></item>
<item><p>1903-07-01T00:00:00Z</p></item>
</ulist>

If all four resulting <dtref ref="dateTime"/> value pairs are 
ordered the same way (less than, equal, or greater than), then the 
original pair of <dtref ref="duration"/> values is ordered the same way; otherwise the original pair 
is incomparable.</p>

<note>
<p>These four values are chosen so as to maximize 
the possible differences in results that could occur, such as the difference when adding 
P1M and P30D:&nbsp; 1697-02-01T00:00:00Z&nbsp;+&nbsp;P1M&nbsp;&lt;&nbsp;1697-02-01T00:00:00Z&nbsp;+&nbsp;P30D&nbsp;, 
but&nbsp; 1903-03-01T00:00:00Z&nbsp;+&nbsp;P1M&nbsp;&gt;&nbsp;1903-03-01T00:00:00Z&nbsp;+&nbsp;P30D&nbsp;, so 
that&nbsp; P1M&nbsp;&lt;&gt;&nbsp;P30D&nbsp;.&nbsp; If two <dtref ref="duration"/> values are ordered the same way 
when added to each of these four <dtref ref="dateTime"/> values, they will retain the same order when added 
to <emph>any</emph> other <dtref ref="dateTime"/> values, unless one is within a leap-second and either the other
is also or is the beginning moment of the next second&mdash;in which case, the two results will 
be equal even though the original
<dtref ref="dateTime"/> values were not.&nbsp; Therefore, two <dtref ref="duration"/> values are 
incomparable if and only if they can <emph>ever</emph> result in different orders when added to <emph>any</emph> 
<dtref ref="dateTime"/> value not within a leap-second.</p>

<p>This minor anomaly is the result of having <dtref ref="duration"/> unaware of leap-seconds while the
other date/time primitive datatypes are leap-second aware.</p>
</note>

<p>It turns out that under the definition just given, two <dtref ref="duration"/> 
values are equal if and only if they are identical.</p>

<note><p>Two totally ordered datatypes (<dtref ref="yearMonthDuration"/> and <dtref ref="dayTimeDuration"/>) 
are derived from <dtref ref="duration"/> in <specref ref="built-in-derived"/>.</p></note>

<note><p>There are many ways to implement <dtref ref="duration"/>, some of which do not base the implementation 
on the two-component model.&nbsp; This specification does not prescribe any particular implementation, as long as 
the visible results are isomorphic to those described herein.</p></note>

</div4>

<div4 id="duration-lexical-space"><head>Lexical Space</head>

<p>
The <termref def="dt-lexical-representation">lexical representations</termref> of <dtref ref="duration"/> are 
more or less based on the pattern:
<display><code>P<var>n</var>Y<var>n</var>M<var>n</var>DT<var>n</var>H<var>n</var>M<var>n</var>S</code></display>
</p>
<p>
More precisely, the <termref def="dt-lexical-space"></termref> of <dtref ref="duration"/> is the set of character 
strings that satisfy <nt def="nt-durationRep"/> as defined by the following productions:
<defset><head> Lexical Representation Fragments</head>
<prodgroup>
<prod id="nt-duYrFrag"><lhs>duYearFrag</lhs>
<rhs><nt def="nt-unsNoDecNuml"/>&nbsp;<string>Y</string></rhs></prod>
<prod id="nt-duMoFrag"><lhs>duMonthFrag</lhs>
<rhs><nt def="nt-unsNoDecNuml"/>&nbsp;<string>M</string></rhs></prod>
<prod id="nt-duDaFrag"><lhs>duDayFrag</lhs>
<rhs><nt def="nt-unsNoDecNuml"/>&nbsp;<string>D</string></rhs></prod>
<prod id="nt-duHrFrag"><lhs>duHourFrag</lhs>
<rhs><nt def="nt-unsNoDecNuml"/>&nbsp;<string>H</string></rhs></prod>
<prod id="nt-duMiFrag"><lhs>duMinuteFrag</lhs>
<rhs><nt def="nt-unsNoDecNuml"/>&nbsp;<string>M</string></rhs></prod>
<prod id="nt-duSeFrag"><lhs>duSecondFrag</lhs>
<rhs>(<nt def="nt-unsNoDecNuml"/>&nbsp;|&nbsp;<nt def="nt-unsDecNuml" diff="del"/><nt def="nt-unsFullDecNuml" diff="add"/>)&nbsp;<string>S</string></rhs></prod>

<prod id="nt-duYMFrag"><lhs>duYearMonthFrag</lhs>
<rhs>(<nt def="nt-duYrFrag"/>&nbsp;<nt def="nt-duMoFrag"/>?)&nbsp;| <nt def="nt-duMoFrag"/></rhs></prod>

<prod id="nt-duTFrag"><lhs>duTimeFrag</lhs>
<rhs><string>T</string>&nbsp;((<nt def="nt-duHrFrag"/>&nbsp;<nt def="nt-duMiFrag"/>?&nbsp;<nt def="nt-duSeFrag"/>?)&nbsp;|
(<nt def="nt-duMiFrag"/>&nbsp;<nt def="nt-duSeFrag"/>?)&nbsp;|
<nt def="nt-duSeFrag"/>)</rhs></prod>

<prod id="nt-duDTFrag"><lhs>duDayTimeFrag</lhs>
<rhs>(<nt def="nt-duDaFrag"/>&nbsp;<nt def="nt-duTFrag"/>?)&nbsp;| <nt def="nt-duTFrag"/></rhs></prod>

</prodgroup></defset>

<defset><head>Lexical Representation</head>
<prodgroup>
<prod id="nt-durationRep"><lhs>durationLexicalRep</lhs>
<rhs><string>-</string>?&nbsp;<string>P</string>&nbsp;((<nt def="nt-duYMFrag"/>&nbsp;<nt def="nt-duDTFrag"/>?)&nbsp;|&nbsp;<nt def="nt-duDTFrag"/>)</rhs></prod>
</prodgroup></defset></p>

<p>Thus, a <nt def="nt-durationRep"/> consists of one or more of a <nt def="nt-duYrFrag"/>, 
<nt def="nt-duMoFrag"/>, <nt def="nt-duDaFrag"/>, <nt def="nt-duHrFrag"/>, 
<nt def="nt-duMiFrag"/>, and/or <nt def="nt-duSeFrag"/>, in order, with letters 
<string>P</string> and <string>T</string> (and perhaps a <string>-</string>) where appropriate.</p>

<p>The <nt def="nt-durationRep"/> <phrase diff="add">production </phrase>is equivalent to this regular expression
<display role="shrink"><code>-?P(((([0-9]+Y([0-9]+M)?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>[0-9]+M<ghost>)</ghost>&nbsp;)&nbsp;)(([0-9]+D(T(([0-9]+H([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>[0-9]+M<ghost>)</ghost>&nbsp;([0-9]+(\.[0-9]+)?S)?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>[0-9]+(\.[0-9]+)?S<ghost>)</ghost>&nbsp;)&nbsp;))?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>T(([0-9]+H([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>[0-9]+M<ghost>)</ghost>&nbsp;([0-9]+(\.[0-9]+)?S)?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>[0-9]+(\.[0-9]+)?S<ghost>)</ghost>&nbsp;)&nbsp;)<ghost>)</ghost>&nbsp;)&nbsp;)?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>([0-9]+D(T(([0-9]+H([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>[0-9]+M<ghost>)</ghost>&nbsp;([0-9]+(\.[0-9]+)?S)?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>[0-9]+(\.[0-9]+)?S<ghost>)</ghost>&nbsp;)&nbsp;))?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>T(([0-9]+H([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>[0-9]+M<ghost>)</ghost>&nbsp;([0-9]+(\.[0-9]+)?S)?)|<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<ghost>(</ghost>[0-9]+(\.[0-9]+)?S<ghost>)</ghost>&nbsp;)&nbsp;)<ghost>)</ghost>&nbsp;)&nbsp;<ghost>)</ghost>&nbsp;)&nbsp;)</code></display>
once you delete the 
whitespace.&nbsp; Redundant parehtheses are shown as
<unusual><ghost>ghosts</ghost></unusual>; some find them helpful in reading the expression.)
</p>

<p>The <termref def="dt-lexical-mapping"></termref> for <dtref ref="duration"/><phrase diff="add"> is</phrase> called 
<quote><pfref ref="f-durationMap"/></quote> herein<phrase diff="del">, is defined as  follows:</phrase>.

<defsetsum ref="defs-durationLexmap"/>
</p>

<note diff="add">
<p>Canonical mappings are not used during schema processing.&nbsp; They are provided in this specification
for the benefit of other users of these datatype definitions who may find them useful, and for other specifications
which might find it useful to reference them normatively.</p>
</note>

<p><termref role="the" def="dt-canonical-mapping">The canonical mapping</termref> for
<dtref ref="duration"/><phrase diff="add"> is</phrase> 
called <quote><pfref ref="f-durationCanMap"/></quote> herein<phrase diff="del">,
is defined as  follows:</phrase>.

<defsetsum ref="defs-durationCanmap"/></p>
</div4>

<div4 id="duration-facets"><head>&CFacet;s</head>
<facets/>
</div4>
</div3>
<!-- ********************************** END NEW 1.1 MATERIAL (DURATION) ************************************** -->

<div3 role="1.0" id="dateTime">
<head>dateTime</head>
<p>
<termdef id="dt-dateTime" term="dateTime" role="local">
<term>dateTime</term> values may be viewed as objects with integer-valued
year, month, day, hour and minute properties, a decimal-valued second property,
and a boolean timezoned property.
Each such object also has one decimal-valued
method or computed property, timeOnTimeline, whose value is always a decimal
number; the values are dimensioned in seconds, the integer 0 is
0001-01-01T00:00:00 and the value of timeOnTimeline for other <term>dateTime</term>
values is computed using the Gregorian algorithm as modified for leap-seconds.
The timeOnTimeline values form two related "timelines", one for timezoned
values and one for non-timezoned values.
Each timeline is a copy of the <termref def="dt-value-space"/> of <dtref ref="decimal"/>,
with integers given units of seconds.
</termdef>
</p>

<p>
The <termref def="dt-value-space"/> of
<term>dateTime</term> is closely related to the dates and times described in ISO 8601.
For clarity, the text above specifies a particular origin point for the
timeline.
It should be noted, however, that schema processors need not expose the
timeOnTimeline value to schema users, and there is no requirement that a
timeline-based implementation use the particular origin described here in
its internal representation.
Other interpretations of the <termref def="dt-value-space"/> which lead to the
same results (i.e., are isomorphic) are of course acceptable.
</p>

<p>
All timezoned times are Coordinated Universal Time (<termref def="dt-utc"></termref>, sometimes called
"Greenwich Mean Time"). Other timezones indicated in lexical representations
are converted to <termref def="dt-utc"></termref> during conversion of literals to values.
"Local" or untimezoned times are presumed to be the time in the timezone of some
unspecified locality as prescribed by the appropriate legal authority;
currently there are no legally prescribed timezones which are durations
whose magnitude is greater than 14 hours. The value of each numeric-valued property
(other than timeOnTimeline) is limited to the maximum value within the interval
determined by the next-higher property. For example, the day value can never be 32,
and cannot even be 29 for month 02 and year 2002 (February 2002).
</p>

<note id="year-zero">
 <p>The date and time datatypes described in this recommendation were inspired
by <bibref ref="ISO8601"/>.&nbsp; '0001' is the lexical representation of the year 1 of the Common Era
(1
CE, sometimes written "AD 1" or "1 AD").&nbsp; There is no year 0, and '0000' is not a valid lexical representation. '-0001' is the lexical representation of the year 1 Before
Common Era (1 BCE, sometimes written "1 BC").</p>

 <p>Those using this (1.0) version of this Recommendation to
represent negative years should be aware that the interpretation of lexical
representations beginning with a <code>'-'</code> is likely to change in
subsequent versions.</p>
<p>
 <bibref ref="ISO8601"/>
makes no mention of the year 0; in <bibref ref="ISO8601-1998"/>
the form '0000' was disallowed and this recommendation disallows it as well.
However, <bibref ref="ISO8601-2000"/>, which became available just as we were completing version
1.0, allows the form '0000', representing the year 1 BCE.&nbsp; A number of external commentators
have also suggested that '0000' be
allowed, as the lexical representation for 1 BCE, which is the normal usage in
astronomical contexts.&nbsp; 
 It is the intention of the XML Schema
        Working Group to allow '0000' as a lexical representation in the
        <term>dateTime</term>, <term>date</term>, <term>gYear</term>, and
<term>gYearMonth</term> datatypes in a subsequent version
        of this Recommendation. '0000' will be the lexical representation of 1
BCE (which is a leap year), '-0001' will become the lexical representation of 2
BCE (not 1 BCE as in this (1.0) version), '-0002' of 3 BCE, etc.
</p>

</note>

<note>
 <p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to this datatype as well.</p>
</note>

<div4 role="1.0" id="dateTime-lexical-representation">
<head>Lexical representation</head>

<p>
The <termref def="dt-lexical-space"/> of <term>dateTime</term> consists of
finite-length sequences of characters of the form:
<code>'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?</code>,
where 









</p>
 <ulist>
  <item><p>'-'? <emph>yyyy</emph> is a four-or-more digit optionally negative-signed
numeral that represents the year; if more than four digits, leading zeros
are prohibited, and '0000' is prohibited (see the Note above <specref ref="year-zero"/>; also note that a plus sign is <strong>not</strong> permitted);</p></item>
  <item><p>the remaining '-'s are separators between parts of the date portion;</p></item>
  <item><p>the first <emph>mm</emph> is a two-digit numeral that represents the month;</p></item>
  <item><p><emph>dd</emph> is a two-digit numeral that represents the day;</p></item>
  <item><p>'T' is a separator indicating that time-of-day follows;</p></item>
  <item><p><emph>hh</emph> is a two-digit numeral that represents the hour; '24' is permitted if the
minutes and seconds represented are zero, and the <term>dateTime</term> value so
represented is the first instant of the following day (the hour property of a
<term>dateTime</term> object in the <termref def="dt-value-space"/> cannot have
a value greater than 23);</p></item>
  <item><p>':' is a separator between parts of the time-of-day portion;</p></item>
  <item><p>the second <emph>mm</emph> is a two-digit numeral that represents the minute;</p></item>
  <item><p><emph>ss</emph> is a two-integer-digit numeral that represents the
whole seconds;</p></item>
  <item><p>'.' <emph>s+</emph> (if present) represents the
fractional seconds;</p></item>
  <item><p><emph>zzzzzz</emph> (if present) represents the timezone (as described below).</p></item>
  
 </ulist>
 

<p>
For example, 2002-10-10T12:00:00-05:00 (noon on 10 October 2002, Central Daylight
Savings Time as well as Eastern Standard Time in the U.S.) is 2002-10-10T17:00:00Z,
five hours later than 2002-10-10T12:00:00Z.
</p>

<p>
For further guidance on arithmetic with <term>dateTime</term>s and durations,
see <specref ref="adding-durations-to-dateTimes"/><!--Appendix E-->.
</p>
</div4>

<div4 role="1.0" id="dateTime-canonical-representation">
<head>Canonical representation</head>

<p>
Except for trailing fractional zero digits in the seconds representation,
'24:00:00' time representations, and timezone (for timezoned values), the mapping
from literals to values is one-to-one. Where there is more than
one possible representation, the canonical representation is as follows:

 <ulist>
  <item><p>The 2-digit numeral representing the hour must not be '<code>24</code>';</p></item>
  <item><p>The fractional second string, if present, must not end in '<code>0</code>';</p></item>
  <item><p>for timezoned values, the timezone must be
represented with '<code>Z</code>'
(All timezoned <term>dateTime</term> values are <termref def="dt-utc"></termref>.).</p></item>
 </ulist>
</p>
</div4>

<div4 role="1.0" id="dateTime-timezones">
<head>Timezones</head>

<p>
Timezones are durations with (integer-valued) hour and minute properties
(with the hour magnitude limited to at most 14, and the minute magnitude
limited to at most 59, except that if the hour magnitude is 14, the minute
value must be 0); they may be both positive or both negative.
</p>

<p>
The lexical representation of a timezone is a string of the form:
<code>(('+' | '-') hh ':' mm) | 'Z'</code>,
where</p>
 <ulist>
  <item><p><emph>hh</emph> is a two-digit numeral (with leading zeros as required) that
represents the hours,</p></item>
  <item><p><emph>mm</emph> is a two-digit numeral that represents the minutes,</p></item>
  <item><p>'+' indicates a nonnegative duration,</p></item>
  <item><p>'-' indicates a nonpositive duration.</p></item>
 </ulist>
 <p>The mapping so defined is one-to-one, except that '+00:00', '-00:00', and 'Z'
all represent the same zero-length duration timezone, <termref def="dt-utc"></termref>; 'Z' is its canonical
representation.</p>

<p>
When a timezone is added to a <termref def="dt-utc"></termref> <term>dateTime</term>, the result is the date
and time "in that timezone".&nbsp; For example, 2002-10-10T12:00:00+05:00 is
2002-10-10T07:00:00Z and 2002-10-10T00:00:00+05:00 is 2002-10-09T19:00:00Z.
</p>
</div4>
<!-- end new stuff -->

<div4 role="1.0" id="dateTime-order">
<head>Order relation on dateTime</head>
<p>
<term>dateTime</term> value objects on either timeline are totally ordered by their timeOnTimeline
values; between the two timelines, <term>dateTime</term> value objects are ordered by their
timeOnTimeline values when their timeOnTimeline values differ by more than
fourteen hours, with those whose difference is a duration of 14 hours or less
being incomparable.
</p>

<p>
In general, the <termref def="dt-order-relation"/> on <term>dateTime</term>
is a partial order since there is no determinate relationship between certain
instants. For example, there is no determinate
ordering between
(a)
2000-01-20T12:00:00 and (b) 2000-01-20T12:00:00<strong>Z</strong>. Based on
timezones currently in use, (c) could vary from 2000-01-20T12:00:00+12:00 to
2000-01-20T12:00:00-13:00. It is, however, possible for this range to expand or
contract in the future, based on local laws. Because of this, the following
definition uses a somewhat broader range of indeterminate values: +14:00..-14:00.</p>
<p>The following definition uses the notation S[year] to represent the year
field of S, S[month] to represent the month field, and so on. The notation (Q
&amp; &quot;-14:00&quot;) means adding the timezone -14:00 to Q, where Q did not
already have a timezone. <emph>This is a logical explanation of the process. Actual
implementations are free to optimize as long as they produce the same results.</emph>
</p>
<p>
The ordering between two <term>dateTime</term>s P and Q is defined by the following
algorithm:
</p>
  <p>A.Normalize P and Q. That is, if there is a timezone present, but
  it is not Z, convert it to Z using the addition operation defined in
  <specref ref="adding-durations-to-dateTimes"/></p>
  <ulist>
    <item><p>Thus 2000-03-04T23:00:00+03:00 normalizes to 2000-03-04T20:00:00Z</p></item>
  </ulist>
  <p>B. If P and Q either both have a time zone or both do not have a time
   zone, compare P and Q field by field from the year field down to the
   second field, and return a result as soon as it can be determined. That is:</p>
  <olist>
    <item><p>For each i in {year, month, day, hour, minute, second}
      <olist>
        <item><p>If P[i] and Q[i] are both not specified, continue to the next i</p></item>
        <item><p>If P[i] is not specified and Q[i] is, or vice versa, stop and return
          P &lt;&gt; Q</p></item>
        <item><p>If P[i] &lt; Q[i], stop and return P &lt; Q</p></item>
        <item><p>If P[i] &gt; Q[i], stop and return P &gt; Q</p></item>
      </olist>
	</p>
    </item>
    <item><p>Stop and return P = Q</p></item>
  </olist>
  <p>C.Otherwise, if P contains a time zone and Q does not, compare
  as follows:
 </p>
    <olist>
      <item><p>P &lt; Q if P &lt; (Q with time zone +14:00)</p></item>
      <item><p>P > Q if P > (Q with time zone -14:00)</p></item>
      <item><p>P &lt;> Q otherwise, that is, if (Q with time zone +14:00) &lt; P &lt; (Q with time zone -14:00)</p></item>
     </olist>
   <p>D. Otherwise, if P does not contain a time zone and Q does, compare
  as follows:</p>
    <olist>
      <item><p> P &lt; Q if (P with time zone -14:00) &lt; Q.</p></item>
      <item><p> P &gt; Q if (P with time zone +14:00) &gt; Q.</p></item>
      <item><p> P &lt;> Q otherwise, that is, if (P with time zone +14:00) &lt; Q &lt; (P with time zone -14:00)</p></item>
    </olist>
<p>Examples:</p>
    <table border="1" cellspacing="0" cellpadding="4">
	<tbody>
      <tr>
        <th align="center" style="background-color: #FFFF99">Determinate</th>
        <th align="center" style="background-color: #FFFF99">Indeterminate</th>
      </tr>
      <tr>
        <td align="center">2000-01-15T00:00:00 <strong>&lt;</strong> 2000-02-15T00:00:00</td>
        <td align="center">2000-01-01T12:00:00 <strong>&lt;&gt;</strong>
          1999-12-31T23:00:00Z</td>
      </tr>
      <tr>
        <td align="center">2000-01-15T12:00:00 <strong>&lt;</strong> 2000-01-16T12:00:00Z</td>
        <td align="center">2000-01-16T12:00:00 <strong>&lt;&gt;</strong>
          2000-01-16T12:00:00Z</td>
      </tr>
      <tr>
        <td align="center">&nbsp;</td>
        <td align="center">2000-01-16T00:00:00 <strong>&lt;&gt;</strong> 2000-01-16T12:00:00Z</td>
      </tr>
      </tbody>
    </table>
</div4>
<div4 role="1.0" id="totally-ordered-instants">
<head>Totally ordered dateTimes</head>
<p>Certain derived types from <term>dateTime</term>
can be guaranteed have a total order. To
do so, they must require that a specific set of fields are always specified, and
that remaining fields (if any) are always unspecified. For example, the date
datatype without time zone is defined to contain exactly year, month, and day.
Thus dates without time zone have a total order among themselves.</p>
</div4>
<div4 role="1.0" id="dateTime-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<div3 role="1.0" id="time">
<head>time</head>
<p>
<termdef id="dt-time" term="time" role="local"><term>time</term>
represents an instant of time that recurs every day.&nbsp; The
<termref def="dt-value-space"/> of <term>time</term> is the space
of <emph>time of day</emph> values as defined in &sect; 5.3 of
<bibref ref="ISO8601"/>.&nbsp; Specifically, it is a set of zero-duration daily
time instances.</termdef>
</p>
<p>
Since the lexical representation allows an optional time zone
indicator, <term>time</term> values are partially ordered because it may
not be able to determine the order of two values one of which has a
time zone and the other does not.&nbsp; The order relation on
<term>time</term> values is the
<specref ref="dateTime-order"/> using an arbitrary date. See also
<specref ref="adding-durations-to-dateTimes"/>.&nbsp; Pairs of <term>time</term> values with or without time zone indicators are totally ordered.
</p>
 <note>
 <p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the seconds part of this datatype as well.</p>
</note>
<div4 role="1.0" id="time-lexical-repr">
<head>Lexical representation</head>
<p>
The lexical representation for <term>time</term> is the left
truncated lexical representation for <dtref ref="dateTime"/>:
hh:mm:ss.sss with optional following time zone indicator.&nbsp; For example,
to indicate 1:20 pm for Eastern Standard Time which is 5 hours behind
Coordinated Universal Time (<termref def="dt-utc"></termref>), one would write: 13:20:00-05:00. See also
<specref ref="isoformats"/>.
</p>
</div4>
<div4 role="1.0" id="time-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>time</term> is defined
by prohibiting certain options from the
<specref ref="time-lexical-repr"/>.&nbsp; Specifically, either the time zone must
be omitted or, if present,  the time zone must be Coordinated Universal
Time (<termref def="dt-utc"></termref>) indicated by a "Z".
Additionally, the canonical representation for midnight is 00:00:00.
</p>
</div4>
<div4 role="1.0" id="time-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<div3 role="1.0" id="date">
<head>date</head>
<p>
<termdef id="dt-date" term="date" role="local">
The <termref def="dt-value-space"/> of <term>date</term>
consists of top-open intervals of exactly one day in length on the timelines of
<dtref ref="dateTime"/>, beginning on the beginning moment of each day (in
each timezone), i.e. '00:00:00', up to but not including '24:00:00' (which is
identical with '00:00:00' of the next day).&nbsp; For nontimezoned values, the top-open
intervals disjointly cover the nontimezoned timeline, one per day.&nbsp; For timezoned
values, the intervals begin at every minute and therefore overlap.
</termdef>
</p>

<p>
A "date object" is an object with year, month, and day properties just like those
of <dtref ref="dateTime"/> objects, plus an optional <emph>timezone-valued</emph>
timezone property. (As with values of <dtref ref="dateTime"/> timezones are a
special case of durations.)
Just as a <dtref ref="dateTime"/> object corresponds to a point on one of the
timelines, a <term>date</term> object corresponds to an interval on one
of the two timelines as just described.
</p>

<p>
Timezoned <term>date</term> values track the starting moment of their day, as
determined by their timezone; said timezone is generally recoverable for
canonical representations.
<termdef id="recoverable-timezone" term="recoverable timezone" role="local">
The <term>recoverable timezone</term> is that duration which
is the result of subtracting the first moment (or any moment) of the timezoned
<term>date</term> from the first moment (or the corresponding moment) <termref def="dt-utc"></termref> on the
same <term>date</term>.</termdef>  <termref def="recoverable-timezone"/>s are
always durations between '+12:00' and '-11:59'.&nbsp; This "timezone normalization"
(which follows automatically from the definition of the <term>date</term>
<termref def="dt-value-space"/>) is explained more in
<specref ref="date-lexical-representation"/>.
</p>

<p>
For example: the first moment of 2002-10-10+13:00 is 2002-10-10T00:00:00+13,
which is 2002-10-09T11:00:00Z, which is also the first moment of 2002-10-09-11:00.
Therefore 2002-10-10+13:00 is 2002-10-09-11:00; <emph>they are the same interval</emph>.
</p>

<note>
<p>
For most timezones, either the first moment or last moment of the day (a
<dtref ref="dateTime"/> value, always <termref def="dt-utc"></termref>) will have a <term>date</term> portion
different from that of the <term>date</term> itself!
However, noon of that <term>date</term> (the midpoint of the interval) in that
(normalized) timezone will always have the same <term>date</term> portion as the
<term>date</term> itself, even when that noon point in time is normalized to
<termref def="dt-utc"></termref>.&nbsp; For example, 2002-10-10-05:00 begins during 2002-10-09Z and 2002-10-10+05:00
ends during 2002-10-11Z, but noon of both 2002-10-10-05:00 and 2002-10-10+05:00
falls in the interval which is 2002-10-10Z.
</p>
</note>
<note>
 <p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the year part of this datatype as well.</p>
</note>
<div4 role="1.0" id="date-lexical-representation">
<head>Lexical representation</head>

<p>
For the following discussion, let the "date portion" of a <dtref ref="dateTime"/>
or <term>date</term> object be an object similar to a <dtref ref="dateTime"/> or
<term>date</term> object, with similar year, month, and day properties, but no
others, having the same value for these properties as the original
<dtref ref="dateTime"/> or <term>date</term> object.
</p>

<p>
The <termref def="dt-lexical-space"/> of <term>date</term> consists of finite-length
sequences of characters of the form:
<code>'-'? yyyy '-' mm '-' dd zzzzzz?</code>
where the <term>date</term> and optional timezone are represented exactly the
same way as they are for <dtref ref="dateTime"/>.&nbsp; The first moment of the
interval is that represented by:
<code>'-' yyyy '-' mm '-' dd 'T00:00:00' zzzzzz?</code>
and the least upper bound of the interval is the timeline point represented
(noncanonically) by:
<code>'-' yyyy '-' mm '-' dd 'T24:00:00' zzzzzz?</code>.
</p>

<note>
<p>
The <termref def="recoverable-timezone"/> of a <term>date</term> will always be
a duration between '+12:00' and '11:59'.&nbsp; Timezone lexical representations, as
explained for <dtref ref="dateTime"/>, can range from '+14:00' to '-14:00'.
The result is that literals of <term>date</term>s with very large or very
negative timezones will map to a "normalized" <term>date</term> value with a
<termref def="recoverable-timezone"/> different from that represented in the original
representation, and a matching difference of +/- 1 day in the <term>date</term> itself.
</p>
</note>
</div4>

<div4 role="1.0" id="date-canonical-representation">
<head>Canonical representation</head>

<p>
Given a member of the <term>date</term> <termref def="dt-value-space"/>, the
<term>date</term> portion of the canonical representation (the entire representation
for nontimezoned values, and all but the timezone representation for timezoned values)
is always the <term>date</term> portion of the <dtref ref="dateTime"/> canonical
representation of the interval midpoint (the <dtref ref="dateTime"/> representation,
truncated on the right to eliminate 'T' and all following characters).
For timezoned values, append the canonical representation of the <termref def="recoverable-timezone"/>.
</p>
</div4>
</div3>

<div3 role="1.0" id="gYearMonth">
<head>gYearMonth</head>
<p>
<termdef id="dt-gYearMonth" term="gYearMonth" role="local">
<term>gYearMonth</term> represents a
specific gregorian month in a specific gregorian year.&nbsp; The
<termref def="dt-value-space"/> of <term>gYearMonth</term>
is the set of Gregorian calendar months as defined in &sect; 5.2.1 of
<bibref ref="ISO8601"/>.&nbsp; Specifically, it is a set of one-month long,
non-periodic instances
e.g. 1999-10 to represent the whole month of 1999-10, independent of
how many days this month has.
</termdef>
</p>
<p>
Since the lexical representation allows an optional time zone
indicator, <term>gYearMonth</term> values are partially ordered because it may
not be possible to unequivocally determine the order of two values one of
which has a time zone and the other does not.&nbsp; If <term>gYearMonth</term>
values are considered as periods of time, the order relation on
<term>gYearMonth</term> values is the order relation on their starting instants.
This is discussed in <specref ref="dateTime-order"/>.&nbsp; See also
<specref ref="adding-durations-to-dateTimes"/>.&nbsp; Pairs of <term>gYearMonth</term>
values with or without time zone indicators are totally ordered.
</p>
<note>
<p>
Because month/year combinations in one calendar only rarely correspond
to month/year combinations in other calendars, values of this type
are not, in general, convertible to simple values corresponding to month/year
combinations in other calendars.&nbsp; This type should therefore be used with caution
in contexts where conversion to other calendars is desired.
</p>
</note>
 <note>
 <p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the year part of this datatype as well.</p>
</note>
<div4 role="1.0" id="gYearMonth-lexical-repr">
<head>Lexical representation</head>
<p>
The lexical representation for <term>gYearMonth</term> is the reduced
(right truncated) lexical representation for <dtref ref="dateTime"/>:
CCYY-MM.&nbsp; No left truncation is allowed.&nbsp; An optional following time
zone qualifier is allowed.&nbsp; To accommodate year values outside the range from 0001 to 9999, additional digits
can be added to the left of this representation and a preceding "-" sign is allowed.
</p>
<p>
For example, to indicate the month of May 1999, one would write: 1999-05.
See also <specref ref="isoformats"/>.
</p>
</div4>

<div4 role="1.0" id="gYearMonth-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<div3 role="1.0" id="gYear">
<head>gYear</head>
<p>
<termdef id="dt-gYear" term="gYear" role="local">
<term>gYear</term> represents a
gregorian calendar year.&nbsp; The <termref def="dt-value-space"/> of
<term>gYear</term> is the set of Gregorian calendar years as defined in
&sect; 5.2.1 of <bibref ref="ISO8601"/>. Specifically, it is a set of one-year
long, non-periodic instances
e.g. lexical 1999 to represent the whole year 1999, independent of
how many months and days this year has.
</termdef>
</p>
<p>
Since the lexical representation allows an optional time zone
indicator, <term>gYear</term> values are partially ordered because it may
not be possible to unequivocally determine the order of two values one of which has a
time zone and the other does not.&nbsp; If
<term>gYear</term> values are considered as periods of time, the order relation
on <term>gYear</term> values is the order relation on their starting instants.
This is discussed in <specref ref="dateTime-order"/>.&nbsp; See also
<specref ref="adding-durations-to-dateTimes"/>.&nbsp; Pairs of <term>gYear</term> values with or without time zone indicators are totally ordered.
</p>
<note>
<p>
Because years in one calendar only rarely correspond to years
in other calendars, values of this type
are not, in general, convertible to simple values corresponding to years
in other calendars.&nbsp; This type should therefore be used with caution
in contexts where conversion to other calendars is desired.
</p>
</note>
 <note>
 <p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the year part of this datatype as well.</p>
</note>
<div4 role="1.0" id="gYear-lexical-repr">
<head>Lexical representation</head>
<p>
The lexical representation for <term>gYear</term> is the reduced (right
truncated) lexical representation for <dtref ref="dateTime"/>: CCYY.
No left truncation is allowed.&nbsp; An optional following time
zone qualifier is allowed as for <dtref ref="dateTime"/>.&nbsp;  To
accommodate year values outside the range from 0001 to 9999, additional
digits can be added to the left of this representation and a preceding
"-" sign is allowed.
</p>
<p>
For example, to indicate 1999, one would write: 1999.
See also <specref ref="isoformats"/>.
</p>
</div4>

<div4 role="1.0" id="gYear-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<div3 role="1.0" id="gMonthDay">
<head>gMonthDay</head>
<p>
<termdef id="dt-gMonthDay" term="gMonthDay" role="local">
<term>gMonthDay</term> is a gregorian date that recurs, specifically a day of
the year such as the third of May.&nbsp; Arbitrary recurring dates are not
supported by this datatype.&nbsp; The <termref def="dt-value-space"/> of
<term>gMonthDay</term> is the set of <emph>calendar
dates</emph>, as defined in &sect; 3 of <bibref ref="ISO8601"/>.&nbsp; Specifically,
it is a set of one-day long, annually periodic instances.
</termdef>
</p>
<p>
Since the lexical representation allows an optional time zone
indicator, <term>gMonthDay</term> values are partially ordered because it may
not be possible to unequivocally determine the order of two values one of which has a
time zone and the other does not.&nbsp; If
<term>gMonthDay</term> values are considered as periods of time,
in an arbitrary leap year, the order relation
on <term>gMonthDay</term> values is the order relation on their starting instants.
This is discussed in <specref ref="dateTime-order"/>.&nbsp; See also
<specref ref="adding-durations-to-dateTimes"/>.&nbsp; Pairs of <term>gMonthDay</term> values with or without time zone indicators are totally ordered.
</p>
<note>
<p>
Because day/month combinations in one calendar only rarely correspond
to day/month combinations in other calendars, values of this type do not,
in general, have any straightforward or intuitive representation
in terms of most other calendars. This type should therefore be
used with caution in contexts where conversion to other calendars
is desired.
</p>
</note>
<div4 role="1.0" id="gMonthDay-lexical-repr">
<head>Lexical representation</head>
<p>
The lexical representation for <term>gMonthDay</term> is the left
truncated lexical representation for <dtref ref="date"/>: --MM-DD.
An optional following time
zone qualifier is allowed as for <dtref ref="date"/>.
No preceding sign is allowed.&nbsp; No other formats are allowed. See also <specref ref="isoformats"/>.
</p>
<p>This datatype can be used to represent a specific day in a month.
To say, for example, that my birthday occurs on the 14th of September ever year.
</p>
</div4>

<div4 role="1.0" id="gMonthDay-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<!-- ********************************** START REVISED 1.1 MATERIAL (GDAY) ************************************* -->

<div3 id="gDay">
<head>gDay</head>
<p diff="del">
<termdef id="dt-gDay-delled" term="gDay" role="local">
<term>gDay</term> is a gregorian day that recurs, specifically a day
of the month such as the 5th of the month.&nbsp; Arbitrary recurring days
are not supported by this datatype.&nbsp; The <termref def="dt-value-space"/>
of <term>gDay</term> is the space of a set of <emph>calendar
dates</emph> as defined in &sect; 3 of <bibref ref="ISO8601"/>.&nbsp; Specifically,
it is a set of one-day long, monthly periodic instances.
</termdef>
</p>
<p><termdef diff="add" id="dt-gday" role="local" term="dDay"><term>gDay</term> is a datatype 
that represents whole days within an arbitrary month&mdash;days that recur at the same
point in each (Gregorian) month.</termdef>  This datatype <phrase diff="del">can
be</phrase><phrase diff="add">is</phrase> used to represent a specific day of the month.
To <phrase diff="add"><phrase diff="del">say, for example, that I get my paycheck</phrase>indicate, for example, that an employee gets a paycheck</phrase> on the 15th of each month.&nbsp; <phrase diff="add">(Obviously, days
beyond 28 cannot occur in <emph>all</emph> months; they are nonetheless permitted, up to 31.)</phrase></p>

<p diff="del">
Since the lexical representation allows an optional time zone
indicator, <term>gDay</term> values are partially ordered because it may
not be possible to unequivocally determine the order of two values one of
which has a time zone and the other does not.&nbsp; If
<term>gDay</term> values are considered as periods of time,
<phrase>in an arbitrary month that has 31 days,</phrase>
the order relation
on <term>gDay</term> values is the order relation on their starting instants.
This is discussed in <specref ref="dateTime-order"/>.&nbsp; See also
<specref ref="adding-durations-to-dateTimes"/>.&nbsp; Pairs of <term>gDay</term>
values with or without time zone indicators are totally ordered.
</p>

<note><p>
Because days in one calendar only rarely correspond
to days in other calendars, <phrase diff="add"><term>gday</term> </phrase>values<phrase diff="del"> of this type</phrase> do not,
in general, have any straightforward or intuitive representation
in terms of most <phrase diff="del">other</phrase><phrase diff="add">non-Gregorian</phrase> calendars. <phrase diff="del"> This type</phrase><phrase diff="add"><term>gday</term></phrase> should therefore be
used with caution in contexts where conversion to other calendars
is desired.</p></note>

<div4><head>Value Space</head>
<p><dtref ref="gDay"/> uses the <dtref ref="dt-dt-7PropMod"/>, with
<pfref ref="vp-dt-year"/>, <pfref ref="vp-dt-month"/>, <pfref ref="vp-dt-hour"/>, <pfref ref="vp-dt-minute"/>,
and <pfref ref="vp-dt-second"/> required to be <pt>absent</pt>.&nbsp; <pfref ref="vp-dt-timezone"/> remains
<termref def="dt-optional"></termref> and <pfref ref="vp-dt-day"/> must be between 1 and 31 inclusive.</p>

<issue id="RQ-13i" role="1.1">
<p><loc href="&reqs;#time" target="reqs">RQ-13 (time zone crosses date line)</loc></p>
<p>The "seven property model" rewrite of date/time datatype descriptions includes a carefully crafted definition of order
that insures that for repeating datatypes (time, gDay, etc.), timezoned values will be compared as though they are on the same "calendar day" ("raw"
property values) so that in any given timezone, the days start at "raw" 00:00:00 and end not quite including "raw" 24:00:00.  Days are not
00:00:00Z to 24:00:00Z in timezones other than Z.</p>
</issue>

<p>Equality and order are as prescribed in <specref ref="theSevenPropertyModel"/>.&nbsp; Since <dtref ref="gDay"/>
values (days) are ordered by their first moments, it is possible
for apparent anomalies to appear in the order when <pfref ref="vp-dt-timezone"/> values are differ by at least 24
hours.&nbsp; (It is possible for <pfref ref="vp-dt-timezone"/> values to differ by up to 28 hours.)</p>
<p>
Examples that may appear anomalous (see <specref ref="gDay-lexical-mapping"/> for the notations):
<ulist>
<item><p>---15&nbsp;&lt;&nbsp;---16&nbsp;, but&nbsp; ---15&minus;13:00&nbsp;&gt;&nbsp;---16+13:00</p></item>
<item><p>---15&minus;11:00&nbsp;=&nbsp;---16+13:00</p></item>
<item><p>---15&minus;13:00&nbsp;&lt;&gt;&nbsp;---16&nbsp;,
because&nbsp; ---15&minus;13:00&nbsp;&gt;&nbsp;---16+14:00&nbsp;
and ---15&minus;13:00&nbsp;&lt;&nbsp;16&minus;14:00</p></item>
</ulist>
</p>
<note><p>Timezones do not cause wrap-around at the end of the month:  ---31&minus;13:00 in
one month may start after ---01+13:00 in the <emph>next</emph> month, but nonetheless&nbsp;
---01+13:00&nbsp;&lt;&nbsp;---31&minus;13:00&nbsp;.</p></note>
</div4>

<div4 id="gDay-lexical-repr" diff="del">
<head>Lexical representation</head>
<p>
The lexical representation for <term>gDay</term> is the left
truncated lexical representation for <dtref ref="date"/>: ---DD .
An optional following time
zone qualifier is allowed as for <dtref ref="date"/>.&nbsp; No preceding sign is
allowed. No other formats are allowed.&nbsp; See also <specref ref="isoformats"/>.
</p>
</div4>

<div4 id="gDay-lexical-mapping" diff="add">
<head>Lexical Mappings</head>
<p>
The lexical representations for <dtref ref="gDay"/> are <unusual>restrictions</unusual> of 
those of <dtref ref="dateTime"/>, as follows:

<defset><head>Lexical Space</head>
<prod id="nt-gDayRep"><lhs>gDayLexicalRep</lhs>
<rhs><string>---</string>&nbsp;<nt def="nt-daFrag"/>&nbsp;<nt def="nt-tzFrag"/>?</rhs></prod></defset>

The <nt def="nt-gDayRep"/> is equivalent to this regular expression:
<display role="shrinkx"><code>---([0-2][0-9]|3[01])((+|-)(0[0-9]|1[0-4]):[0-5][0-9])?</code></display>
</p>
<p>The lexical mapping and canonical mapping for <dtref ref="gDay"/> are defined as follows:

<defsetsum ref="defs-gDayLexmap"/>

<defsetsum ref="defs-gDayCanmap"/>

</p>
</div4>

<div4 id="gDay-facets">
<head>&CFacet;s</head>
<facets/>
</div4>
</div3>

<!-- ********************************** END REVISED 1.1 MATERIAL (GDAY) ************************************* -->

<div3 role="1.0" id="gMonth">
<head>gMonth</head>
<p>
<termdef id="dt-gMonth" term="gMonth" role="local">
<term>gMonth</term> is a gregorian month that recurs every year.
The <termref def="dt-value-space"/>
of <term>gMonth</term> is the space of a set of <emph>calendar
months</emph> as defined in &sect; 3 of <bibref ref="ISO8601"/>.&nbsp; Specifically,
it is a set of one-month long, yearly periodic instances.
</termdef>
</p>
<p>
This datatype can be used to represent a specific month.
To say, for example, that Thanksgiving falls in the month of November.
</p>
<p>
Since the lexical representation allows an optional time zone
indicator, <term>gMonth</term> values are partially ordered because it may
not be possible to unequivocally determine the order of two values one of which has a
time zone and the other does not.&nbsp; If
<term>gMonth</term> values are considered as periods of time, the order relation
on <term>gMonth</term> is the order relation on their starting instants.
This is discussed in <specref ref="dateTime-order"/>.&nbsp; See also
<specref ref="adding-durations-to-dateTimes"/>.&nbsp; Pairs of <term>gMonth</term>
values with or without time zone indicators are totally ordered.
</p>
<note>
<p>
Because months in one calendar only rarely correspond
to months in other calendars, values of this type do not,
in general, have any straightforward or intuitive representation
in terms of most other calendars. This type should therefore be
used with caution in contexts where conversion to other calendars
is desired.
</p>
</note>
<div4 role="1.0" id="gMonth-lexical-repr">
<head>Lexical representation</head>
<p>
The lexical representation for <term>gMonth</term> is the left
and right truncated lexical representation for <dtref ref="date"/>: --MM.
An optional following time
zone qualifier is allowed as for <dtref ref="date"/>.&nbsp; No preceding sign is
allowed. No other formats are allowed.&nbsp; See also <specref ref="isoformats"/>.
</p>
</div4>

<div4 role="1.0" id="gMonth-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="hexBinary">
<head>hexBinary</head>
<p>
<termdef id="dt-hexBinary" term="hexBinary" role="local">
<term>hexBinary</term> represents
arbitrary hex-encoded binary data.&nbsp; The <termref def="dt-value-space"/> of
<term>hexBinary</term> is the set of finite-length sequences of binary
octets.
</termdef>
</p>
<div4 role="1.0" id="hexBinary-lexical-representation">
<head>Lexical Representation</head>
<p>
<term>hexBinary</term> has a lexical representation where
each binary octet is encoded as a character tuple, consisting of two
hexadecimal digits ([0-9a-fA-F]) representing the octet code. For example,
"0FB7" is a <emph>hex</emph> encoding for the 16-bit integer 4023
(whose binary representation is 111110110111).
</p>
</div4>
<div4 role="1.0" id="hexBinary-canonical-repr">
<head>Canonical Representation</head>
<p>
The canonical representation for <term>hexBinary</term> is defined
by prohibiting certain options from the
<specref ref="hexBinary-lexical-representation"/>.&nbsp; Specifically, the lower case
hexadecimal digits ([a-f]) are not allowed.
</p>
</div4>
<div4 role="1.0" id="hexBinary-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="base64Binary">
<head>base64Binary</head>
<p>
<termdef id="dt-base64Binary" term="base64Binary" role="local">
<term>base64Binary</term>
represents Base64-encoded arbitrary binary data.&nbsp; The <termref def="dt-value-space"/> of
<term>base64Binary</term> is the set of finite-length sequences of binary
octets. For <term>base64Binary</term> data the
entire binary stream is encoded using the Base64

Alphabet in
<bibref ref="RFC2045"/>.
</termdef>
</p>
<p>
The lexical forms of <term>base64Binary</term> values are limited to the 65 characters
of the Base64 Alphabet defined in <bibref ref="RFC2045"/>, i.e., <code>a-z</code>,
<code>A-Z</code>, <code>0-9</code>, the plus sign (+), the forward slash (/) and the
equal sign (=), together with the characters defined in <bibref ref="XML"/> as white space.
No other characters are allowed.
</p>
<p>
For compatibility with older mail gateways, <bibref ref="RFC2045"/> suggests that
base64 data should have lines limited to at most 76 characters in length.&nbsp; This
line-length limitation is not mandated in the lexical forms of <term>base64Binary</term>
data and must not be enforced by XML Schema processors.
</p>
<p>
The lexical space of <term>base64Binary</term> is given by the following grammar
(the notation is that used in <bibref ref="XML"/>); legal lexical forms must match
the <term>Base64Binary</term> production.
</p>
<p>
<code>Base64Binary&nbsp;&nbsp;::=&nbsp;&nbsp;((B64S B64S B64S B64S)*<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((B64S B64S B64S B64) |<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(B64S B64S B16S '=') |<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(B64S B04S '=' #x20? '=')))?<br/><br/>B64S &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::= B64 #x20?<br/><br/>
B16S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::= B16 #x20?<br/><br/>
B04S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::= B04 #x20?</code>
<code>
<br/><br/>
B04&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;[AQgw]<br/>
B16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;[AEIMQUYcgkosw048]<br/>
B64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;[A-Za-z0-9+/]
</code>
</p>
<p>
Note that this grammar requires the number of non-whitespace characters in the lexical
form to be a multiple of four, and for equals signs to appear only at the end of the
lexical form; strings which do not meet these constraints are not legal lexical forms
of <term>base64Binary</term> because they cannot successfully be decoded by base64
decoders.
</p>
 <note>
<p>The above definition of the lexical space is more restrictive than that
given in <bibref ref="RFC2045"/> as regards whitespace -- this is not an issue
in practice.&nbsp; Any string compatible with the RFC can occur in
	    an element or attribute validated by this type, because the <termref def="dt-whiteSpace"/> facet of this type is fixed
to <pt>collapse</pt>, which means that all leading and trailing whitespace
will be stripped, and all internal whitespace collapsed to single space
characters, <emph>before</emph> the above grammar is enforced.</p>
</note>
<p>
The canonical lexical form of a <term>base64Binary</term> data value is the base64
encoding of the value which matches the Canonical-base64Binary production in the following
grammar:
</p>
<p>
<code>Canonical-base64Binary&nbsp;&nbsp;::=&nbsp;&nbsp;(B64
B64 B64 B64)*<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((B64 B64 B16 '=') | (B64 B04 '=='))?</code>
</p>
 <note>
  <p>For some values the canonical form defined above does not conform to
<bibref ref="RFC2045"/>, which requires
breaking with linefeeds at appropriate intervals.</p>
 </note>
<p>
The length of a <term>base64Binary</term> value is the number of octets it contains.
This may be calculated from the lexical form by removing whitespace and padding characters
and performing the calculation shown in the pseudo-code below:
</p>
<p>
<code>
lex2&nbsp;&nbsp;&nbsp;&nbsp;:=&nbsp;killwhitespace(lexform)&nbsp;&nbsp;&nbsp;&nbsp;-- remove whitespace characters<br/>
lex3&nbsp;&nbsp;&nbsp;&nbsp;:=&nbsp;strip_equals(lex2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- strip padding characters at end<br/>
length&nbsp;&nbsp;:=&nbsp;floor (length(lex3) * 3 / 4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- calculate length
</code>
</p>
<p>
Note on encoding: <bibref ref="RFC2045"/> explicitly references US-ASCII encoding.&nbsp; However,
decoding of <term>base64Binary</term> data in an XML entity is to be performed on the
Unicode characters obtained after character encoding processing as specified by
<bibref ref="XML"/>
</p>
<div4 role="1.0" id="base64Binary-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="anyURI">
<head>anyURI</head>
<p>
<termdef id="dt-anyURI" term="anyURI" role="local">
<term>anyURI</term> represents a Uniform Resource Identifier Reference
(URI).&nbsp; An <term>anyURI</term> value can be absolute or relative, and may
have an optional fragment identifier (i.e., it may be a URI Reference).&nbsp; This
type should be used to specify the intention that the value fulfills
the role of a URI as defined by <bibref ref="RFC2396"/>, as amended by
<bibref ref="RFC2732"/>.
</termdef>
</p>
<p>
The mapping from <term>anyURI</term> values to URIs is as
defined by the URI reference escaping procedure
defined in
Section 5.4 <xspecref href="&xlink;#link-locators">Locator Attribute</xspecref>
of <bibref ref="XLink"/> (see also Section 7
<xspecref href="&charmod;#sec-URIs">Character Encoding in URI References</xspecref>
of <bibref ref="CharMod"/>).&nbsp; This means
that a wide range of internationalized resource identifiers can be specified
when an <term>anyURI</term> is called for, and still be understood as
URIs per <bibref ref="RFC2396"/>, as amended by <bibref ref="RFC2732"/>,
where appropriate to identify resources.
</p>
<note>
<p>
Section 5.4 <xspecref href="&xlink;#link-locators">Locator Attribute</xspecref>
of <bibref ref="XLink"/> requires that relative URI references be absolutized
as defined in <bibref ref="XBase"/> before use.&nbsp; This is an XLink-specific
requirement and is not appropriate for XML Schema, since neither the
<termref def="dt-lexical-space"/> nor the <termref def="dt-value-space"/>
of the <dtref ref="anyURI"/> type are restricted to absolute URIs.&nbsp; Accordingly
absolutization must not be performed by schema processors as part of schema
validation.
</p>
</note>

<note>
<p>
Each URI scheme imposes specialized syntax rules for URIs in
that scheme, including restrictions on the syntax of allowed
fragment
identifiers. Because it is
impractical for processors to check that a value is a
context-appropriate URI reference, this specification follows the
lead of <bibref ref="RFC2396"/> (as amended by <bibref ref="RFC2732"/>)
in this matter: such rules and restrictions are not part of type validity
and are not checked by <termref def="dt-minimally-conforming"/> processors.
Thus in practice the above definition imposes only very modest obligations
on <termref def="dt-minimally-conforming"/> processors.
</p>
</note>

<div4 role="1.0" id="anyURI-lexical-representation">
<head>Lexical representation</head>
<p>
The <termref def="dt-lexical-space"/> of <term>anyURI</term> is
finite-length character sequences which, when the algorithm defined in
Section 5.4 of <bibref ref="XLink"/> is applied to them, result in strings
which are legal URIs according to <bibref ref="RFC2396"/>, as amended by
<bibref ref="RFC2732"/>.
</p>
<note>
<p>
Spaces are, in principle, allowed in the <termref def="dt-lexical-space"/>
of <term>anyURI</term>, however, their use is highly discouraged
(unless they are encoded by %20).
</p>
</note>
</div4>
<div4 role="1.0" id="anyURI-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="QName">
<head>QName</head>
<p>
<termdef id="dt-QName" term="QName" role="local">
<term>QName</term> represents
<xspecref href="&xmlnsspec;#dt-qname">XML qualified names</xspecref>.
The <termref def="dt-value-space"/> of <term>QName</term> is the set of
tuples {<xspecref href="&xmlnsspec;#dt-NSName">namespace name</xspecref>,
<xspecref href="&xmlnsspec;#dt-localname">local part</xspecref>},
where <xspecref href="&xmlnsspec;#dt-NSName">namespace name</xspecref>
is an <dtref ref="anyURI"/>
and <xspecref href="&xmlnsspec;#dt-localname">local part</xspecref> is
an <dtref ref="NCName"/>.

The <termref def="dt-lexical-space"/> of <term>QName</term> is the set
of strings that <termref def="dt-match"/> the <xspecref href="&xmlnsspec;#NT-QName">
QName</xspecref> production of <bibref ref="XMLNS"/>.
</termdef>
</p>
<note>
<p>
The mapping between literals in the <termref def="dt-lexical-space"/> and
values in the <termref def="dt-value-space"/> of <term>QName</term> requires
a namespace declaration to be in scope for the context in which <term>QName</term>
is used.
</p>
</note>
<div4 role="1.0" id="QName-facets">
<head>Constraining facets</head>
<facets/>
<p>

The use of <termref def="dt-length"/>, <termref def="dt-minLength"/> and
<termref def="dt-maxLength"/>
on datatypes <termref def="dt-derived"/> from <dtref ref="QName"/> is
deprecated.&nbsp; Future versions of this specification may
remove these facets for this datatype.

</p>
</div4>
</div3>

<div3 role="1.0" id="NOTATION">
<head>NOTATION</head>
<p>
<termdef id="dt-NOTATION" term="NOTATION" role="local">
<term>NOTATION</term>
represents the <xnt href="&xmlspec;#NT-NotationType">NOTATION</xnt> attribute
type from <bibref ref="XML"/>. The <termref def="dt-value-space"/>
of <term>NOTATION</term> is the set of <dtref ref="QName"/>s
of notations declared in the current schema.
The <termref def="dt-lexical-space"/> of <term>NOTATION</term> is the set
of all names of <xspecref href="&xsdl;#declare-notation">notations</xspecref>
declared in the current schema (in the form of <dtref ref="QName"/>s).
</termdef>
</p>
<constraintnote type="cos" id="enumeration-required-notation">
<head>enumeration facet value required for NOTATION</head>
<p>
It is an <termref def="dt-error"/> for <term>NOTATION</term>
to be used directly in a schema.&nbsp; Only datatypes that are
<termref def="dt-derived"/> from <term>NOTATION</term> by
specifying a value for <termref def="dt-enumeration"/> can be used
in a schema.
</p>
</constraintnote>
<p>
For compatibility (see <specref ref="terminology"/>) <term>NOTATION</term>
should be used only on attributes
and should only be used in schemas with no
target namespace.
</p>
<div4 role="1.0" id="NOTATION-facets">
<head>Constraining facets</head>
<facets/>
<p>

The use of <termref def="dt-length"/>, <termref def="dt-minLength"/> and <termref def="dt-maxLength"/>
on datatypes <termref def="dt-derived"/> from <dtref ref="NOTATION"/> is
deprecated.&nbsp; Future versions of this specification may
remove these facets for this datatype.

</p>
</div4>
</div3>
</div2>
<div2 role="1.0" id="built-in-derived">
<head>Derived datatypes</head>
<p>
This section gives conceptual definitions for all
<termref def="dt-built-in"/>&nbsp;<termref def="dt-derived"/> datatypes
defined by this specification. The XML representation used to define
<termref def="dt-derived"/> datatypes (whether
<termref def="dt-built-in"/> or <termref def="dt-user-derived"/>) is
given in section <specref ref="xr-defn"/> and the complete
definitions of the <termref def="dt-built-in"/>&nbsp;
<termref def="dt-derived"/> datatypes are provided in Appendix A
<specref ref="schema"/>.
</p>
<div3 role="1.0" id="normalizedString">
<head>normalizedString</head>
<p>
<termdef id="dt-normalizedString" term="normalizedString" role="local">
<term>normalizedString</term>
represents white space normalized strings.
The <termref def="dt-value-space"/> of <term>normalizedString</term> is the
set of strings that do not
contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters.
The <termref def="dt-lexical-space"/> of <term>normalizedString</term> is the
set of strings that do not
contain the carriage return (#xD),
line feed (#xA)
nor tab (#x9) characters.
The <termref def="dt-basetype"/> of <term>normalizedString</term> is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="normalizedString-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="normalizedString-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="token">
<head>token</head>
<p>
<termdef id="dt-token" term="token" role="local">
<term>token</term>
represents tokenized strings.
The <termref def="dt-value-space"/> of <term>token</term> is the
set of strings that do not
contain the
carriage return (#xD),
line feed (#xA) nor tab (#x9) characters, that have no
leading or trailing spaces (#x20) and that have no internal sequences
of two or more spaces.
The <termref def="dt-lexical-space"/> of <term>token</term> is the
set of strings that do not contain the
carriage return (#xD),
line feed (#xA) nor tab (#x9) characters, that have no
leading or trailing spaces (#x20) and that have no internal sequences
of two or more spaces.
The <termref def="dt-basetype"/> of <term>token</term> is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="token-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="token-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="language">
<head>language</head>
<p>
<termdef id="dt-language" term="language" role="local">
<term>language</term>
represents natural language identifiers as defined by
by <bibref ref="RFC3066"/>
.
The <termref def="dt-value-space"/> of <term>language</term> is the
set of all strings that are valid language identifiers as defined
<bibref ref="RFC3066"/>
.
The <termref def="dt-lexical-space"/> of
<term>language</term> is the set of all strings that
conform to the pattern <code>[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*</code>
.
The <termref def="dt-basetype"/> of <term>language</term> is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="language-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<div3 role="1.0" id="NMTOKEN">
<head>NMTOKEN</head>
<p>
<termdef id="dt-NMTOKEN" term="NMTOKEN" role="local">
<term>NMTOKEN</term> represents
the <xnt href="&xmlspec;#NT-TokenizedType">NMTOKEN attribute type</xnt>
from <bibref ref="XML"/>. The <termref def="dt-value-space"/> of
<term>NMTOKEN</term> is the set of tokens that <termref def="dt-match"/>
the <xnt href="&xmlspec;#NT-Nmtoken">Nmtoken</xnt> production in
<bibref ref="XML"/>. The <termref def="dt-lexical-space"/> of
<term>NMTOKEN</term> is the set of strings that <termref def="dt-match"/>
the <xnt href="&xmlspec;#NT-Nmtoken">Nmtoken</xnt> production in
<bibref ref="XML"/>.&nbsp; The <termref def="dt-basetype"/> of
<term>NMTOKEN</term> is <baseref/>.
</termdef>
</p>
<p>
For compatibility (see <specref ref="terminology"/>) <term>NMTOKEN</term>
should be used only on attributes.
</p>
<div4 role="1.0" id="NMTOKEN-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="NMTOKEN-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="NMTOKENS">
<head>NMTOKENS</head>
<p>
<termdef id="dt-NMTOKENS" term="NMTOKENS" role="local">
<term>NMTOKENS</term>
represents the <xnt href="&xmlspec;#NT-TokenizedType">NMTOKENS attribute
type</xnt> from <bibref ref="XML"/>. The <termref def="dt-value-space"/>
of <term>NMTOKENS</term> is the set of finite, non-zero-length sequences of
<termref def="dt-NMTOKEN"/>s.&nbsp; The <termref def="dt-lexical-space"/>
of <term>NMTOKENS</term> is the set of space-separated lists of tokens,
of which each token is in the <termref def="dt-lexical-space"/> of
<dtref ref="NMTOKEN"/>.&nbsp; The <termref def="dt-itemType"/> of
<term>NMTOKENS</term> is <itemTyperef/>.
</termdef>
</p>
<p>
For compatibility (see <specref ref="terminology"/>)
<term>NMTOKENS</term> should be used only on attributes.
</p>
<div4 role="1.0" id="NMTOKENS-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="Name">
<head>Name</head>
<p>
<termdef id="dt-Name" term="Name" role="local">
<term>Name</term>
represents <xspecref href="&xmlspec;#dt-name">XML Names</xspecref>.
The <termref def="dt-value-space"/> of <term>Name</term> is
the set of all strings which <termref def="dt-match"/> the
<xnt href="&xmlspec;#NT-Name">Name</xnt> production of
<bibref ref="XML"/>.&nbsp; The <termref def="dt-lexical-space"/> of
<term>Name</term> is the set of all strings which <termref def="dt-match"/>
the <xnt href="&xmlspec;#NT-Name">Name</xnt> production of
<bibref ref="XML"/>. The <termref def="dt-basetype"/> of <term>Name</term>
is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="Name-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="Name-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="NCName">
<head>NCName</head>
<p>
<termdef id="dt-NCName" term="NCName" role="local">
<term>NCName</term> represents XML
"non-colonized" Names.&nbsp; The <termref def="dt-value-space"/> of
<term>NCName</term> is the set of all strings which <termref def="dt-match"/>
the <xnt href="&xmlnsspec;#NT-NCName">NCName</xnt> production of
<bibref ref="XMLNS"/>.&nbsp; The <termref def="dt-lexical-space"/> of
<term>NCName</term> is the set of all strings which <termref def="dt-match"/>
the <xnt href="&xmlnsspec;#NT-NCName">NCName</xnt> production of
<bibref ref="XMLNS"/>.&nbsp; The <termref def="dt-basetype"/> of
<term>NCName</term> is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="NCName-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="NCName-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="ID">
<head>ID</head>
<p>
<termdef id="dt-ID" term="ID" role="local">
<term>ID</term> represents the
<xnt href="&xmlspec;#NT-TokenizedType">ID attribute type</xnt> from
<bibref ref="XML"/>.&nbsp; The <termref def="dt-value-space"/> of
<term>ID</term> is the set of all strings that <termref def="dt-match"/>
the <xnt href="&xmlnsspec;#NT-NCName">NCName</xnt> production in
<bibref ref="XMLNS"/>.&nbsp; The
<termref def="dt-lexical-space"/> of <term>ID</term> is the set of all
strings that <termref def="dt-match"/> the
<xnt href="&xmlnsspec;#NT-NCName">NCName</xnt> production in
<bibref ref="XMLNS"/>.
The <termref def="dt-basetype"/> of <term>ID</term> is <baseref/>.
</termdef>
</p>
<p>
For compatibility (see <specref ref="terminology"/>)
<term>ID</term> should be used only on attributes.
</p>

<div4 role="1.0" id="ID-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="IDREF">
<head>IDREF</head>
<p>
<termdef id="dt-IDREF" term="IDREF" role="local">
<term>IDREF</term> represents the
<xnt href="&xmlspec;#NT-TokenizedType">IDREF attribute type</xnt> from
<bibref ref="XML"/>.&nbsp; The <termref def="dt-value-space"/> of
<term>IDREF</term> is the set of all strings that <termref def="dt-match"/>
the <xnt href="&xmlnsspec;#NT-NCName">NCName</xnt> production in
<bibref ref="XMLNS"/>.&nbsp; The
<termref def="dt-lexical-space"/> of <term>IDREF</term> is the set of
strings that <termref def="dt-match"/> the
<xnt href="&xmlnsspec;#NT-NCName">NCName</xnt> production in
<bibref ref="XMLNS"/>.
The <termref def="dt-basetype"/> of <term>IDREF</term> is <baseref/>.
</termdef>
</p>

<p>
For compatibility (see <specref ref="terminology"/>) this datatype
should be used only on attributes.
</p>

<div4 role="1.0" id="IDREF-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="IDREF-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>

<div3 role="1.0" id="IDREFS">
<head>IDREFS</head>
<p>
<termdef id="dt-IDREFS" term="IDREFS" role="local">
<term>IDREFS</term> represents the
<xnt href="&xmlspec;#NT-TokenizedType">IDREFS attribute type</xnt> from
<bibref ref="XML"/>.&nbsp; The <termref def="dt-value-space"/> of
<term>IDREFS</term> is the set of finite, non-zero-length sequences of
<dtref ref="IDREF"/>s.
The <termref def="dt-lexical-space"/> of <term>IDREFS</term> is the
set of space-separated lists of tokens, of which each token is in the
<termref def="dt-lexical-space"/> of <dtref ref="IDREF"/>.
The <termref def="dt-itemType"/> of <term>IDREFS</term> is
<itemTyperef/>.
</termdef>
</p>
<p>
For compatibility (see <specref ref="terminology"/>) <term>IDREFS</term>
should be used only on attributes.
</p>

<div4 role="1.0" id="IDREFS-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<div3 role="1.0" id="ENTITY">
<head>ENTITY</head>
<p>
<termdef id="dt-ENTITY" term="ENTITY" role="local">
<term>ENTITY</term> represents the
<xnt href="&xmlspec;#NT-TokenizedType">ENTITY</xnt> attribute type from
<bibref ref="XML"/>.&nbsp; The <termref def="dt-value-space"/> of
<term>ENTITY</term> is the set of all strings that <termref def="dt-match"/>
the <xnt href="&xmlnsspec;#NT-NCName">NCName</xnt> production in
<bibref ref="XMLNS"/> and have been declared as an
<xspecref href="&xmlspec;#dt-unparsed">unparsed entity</xspecref> in
a <xspecref href="&xmlspec;#dt-doctype">document type definition</xspecref>.
The <termref def="dt-lexical-space"/> of <term>ENTITY</term> is the set
of all strings that <termref def="dt-match"/> the
<xnt href="&xmlnsspec;#NT-NCName">NCName</xnt> production in
<bibref ref="XMLNS"/>.
The <termref def="dt-basetype"/> of <term>ENTITY</term> is <baseref/>.
</termdef>
</p>
<note>
<p>
The <termref def="dt-value-space"/> of <term>ENTITY</term> is scoped
to a specific instance document.
</p>
</note>
<p>
For compatibility (see <specref ref="terminology"/>) <term>ENTITY</term>
should be used only on attributes.
</p>
<div4 role="1.0" id="ENTITY-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="ENTITY-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>

<div3 role="1.0" id="ENTITIES">
<head>ENTITIES</head>
<p>
<termdef id="dt-ENTITIES" term="ENTITIES" role="local">
<term>ENTITIES</term>
represents the <xnt href="&xmlspec;#NT-TokenizedType">ENTITIES attribute
type</xnt> from <bibref ref="XML"/>. The <termref def="dt-value-space"/>
of <term>ENTITIES</term> is the set of finite, non-zero-length sequences of
<termref def="dt-ENTITY"/>s that have been declared as
<xspecref href="&xmlspec;#dt-unparsed">unparsed entities</xspecref>
in a <xspecref href="&xmlspec;#dt-doctype">document type definition</xspecref>.
The <termref def="dt-lexical-space"/> of <term>ENTITIES</term> is the
set of space-separated lists of tokens, of which each token is in the
<termref def="dt-lexical-space"/> of <dtref ref="ENTITY"/>.
The <termref def="dt-itemType"/> of <term>ENTITIES</term> is
<itemTyperef/>.
</termdef>
</p>
<note>
<p>
The <termref def="dt-value-space"/> of <term>ENTITIES</term> is scoped
to a specific instance document.
</p>
</note>
<p>
For compatibility (see <specref ref="terminology"/>) <term>ENTITIES</term>
should be used only on attributes.
</p>
<div4 role="1.0" id="ENTITIES-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<div3 role="1.0" id="integer">
<head>integer</head>
<p>
<termdef id="dt-integer" term="integer" role="local">
<term>integer</term> is
<termref def="dt-derived"/> from <dtref ref="decimal"/> by fixing the
value of <termref def="dt-fractionDigits"/> to be 0and
disallowing the trailing decimal point.
This results in the standard
mathematical concept of the integer numbers. The
<termref def="dt-value-space"/> of <term>integer</term> is the infinite
set {...,-2,-1,0,1,2,...}.&nbsp; The <termref def="dt-basetype"/> of
<term>integer</term> is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="integer-lexical-representation">
<head>Lexical representation</head>
<p>
<term>integer</term> has a lexical representation consisting of a finite-length sequence
of decimal digits (#x30-#x39) with an optional leading sign.&nbsp; If the sign is omitted,
"+" is assumed.&nbsp; For example: -1, 0, 12678967543233, +100000.
</p>
</div4>
<div4 role="1.0" id="integer-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>integer</term> is defined
by prohibiting certain options from the
<specref ref="integer-lexical-representation"/>.&nbsp; Specifically, the preceding optional "+" sign is prohibited and leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="integer-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="integer-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="nonPositiveInteger">
<head>nonPositiveInteger</head>
<p>
<termdef id="dt-nonPositiveInteger" term="nonPositiveInteger" role="local">
<term>nonPositiveInteger</term> is <termref def="dt-derived"/> from
<dtref ref="integer"/> by setting the value of
<termref def="dt-maxInclusive"/> to be 0.&nbsp; This results in the
standard mathematical concept of the non-positive integers.
The <termref def="dt-value-space"/> of <term>nonPositiveInteger</term>
is the infinite set {...,-2,-1,0}.&nbsp; The <termref def="dt-basetype"/>
of <term>nonPositiveInteger</term> is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="nonPositiveInteger-lexical-representation">
<head>Lexical representation</head>
<p>
<term>nonPositiveInteger</term> has a lexical representation consisting of
an optional preceding sign

followed by a finite-length sequence of decimal digits (#x30-#x39).

The sign may be "+" or may be omitted only for
lexical forms denoting zero; in all other lexical forms, the negative
sign ("-") must be present.
For example: -1, 0, -12678967543233, -100000.
</p>
</div4>
<div4 role="1.0" id="nonPositiveInteger-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>nonPositiveInteger</term> is defined
by prohibiting certain options from the
<specref ref="nonPositiveInteger-lexical-representation"/>.

In the canonical form for zero, the sign must be
omitted.&nbsp; Leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="nonPositiveInteger-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="nonPositiveInteger-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="negativeInteger">
<head>negativeInteger</head>
<p>
<termdef id="dt-negativeInteger" term="negativeInteger" role="local">
<term>negativeInteger</term> is <termref def="dt-derived"/> from
<dtref ref="nonPositiveInteger"/> by setting the value of
<termref def="dt-maxInclusive"/> to be -1.&nbsp; This results in the
standard mathematical concept of the negative integers.&nbsp; The
<termref def="dt-value-space"/> of <term>negativeInteger</term>
is the infinite set {...,-2,-1}.&nbsp; The <termref def="dt-basetype"/>
of <term>negativeInteger</term>  is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="negativeInteger-lexical-representation">
<head>Lexical representation</head>
<p>
<term>negativeInteger</term> has a lexical representation consisting of
a negative sign ("-") followed by a finite-length
sequence of decimal digits (#x30-#x39).&nbsp; For example: -1, -12678967543233, -100000.
</p>
</div4>
<div4 role="1.0" id="negativeInteger-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>negativeInteger</term> is defined
by prohibiting certain options from the
<specref ref="negativeInteger-lexical-representation"/>.&nbsp; Specifically,  leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="negativeInteger-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="long">
<head>long</head>
<p>
<termdef id="dt-long" term="long" role="local">
<term>long</term> is
<termref def="dt-derived"/> from <dtref ref="integer"/> by setting the
value of <termref def="dt-maxInclusive"/> to be 9223372036854775807
and <termref def="dt-minInclusive"/> to be -9223372036854775808.
The <termref def="dt-basetype"/> of <term>long</term> is
<baseref/>.
</termdef>
</p>
<div4 role="1.0" id="long-lexical-representation">
<head>Lexical representation</head>
<p>
<term>long</term> has a lexical representation consisting
of an optional sign followed by a finite-length
sequence of decimal digits (#x30-#x39).&nbsp; If the sign is omitted, "+" is assumed.
For example: -1, 0,
12678967543233, +100000.
</p>
</div4>
<div4 role="1.0" id="long-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>long</term> is defined
by prohibiting certain options from the
<specref ref="long-lexical-representation"/>.&nbsp; Specifically, the
the optional "+" sign is prohibited and leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="long-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="long-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="int">
<head>int</head>
<p>
<termdef id="dt-int" term="int" role="local">
<term>int</term>
is <termref def="dt-derived"/> from <dtref ref="long"/> by setting the
value of <termref def="dt-maxInclusive"/> to be 2147483647 and
<termref def="dt-minInclusive"/> to be -2147483648.&nbsp; The
<termref def="dt-basetype"/> of <term>int</term> is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="int-lexical-representation">
<head>Lexical representation</head>
<p>
<term>int</term> has a lexical representation consisting
of an optional sign followed by a finite-length
sequence of decimal digits (#x30-#x39).&nbsp; If the sign is omitted, "+" is assumed.
For example: -1, 0,
126789675, +100000.
</p>
</div4>
<div4 role="1.0" id="int-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>int</term> is defined
by prohibiting certain options from the
<specref ref="int-lexical-representation"/>.&nbsp; Specifically, the
the optional "+" sign is prohibited and leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="int-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="int-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="short">
<head>short</head>
<p>
<termdef id="dt-short" term="short" role="local">
<term>short</term> is
<termref def="dt-derived"/> from <dtref ref="int"/> by setting the
value of <termref def="dt-maxInclusive"/> to be 32767 and
<termref def="dt-minInclusive"/> to be -32768.&nbsp; The
<termref def="dt-basetype"/> of <term>short</term> is
<baseref/>.
</termdef>
</p>
<div4 role="1.0" id="short-lexical-representation">
<head>Lexical representation</head>
<p>
<term>short</term> has a lexical representation consisting
of an optional sign followed by a finite-length sequence of decimal
digits (#x30-#x39).&nbsp; If the sign is omitted, "+" is assumed.
For example: -1, 0, 12678, +10000.
</p>
</div4>
<div4 role="1.0" id="short-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>short</term> is defined
by prohibiting certain options from the
<specref ref="short-lexical-representation"/>.&nbsp; Specifically, the
the optional "+" sign is prohibited and leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="short-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="short-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="byte">
<head>byte</head>
<p>
<termdef id="dt-byte" term="byte" role="local">
<term>byte</term>
is <termref def="dt-derived"/> from <dtref ref="short"/>
by setting the value of <termref def="dt-maxInclusive"/> to be 127
and <termref def="dt-minInclusive"/> to be -128.
The <termref def="dt-basetype"/> of <term>byte</term> is
<baseref/>.
</termdef>
</p>
<div4 role="1.0" id="byte-lexical-representation">
<head>Lexical representation</head>
<p>
<term>byte</term> has a lexical representation consisting
of an optional sign followed by a finite-length
sequence of decimal digits (#x30-#x39).&nbsp; If the sign is omitted, "+" is assumed.
For example: -1, 0,
126, +100.
</p>
</div4>
<div4 role="1.0" id="byte-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>byte</term> is defined
by prohibiting certain options from the
<specref ref="byte-lexical-representation"/>.&nbsp; Specifically, the
the optional "+" sign is prohibited and leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="byte-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="nonNegativeInteger">
<head>nonNegativeInteger</head>
<p>
<termdef id="dt-nonNegativeInteger" term="nonNegativeInteger" role="local">
<term>nonNegativeInteger</term> is <termref def="dt-derived"/> from
<dtref ref="integer"/> by setting the value of
<termref def="dt-minInclusive"/> to be 0.&nbsp; This results in the
standard mathematical concept of the non-negative integers. The
<termref def="dt-value-space"/> of <term>nonNegativeInteger</term>
is the infinite set {0,1,2,...}.&nbsp; The <termref def="dt-basetype"/> of
<term>nonNegativeInteger</term> is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="nonNegativeInteger-lexical-representation">
<head>Lexical representation</head>
<p>
<term>nonNegativeInteger</term> has a lexical representation consisting of
an optional sign followed by a finite-length
sequence of decimal digits (#x30-#x39).&nbsp; If the sign is omitted,
the positive sign ("+") is assumed.
If the sign is present, it must be "+" except for lexical forms
denoting zero, which may be preceded by a positive ("+") or a negative ("-") sign.
For example:
1, 0, 12678967543233, +100000.
</p>
</div4>
<div4 role="1.0" id="nonNegativeInteger-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>nonNegativeInteger</term> is defined
by prohibiting certain options from the
<specref ref="nonNegativeInteger-lexical-representation"/>.&nbsp; Specifically, the
the optional "+" sign is prohibited and leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="nonNegativeInteger-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="nonNegativeInteger-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="unsignedLong">
<head>unsignedLong</head>
<p>
<termdef id="dt-unsignedLong" term="unsignedLong" role="local">
<term>unsignedLong</term> is <termref def="dt-derived"/> from
<dtref ref="nonNegativeInteger"/> by setting the value of
<termref def="dt-maxInclusive"/> to be 18446744073709551615.
The <termref def="dt-basetype"/> of <term>unsignedLong</term> is
<baseref/>.
</termdef>
</p>
<div4 role="1.0" id="unsignedLong-lexical-representation">
<head>Lexical representation</head>
<p>
<term>unsignedLong</term> has a lexical representation consisting
of a finite-length sequence of decimal digits (#x30-#x39).
For example: 0,
12678967543233, 100000.
</p>
</div4>
<div4 role="1.0" id="unsignedLong-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>unsignedLong</term> is defined
by prohibiting certain options from the
<specref ref="unsignedLong-lexical-representation"/>.&nbsp; Specifically,
leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="unsignedLong-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="unsignedLong-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="unsignedInt">
<head>unsignedInt</head>
<p>
<termdef id="dt-unsignedInt" term="unsignedInt" role="local">
<term>unsignedInt</term> is <termref def="dt-derived"/> from
<dtref ref="unsignedLong"/> by setting the value of
<termref def="dt-maxInclusive"/> to be 4294967295.&nbsp; The
<termref def="dt-basetype"/> of <term>unsignedInt</term> is
<baseref/>.
</termdef>
</p>
<div4 role="1.0" id="unsignedInt-lexical-representation">
<head>Lexical representation</head>
<p>
<term>unsignedInt</term> has a lexical representation consisting
of a finite-length
sequence of decimal digits (#x30-#x39).&nbsp; For example: 0,
1267896754, 100000.
</p>
</div4>
<div4 role="1.0" id="unsignedInt-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>unsignedInt</term> is defined
by prohibiting certain options from the
<specref ref="unsignedInt-lexical-representation"/>.&nbsp; Specifically,
leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="unsignedInt-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="unsignedInt-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="unsignedShort">
<head>unsignedShort</head>
<p>
<termdef id="dt-unsignedShort" term="unsignedShort" role="local">
<term>unsignedShort</term> is <termref def="dt-derived"/> from
<dtref ref="unsignedInt"/> by setting the value of
<termref def="dt-maxInclusive"/> to be 65535.&nbsp; The
<termref def="dt-basetype"/> of <term>unsignedShort</term> is
<baseref/>.
</termdef>
</p>
<div4 role="1.0" id="unsignedShort-lexical-representation">
<head>Lexical representation</head>
<p>
<term>unsignedShort</term>  has a lexical representation consisting
of a finite-length
sequence of decimal digits (#x30-#x39).
For example: 0,
12678, 10000.
</p>
</div4>
<div4 role="1.0" id="unsignedShort-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>unsignedShort</term> is defined
by prohibiting certain options from the
<specref ref="unsignedShort-lexical-representation"/>.&nbsp; Specifically, the
leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="unsingedShort-facets">
<head>Constraining facets</head>
<facets/>
</div4>
<div4 role="1.0" id="unsignedShort-derived-types">
<head>Derived datatypes</head>
<subtypes/>
</div4>
</div3>
<div3 role="1.0" id="unsignedByte">
<head>unsignedByte</head>
<p>
<termdef id="dt-unsignedByte" term="unsignedByte" role="local">
<term>unsignedByte</term> is <termref def="dt-derived"/> from
<dtref ref="unsignedShort"/> by setting the value of
<termref def="dt-maxInclusive"/> to be 255. The
<termref def="dt-basetype"/> of <term>unsignedByte</term> is
<baseref/>.
</termdef>
</p>
<div4 role="1.0" id="unsignedByte-lexical-representation">
<head>Lexical representation</head>
<p>
<term>unsignedByte</term>  has a lexical representation consisting
of a finite-length
sequence of decimal digits (#x30-#x39).
For example: 0,
126, 100.
</p>
</div4>
<div4 role="1.0" id="unsignedByte-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>unsignedByte</term> is defined
by prohibiting certain options from the
<specref ref="unsignedByte-lexical-representation"/>.&nbsp; Specifically,
leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="unisngedByte-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>
<div3 role="1.0" id="positiveInteger">
<head>positiveInteger</head>
<p>
<termdef id="dt-positiveInteger" term="positiveInteger" role="local">
<term>positiveInteger</term> is <termref def="dt-derived"/> from
<dtref ref="nonNegativeInteger"/> by setting the value of
<termref def="dt-minInclusive"/> to be 1. This results in the standard
mathematical concept of the positive integer numbers.
The <termref def="dt-value-space"/> of <term>positiveInteger</term>
is the infinite set {1,2,...}.&nbsp; The <termref def="dt-basetype"/> of
<term>positiveInteger</term> is <baseref/>.
</termdef>
</p>
<div4 role="1.0" id="positiveInteger-lexical-representation">
<head>Lexical representation</head>
<p>
<term>positiveInteger</term> has a lexical representation consisting
of an optional positive sign ("+") followed by a finite-length
sequence of decimal digits (#x30-#x39).
For example: 1, 12678967543233, +100000.
</p>
</div4>
<div4 role="1.0" id="positiveInteger-canonical-repr">
<head>Canonical representation</head>
<p>
The canonical representation for <term>positiveInteger</term> is defined
by prohibiting certain options from the
<specref ref="positiveInteger-lexical-representation"/>.&nbsp; Specifically, the
optional "+" sign is prohibited and leading zeroes are prohibited.
</p>
</div4>
<div4 role="1.0" id="positiveInteger-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

 <!-- ****************************** BEGIN NEW 1.1 MATERIAL (duration derivatives) ********************************* -->
 

<div3 id="yearMonthDuration">
<head>yearMonthDuration</head>

<p>
<termdef id="dt-yearMonthDuration" term="yearMonthDuration" role="local">
<term>yearMonthDuration</term> is a datatype <termref def="dt-derived"/> from
<dtref ref="duration"/> by restricting its <termref def="dt-lexical-representation">lexical
representations</termref> to instances of
<nt def="nt-yearMonthDurationRep"/>.</termdef>&nbsp; The <termref def="dt-value-space"></termref> of
<term>yearMonthDuration</term>
is therefore that of <dtref ref="duration"/> restricted to those whose <vpropref ref="vp-du-second"/>
property is 0.&nbsp; This results in a duration datatype which is totally ordered.</p>

<note><p>The always-zero <vpropref ref="vp-du-second"/> is formally retained in order that
<dtref ref="yearMonthDuration"/>&apos;s (abstract) value space truly be a subset of that of
<dtref ref="duration"/>&nbsp; An obvious implementation optimization is to ignore the zero and implement
<dtref ref="yearMonthDuration"/> values simply as <dtref ref="integer"/> values.</p></note>

<div4 id="yearMonthDuration-lexical-mapping">
<head>The <dtref ref="yearMonthDuration"/> Lexical Mapping</head>
<p>
The lexical space is reduced from that of <dtref ref="duration"/> by disallowing <nt def="nt-duDaFrag"/>
and <nt def="nt-duTFrag"/> fragments in the <termref def="dt-lexical-representation">lexical
representations</termref>. The <termref def="dt-lexical-mapping"></termref>, called
<quote><pfref ref="f-yearMonthDurationMap"/></quote> herein, is that
of <dtref ref="duration"/> restricted to the <dtref ref="yearMonthDuration"/> lexical space.

<defset><head>The <dtref ref="yearMonthDuration"/> Lexical Representation</head>
<prodgroup>
<prod id="nt-yearMonthDurationRep"><lhs>yearMonthDurationLexicalRep</lhs>
<rhs><string>-</string>?&nbsp;<string>P</string>&nbsp;<nt def="nt-duYMFrag"/></rhs></prod>
</prodgroup></defset></p>

<p>The regular expression <string>-?P([0-9]+Y)?([0-9]+M)?</string> has
instances that are not in the lexical space&mdash;but they are not in the lexical space of <dtref ref="duration"/>
either, so it serves as a relatively simple regular expression
that extracts from the <termref def="dt-lexical-space"/>
of <dtref ref="duration"/> those representations that are instances of <dtref ref="yearMonthDuration"/>.

<defsetsum ref="defs-yearMonthDurationLexmap"/>
</p>

<note diff="add">
<p>Canonical mappings are not used during schema processing.&nbsp; They are provided in this specification
for the benefit of other users of these datatype definitions who may find them useful, and for other specifications
which might find it useful to reference them normatively.</p>
</note>

<p>The <termref def="dt-canonical-mapping"></termref> is that of <dtref ref="duration"/> restricted in its 
range to the <termref def="dt-lexical-space"></termref> (which reduces its domain to omit any 
values not in the <dtref ref="yearMonthDuration"/> value space).

<defsetsum ref="defs-yearMonthDurationCanmap"/>
</p>

<note>
<p>The <dtref ref="yearMonthDuration"/> value whose <vpropref ref="vp-du-month"/> and
  <vpropref ref="vp-du-second"/>
are both zero has no <termref def="dt-canonical-representation"></termref> in this datatype since its
<termref def="dt-canonical-representation"></termref> in <dtref ref="duration"/> (<string>PT0S</string>)
 is not in the 
<termref def="dt-lexical-space"></termref> of <dtref ref="yearMonthDuration"/>.</p>
</note>

</div4>

<div4 id="YearMonthDuration-facets">
<head>&CFacet;s</head>
<!--
<facets/>
-->

<p><dtref ref="yearMonthDuration"/> has the following <termref def="dt-constraining-facet">&cfacet;s</termref>:

<ulist>

<item><p>pattern</p></item>

<item><p>eunmeration</p></item>

<item><p>whitespace</p></item>

<item><p>minInclusive</p></item>

<item><p>minExclusive</p></item>

<item><p>maxInclusive</p></item>

<item><p>maxExclusive</p></item>

</ulist></p>
</div4>
</div3>

<div3 id="dayTimeDuration">
<head>dayTimeDuration</head>
<p>
<termdef id="dt-dayTimeDuration" term="dayTimeDuration" role="local">
<term>dayTimeDuration</term> is a datatype <termref def="dt-derived"/> from
<dtref ref="duration"/> by restricting its <termref def="dt-lexical-representation">lexical 
representations</termref> to instances of
<nt def="nt-dayTimeDurationRep"/>.</termdef>  The <termref def="dt-value-space"></termref> of 
<term>dayTimeDuration</term>
is therefore that of <dtref ref="duration"/> restricted to those whose <vpropref ref="vp-du-month"/>
property is 0.&nbsp; This results in a duration datatype which is totally ordered.</p>

<div4 id="dayTimeDuration-lexical-mapping">
<head>The <dtref ref="dayTimeDuration"/> Lexical Space</head>
<p>
The lexical space is reduced from that of <dtref ref="duration"/> by disallowing <nt def="nt-duYrFrag"/>
and <nt def="nt-duMoFrag"/> fragments in the <termref def="dt-lexical-representation">lexical 
representations</termref>. The <termref def="dt-lexical-mapping"></termref>, called 
<quote><pfref ref="f-dayTimeDurationMap"/></quote> herein, is that 
of <dtref ref="duration"/> restricted to the <dtref ref="dayTimeDuration"/> lexical space. 
</p>

<p><defset><head>The <dtref ref="dayTimeDuration"/> Lexical Representation</head>
<prodgroup>
<prod id="nt-dayTimeDurationRep"><lhs>dayTimeDurationLexicalRep</lhs>
<rhs><string>-</string>?&nbsp;<string>P</string>&nbsp;<nt def="nt-duDTFrag"/></rhs></prod>
</prodgroup></defset></p>

<p>The regular expression <string>-?P([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+(.[0-9]+)?S)?)?</string> has several
instances that are not in the lexical space&mdash;but they are not in the lexical space of <dtref ref="duration"/>
either, so it serves as a relatively simple regular expression that extracts from
the <termref def="dt-lexical-space"/>
of <dtref ref="duration"/> those representations that are instances of <nt def="nt-dayTimeDurationRep"/>.

<defsetsum ref="defs-dayTimeDurationLexmap"/>
</p>

<note diff="add">
<p>Canonical mappings are not used during schema processing.&nbsp; They are provided in this specification
for the benefit of other users of these datatype definitions who may find them useful, and for other specifications
which might find it useful to reference them normatively.</p>
</note>

<p>The <termref def="dt-canonical-mapping"></termref> is that of <dtref ref="duration"/> restricted
to the <termref def="dt-value-space"></termref>
The <termref def="dt-canonical-mapping"></termref> is that of <dtref ref="duration"/> restricted 
<phrase diff="del">in its 
range to the <termref def="dt-lexical-space"></termref> (which reduces its domain to omit any 
values not in</phrase><phrase diff="add">to</phrase> the <dtref ref="yearMonthDuration"/> value 
space<phrase diff="del">)</phrase>.

<defsetsum ref="defs-dayTimeDurationCanmap"/></p>
</div4>

<div4 id="dayTimeDuration-facets">
<head>&CFacet;s</head>
<!--
<facets/>
-->

<p><dtref ref="dayTimeDuration"/> has the following <termref def="dt-constraining-facet">&cfacet;s</termref>:

<ulist>

<item><p>pattern</p></item>

<item><p>eunmeration</p></item>

<item><p>whitespace</p></item>

<item><p>minInclusive</p></item>

<item><p>minExclusive</p></item>

<item><p>maxInclusive</p></item>

<item><p>maxExclusive</p></item>

</ulist></p>
</div4>
</div3>

 <!-- ****************************** END NEW 1.1 MATERIAL (duration derivatives) ********************************* -->
 
</div2>
</div1>

<div1 role="1.0" id="datatype-components">
<head>Datatype components</head>
<p>
The following sections provide full details on the properties and
significance of each kind of schema component involved in datatype
definitions. For each property, the kinds of values it is allowed to have is
specified.&nbsp; Any property not identified as optional is required to
be present; optional properties which are not present have
<xspecref href="&xsdl;#key-null">absent</xspecref> as their value.
Any property identified as a having a set, subset or <termref def="dt-list"/>
value may have an empty value unless this is explicitly ruled out: this is
not the same as <xspecref href="&xsdl;#key-null">absent</xspecref>.
Any property value identified as a superset or a subset of some set may
be equal to that set, unless a proper superset or subset is explicitly
called for.
</p>

<p>
For more information on the notion of datatype (schema) components,
see <xspecref href="&xsdl;#components">Schema Component Details</xspecref>
of <bibref ref="structural-schemas"/>.
</p>

<div2 role="1.0" id="rf-defn">
<head>Simple Type Definition</head>
<p>
Simple Type definitions provide for:
</p>
<ulist>
<item>
<p>
Establishing the <termref def="dt-value-space"/> and <termref def="dt-lexical-space"/>
of a datatype, through
the combined set of <termref def="dt-constraining-facet"/>s specified
in the definition;
</p>
</item>
<item>
<p>
Attaching a unique name (actually a <dtref ref="QName"/>) to the
<termref def="dt-value-space"/> and <termref def="dt-lexical-space"/>.
</p>
</item>
</ulist>

<div3 role="1.0" id="dc-defn">
<head>The Simple Type Definition Schema Component</head>
<p>
The Simple Type Definition schema component has the following properties:
</p>
<compdef name="Simple Type Definition" ref="datatype">
<proplist>
<propdef id="defn-name" name="name">
Optional.&nbsp; An NCName as defined by
<bibref ref="XMLNS"/>.
</propdef>
<propdef id="defn-target-namespace" name="target namespace">
Either <xspecref href="&xsdl;#key-null">absent</xspecref> or a
namespace name, as defined in <bibref ref="XMLNS"/>.
</propdef>
<propdef id="defn-variety" name="variety">
One of {<pt>atomic</pt>, <pt>list</pt>, <pt>union</pt>}. Depending on the
value of <propref ref="defn-variety"/>, further properties are defined as follows:
<glist>
<gitem>
<label>atomic</label>
<def>
<proplist>
<propdef id="defn-primitive" name="primitive type definition">
A <termref def="dt-built-in"/>&nbsp;<termref def="dt-primitive"/>
datatype definition).
</propdef>
</proplist>
</def>
</gitem>
<gitem>
<label>list</label>
<def>

<proplist>
<propdef id="defn-itemType" name="item type definition">
An <termref def="dt-atomic"/> or <termref def="dt-union"/> simple type definition.
</propdef>
</proplist>
</def>
</gitem>
<gitem>
<label>union</label>
<def>
<proplist>
<propdef id="defn-memberTypes" name="member type definitions">
A non-empty sequence of simple type definitions.
</propdef>
</proplist>
</def>
</gitem>
</glist>
</propdef>
<propdef id="defn-facets" name="facets">
A possibly empty set of <specref ref="facets"/>.
</propdef>
<propdef id="defn-fund-facets" name="information facets">
A set of <termref def="dt-fundamental-facet">information facets</termref>.
</propdef>
<propdef id="defn-basetype" name="base type definition">
If the datatype has been <termref def="dt-derived"/> by
<termref def="dt-restriction"/> then the <compref ref="dc-defn"/> component
from which it is <termref def="dt-derived"/>, otherwise
the <specref ref="anySimpleType-component"/>.
</propdef>
<propdef id="defn-final" name="final">
A  subset of <emph>{restriction, list, union}</emph>.
</propdef>
<propdef id="defn-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>
<p>
Datatypes are identified by their <propref ref="defn-name"/>
and <propref ref="defn-target-namespace"/>.&nbsp; Except
for anonymous datatypes (those with no <propref ref="defn-name"/>),
datatype definitions <termref def="dt-must"/> be uniquely identified
within a schema.
</p>
<p>
If <propref ref="defn-variety"/> is <termref def="dt-atomic"/>
then the <termref def="dt-value-space"/> of the datatype defined will
be a subset of the <termref def="dt-value-space"/> of
<propref ref="defn-basetype"/> (which is a subset of the
<termref def="dt-value-space"/> of <propref ref="defn-primitive"/>).
If <propref ref="defn-variety"/> is <termref def="dt-list"/>
then the <termref def="dt-value-space"/> of the datatype defined will
be the set of finite-length sequence of values from the
<termref def="dt-value-space"/> of <propref ref="defn-itemType"/>.
If <propref ref="defn-variety"/> is <termref def="dt-union"/> then the
<termref def="dt-value-space"/> of the datatype defined will be the
union of the <termref def="dt-value-space"/>s of each datatype in
<propref ref="defn-memberTypes"/>.
</p>
<p>
If <propref ref="defn-variety"/> is <termref def="dt-atomic"/>
then the <propref ref="defn-variety"/> of <propref ref="defn-basetype"/>
must be <termref def="dt-atomic"/>.
If <propref ref="defn-variety"/> is <termref def="dt-list"/>
then the <propref ref="defn-variety"/> of <propref ref="defn-itemType"/>
must be either <termref def="dt-atomic"/> or <termref def="dt-union"/>.
If <propref ref="defn-variety"/> is <termref def="dt-union"/>
then
<propref ref="defn-memberTypes"/> must be a list of datatype definitions.
</p>
<p>
The value of <propref ref="defn-facets"/> consists of the set of
<termref def="dt-facet"/>s specified directly in the datatype definition
unioned with the possibly empty set of <propref ref="defn-facets"/> of
<propref ref="defn-basetype"/>.
</p>
<p>
The value of <propref ref="defn-fund-facets"/> consists of the set of
<termref def="dt-fundamental-facet"/>s and their values.
</p>
<p>
If <propref ref="defn-final"/> is the empty set then the type can be used
in deriving other types; the explicit values <emph>restriction</emph>,
<emph>list</emph> and <emph>union</emph> prevent further derivations
by <termref def="dt-restriction"/>, <termref def="dt-list"/> and
<termref def="dt-union"/> respectively.
</p>
</div3>

<div3 role="1.0" id="xr-defn">
<head>XML Representation of Simple Type Definition Schema Components</head>

<p>
The XML representation for a <compref ref="dc-defn"/> schema component
is a <eltref ref="simpleType"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>
<reprdef>
 <reprelt eltname="simpleType"/>
<reprcomp abstract="Datatype Definition" ref="dc-defn">
<propmap name="defn-name">
The &v-value; of the <code>name</code>&nbsp;&i-attribute;, if present,
otherwise <xtermref href="&xsdl;#key-null">null</xtermref>
</propmap>
<propmap name="defn-final">
A set corresponding to the &v-value; of the
<code>final</code> &i-attribute;, if present, otherwise
 the &v-value; of the
<code>finalDefault</code> &i-attribute; of the ancestor
<xtermref href="&xsdl;#element-schema">schema</xtermref>
element information item, if present, otherwise the empty string, as follows:
   <glist>
    <gitem>
     <label>the empty string</label>
     <def>
<p>the empty set;</p>
     </def>
    </gitem>
    <gitem>
     <label>
      <code>#all</code>
     </label>
     <def>
      <p><emph>{restriction, list, union}</emph>;</p>
     </def>
    </gitem>
    <gitem>
     <label><emph>otherwise</emph></label>
     <def>
      <p>a set with members drawn from the set above, each being present or
absent depending on whether the string contains an equivalently named
space-delimited substring.</p>
      <note>
       <p>Although the <code>finalDefault</code> &i-attribute; of
       <xtermref href="&xsdl;#element-schema">schema</xtermref> may include
       values other than
       <pt>restriction</pt>, <pt>list</pt> or <pt>union</pt>, those values
       are ignored in the determination of <propref ref="defn-final"/>
       </p>
      </note>
     </def>
    </gitem>
   </glist>
</propmap>
<propmap name="defn-target-namespace">
The &v-value; of the <code>targetNamespace</code> &i-attribute;
of the parent <code>schema</code> element information item.
</propmap>
<propmap name="defn-annotation">
The annotation corresponding to the <eltref ref="annotation"/>
element information item in the &i-children;, if present, otherwise
<xspecref href="&xsdl;#key-null">null</xspecref>
</propmap>
</reprcomp>
</reprdef>
<p>
A <termref def="dt-derived"/> datatype can be <termref def="dt-derived"/>
from a <termref def="dt-primitive"/> datatype or another
<termref def="dt-derived"/> datatype by one of three means:
by <emph>restriction</emph>, by <emph>list</emph> or by <emph>union</emph>.
</p>

<div4 role="1.0" id="derivation-by-restriction">
<head>Derivation by restriction</head>
<reprdef>
<reprelt eltname="restriction"/>
<reprcomp abstract="Simple Type Definition" ref="dc-defn">
<propmap name="defn-variety">
The &v-value; of <propref ref="defn-variety"/> of <propref ref="defn-basetype"/>
</propmap>
<propmap name="defn-facets">
The union of the set of <specref ref="facets"/> components
resolved to by the facet &i-children; merged with <propref ref="defn-facets"/>
from <propref ref="defn-basetype"/>, subject to the Facet Restriction Valid
constraints specified in <specref ref="facets"/>.
</propmap>
<propmap name="defn-basetype">
The <compref ref="dc-defn"/> component resolved to by the &v-value; of the
<code>base</code> &i-attribute; or the <eltref ref="simpleType"/> &i-children;,
whichever is present.
</propmap>
</reprcomp>
</reprdef>

<note role="example">
<p>
An electronic commerce schema might define a datatype called
<emph>Sku</emph> (the barcode number that appears on products) from the
<termref def="dt-built-in"/> datatype <dtref ref="string"/> by
supplying a value for the <termref def="dt-pattern"/> facet.
</p>
<eg><![CDATA[<simpleType name='Sku'>
    <restriction base='string'>
      <pattern value='\d{3}-[A-Z]{2}'/>
    </restriction>
</simpleType>]]></eg>
<p>
In this case, <emph>Sku</emph> is the name of the new
<termref def="dt-user-derived"/> datatype, <dtref ref="string"/> is
its <termref def="dt-basetype"/> and <termref def="dt-pattern"/>
is the facet.
</p>
</note>

</div4>

<div4 role="1.0" id="derivation-by-list">
<head>Derivation by list</head>
<reprdef>
 <reprelt eltname="list"/>
<reprcomp abstract="Simple Type Definition" ref="dc-defn">
<propmap name="defn-variety">
list
</propmap>
<propmap name="defn-itemType">
The <compref ref="dc-defn"/> component resolved to by the &v-value; of the
<code>itemType</code> &i-attribute;
or the <eltref ref="simpleType"/> &i-children;,
whichever is present.
</propmap>
</reprcomp>
</reprdef>

<p>
A <termref def="dt-list"/> datatype must be <termref def="dt-derived"/>
from an <termref def="dt-atomic"/> or a <termref def="dt-union"/> datatype,
known as the
<termref def="dt-itemType"/> of the <termref def="dt-list"/> datatype.
This yields a datatype whose <termref def="dt-value-space"/> is composed of
finite-length sequences of values from the <termref def="dt-value-space"/> of the
<termref def="dt-itemType"/> and whose <termref def="dt-lexical-space"/> is
composed of space-separated lists of literals of the
<termref def="dt-itemType"/>.
</p>
<note role="example">
<p>
A system might want to store lists of floating point values.
</p>
<eg><![CDATA[<simpleType name='listOfFloat'>
  <list itemType='float'/>
</simpleType>
]]></eg>
<p>
In this case, <emph>listOfFloat</emph> is the name of the new
<termref def="dt-user-derived"/> datatype, <dtref ref="float"/> is its
<termref def="dt-itemType"/> and <termref def="dt-list"/> is the
derivation method.
</p>
</note>
<p>
As mentioned in <specref ref="list-datatypes"/>,
when a datatype is <termref def="dt-derived"/> from a
<termref def="dt-list"/> datatype, the following
<termref def="dt-constraining-facet"/>s can be used:
</p>
<ulist>
<item><p><termref def="dt-length"/></p></item>
<item><p><termref def="dt-maxLength"/></p></item>
<item><p><termref def="dt-minLength"/></p></item>
<item><p><termref def="dt-enumeration"/></p></item>
<item><p><termref def="dt-pattern"/></p></item>
<item><p><termref def="dt-whiteSpace"/></p></item>
</ulist>
<p>
regardless of the <termref def="dt-constraining-facet"/>s that are applicable
to the <termref def="dt-atomic"/> datatype that serves as the
<termref def="dt-itemType"/> of the <termref def="dt-list"/>.
</p>
<p>
For each of <termref def="dt-length"/>, <termref def="dt-maxLength"/>
and <termref def="dt-minLength"/>, the
<emph>unit of length</emph> is measured in number of list items.
The value of <termref def="dt-whiteSpace"/>
is fixed to the value <emph>collapse</emph>.</p>
</div4>

<div4 role="1.0" id="derivation-by-union">
<head>Derivation by union</head>
<reprdef>
 <reprelt eltname="union"/>
<reprcomp abstract="Simple Type Definition" ref="dc-defn">
<propmap name="defn-variety">
union
</propmap>
<propmap name="defn-memberTypes">
The sequence of <compref ref="dc-defn"/> components resolved to by the
items in the &v-value; of the
<code>memberTypes</code> &i-attribute;, if any,
in order, followed by the <compref ref="dc-defn"/> components resolved to by the
<eltref ref="simpleType"/> &i-children;, if any, in order.
If <propref ref="defn-variety"/> is <emph>union</emph> for
any <compref ref="dc-defn"/> components resolved to above, then
the <compref ref="dc-defn"/> is replaced by its
<propref ref="defn-memberTypes"/>.
</propmap>
</reprcomp>
</reprdef>

<p>
A <termref def="dt-union"/> datatype can be <termref def="dt-derived"/>
from one or more <termref def="dt-atomic"/>, <termref def="dt-list"/> or
other <termref def="dt-union"/> datatypes, known as the <termref def="dt-memberTypes"/>
of that <termref def="dt-union"/> datatype.
</p>
<note role="example">
<p>
As an example, taken from a typical display oriented text markup language,
one might want to express font sizes as an integer between 8 and 72, or with
one of the tokens "small", "medium" or "large".&nbsp; The <termref def="dt-union"/>
type definition below would accomplish that.
</p>
<eg><![CDATA[
<xsd:attribute name="size">
  <xsd:simpleType>
    <xsd:union>
      <xsd:simpleType>
        <xsd:restriction base="xsd:positiveInteger">
          <xsd:minInclusive value="8"/>
          <xsd:maxInclusive value="72"/>
        </xsd:restriction>
      </xsd:simpleType>
      <xsd:simpleType>
        <xsd:restriction base="xsd:NMTOKEN">
          <xsd:enumeration value="small"/>
          <xsd:enumeration value="medium"/>
          <xsd:enumeration value="large"/>
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:union>
  </xsd:simpleType>
</xsd:attribute>
]]></eg>
<eg><![CDATA[
<p>
<font size='large'>A header</font>
</p>
<p>
<font size='12'>this is a test</font>
</p>
]]></eg>
</note>
<p>
As mentioned in <specref ref="union-datatypes"/>,
when a datatype is <termref def="dt-derived"/> from a
<termref def="dt-union"/> datatype, the only following
<termref def="dt-constraining-facet"/>s can be used:
</p>
<ulist>
<item><p><termref def="dt-pattern"/></p></item>
<item><p><termref def="dt-enumeration"/></p></item>
</ulist>
<p>
regardless of the <termref def="dt-constraining-facet"/>s that are
applicable to the datatypes that participate in the <termref def="dt-union"/>
</p>
</div4>
</div3>

<div3 role="1.0" id="defn-rep-constr">
<head>Constraints on XML Representation of Simple Type Definition</head>

<constraintnote type="src" id="src-single-facet-value">
<head>Single Facet Value</head>
<p>
Unless otherwise specifically allowed by this specification
(<specref ref="src-multiple-patterns"/> and
<specref ref="src-multiple-enumerations"/>) any given
<termref def="dt-constraining-facet"/> can only be specifed once within
a single derivation step.
</p>
</constraintnote>

<constraintnote type="src" id="src-list-itemType-or-simpleType">
<head>itemType attribute or simpleType child</head>
<p>
Either the <code>itemType</code> &i-attribute; or the
<eltref ref="simpleType"/> &i-child; of the <eltref ref="list"/> element
must be present, but not both.
</p>
</constraintnote>

<constraintnote type="src" id="src-restriction-base-or-simpleType">
<head>base attribute or simpleType child</head>
<p>
Either the <code>base</code> &i-attribute; or the
<code>simpleType</code> &i-child; of the <eltref ref="restriction"/>
element must be present, but not both.
</p>
</constraintnote>

<constraintnote type="src" id="src-union-memberTypes-or-simpleTypes">
<head>memberTypes attribute or simpleType children</head>
<p>
Either the <code>memberTypes</code> &i-attribute; of the <eltref ref="union"/>
element must be non-empty or
there must be at least one <code>simpleType</code> &i-child;.
</p>
</constraintnote>
</div3>

<div3 role="1.0" id="defn-validation-rules">
<head>Simple Type Definition Validation Rules</head>

<constraintnote type="cvc" id="cvc-facet-valid">
<head>Facet Valid</head>
<p>
A value in a <termref def="dt-value-space"/> is facet-valid with
respect to a <termref def="dt-constraining-facet"/> component if:
</p>
<olist>
<item>
<p>
the value is facet-valid with respect to the particular
<termref def="dt-constraining-facet"/> as specified below.
</p>
</item>
</olist>
</constraintnote>

<constraintnote type="cvc" id="cvc-datatype-valid">
<head>Datatype Valid</head>
<p>
A string is datatype-valid with respect to a datatype definition if:
</p>
<olist>
	<item>
		<p>
		it <termref def="dt-match"/>es a literal in the
		<termref def="dt-lexical-space"/> of the datatype, determined as follows:
		</p>
		<olist>
			<item>
				<p>
				if <termref def="dt-pattern"/> is a member of <propref ref="defn-facets"/>,
				then the string must be <specref ref="cvc-pattern-valid"/>;
				</p>
			</item>
			<item>
				<p>
				if <termref def="dt-pattern"/> is not a member of <propref ref="defn-facets"/>,
				then
				</p>
				<olist>
					<item>
						<p>
						if <propref ref="defn-variety"/> is <termref def="dt-atomic"/> then
						the string must <termref def="dt-match"/> a literal in the
						<termref def="dt-lexical-space"/> of <propref ref="defn-basetype"/>
						</p>
					</item>
					<item>
						<p>
						if <propref
ref="defn-variety"/> is <termref def="dt-list"/> then the string must
be a sequence of space-separated tokens, each of which <termref
def="dt-match"/>es a literal in the <termref def="dt-lexical-space"/>
of <propref ref="defn-itemType"/>
						</p>
					</item>
					<item>
						<p>
						if <propref ref="defn-variety"/> is <termref def="dt-union"/> then
						the string must <termref def="dt-match"/> a literal in the
						<termref def="dt-lexical-space"/> of at least one member of
						<propref ref="defn-memberTypes"/>
						</p>
					</item>
				</olist>
			</item>
		</olist>
	</item>
	<item>
		<p>
		the value denoted by the literal <termref def="dt-match"/>ed in the previous step
		is a member of the <termref def="dt-value-space"/> of the datatype, as determined
		by it being <specref ref="cvc-facet-valid"/>
		with respect to each member of <propref ref="defn-facets"/> (except
		for <termref def="dt-pattern"/>).
		</p>
	</item>
</olist>
</constraintnote>
</div3>

<div3 role="1.0" id="defn-coss">
<head>Constraints on Simple Type Definition Schema Components</head>

<constraintnote type="cos" id="cos-applicable-facets">
<head>applicable facets</head>

<p>
The <termref def="dt-constraining-facet"/>s which are allowed
to be members of <propref ref="defn-facets"/> are dependent on
<propref ref="defn-basetype"/> as specified in the following table:
</p>
<applicable-facets/>
</constraintnote>

<constraintnote type="cos" id="cos-list-of-atomic">
<head>list of atomic</head>
<p>
If <propref ref="defn-variety"/> is <termref def="dt-list"/>, then
the <propref ref="defn-variety"/> of <propref ref="defn-itemType"/>
&nbsp;<termref def="dt-must"/> be <termref def="dt-atomic"/> or
<termref def="dt-union"/>.
</p>
</constraintnote>

<constraintnote type="cos" id="cos-no-circular-unions">
<head>no circular unions</head>
<p>
If <propref ref="defn-variety"/> is <termref def="dt-union"/>,
then
it is an <termref def="dt-error"/> if
<propref ref="defn-name"/> and <propref ref="defn-target-namespace"/>
&nbsp;<termref def="dt-match"/>&nbsp;<propref ref="defn-name"/>
and <propref ref="defn-target-namespace"/> of any member of
<propref ref="defn-memberTypes"/>.
</p>
</constraintnote>
</div3>

<div3 role="1.0" id="anySimpleType-component">
<head>Simple Type Definition for anySimpleType</head>
<p>
There is a simple type definition nearly equivalent to the simple version
of the <xtermref href="&xsdl;#key-urType">ur-type definition</xtermref> present
in every schema by definition.&nbsp; It has the following properties:
</p>
<compdef name="anySimpleType" ref="dt-anySimpleType">
<proplist>
<propdef id="anySimpleType-name" name="name">
anySimpleType
</propdef>
<propdef id="anySimpleType-target_namespace" name="target namespace">
http://www.w3.org/2001/XMLSchema
</propdef>
<propdef id="anySimpleType-basetype" name="basetype definition">
<xtermref href="&xsdl;#ur-type-itself">the ur-type definition</xtermref>
</propdef>
<propdef id="anySimpleType-final" name="final">
the empty set
</propdef>
<propdef id="anySimpleType-variety" name="variety">
<xtermref href="&xsdl;#key-null">absent</xtermref>
</propdef>
</proplist>
</compdef>
</div3>
</div2>

<div2 id="rf-fund-facets-delled" diff="del">
<head>Fundamental Facets</head>

<div3 id="equal">
<head>equal</head>
<p>
Every <termref def="dt-value-space"/> supports the notion of equality,
with the following rules:
</p>
<ulist>
<item>
<p>
for any <emph role="eq">a</emph> and <emph role="eq">b</emph> in
the <termref def="dt-value-space"/>,
either <emph role="eq">a</emph> is equal to <emph role="eq">b</emph>,
denoted <emph role="eq">a = b</emph>, or <emph role="eq">a</emph>
is not equal to <emph role="eq">b</emph>, denoted <emph role="eq">a != b</emph>
</p>
</item>
<item>
<p>
there is no pair <emph role="eq">a</emph> and <emph role="eq">b</emph>
from the <termref def="dt-value-space"/> such that both
<emph role="eq">a = b</emph> and <emph role="eq">a != b</emph>
</p>
</item>
<item>
<p>
for all <emph role="eq">a</emph> in the <termref def="dt-value-space"/>,
<emph role="eq">a = a</emph>
</p>
</item>
<item>
<p>
for any <emph role="eq">a</emph> and <emph role="eq">b</emph>
in the <termref def="dt-value-space"/>,
<emph role="eq">a = b</emph> if and only if <emph role="eq">b = a</emph>
</p>
</item>
<item>
<p>
for any <emph role="eq">a</emph>, <emph role="eq">b</emph> and
<emph role="eq">c</emph> in the <termref def="dt-value-space"/>,
if <emph role="eq">a = b</emph> and
<emph role="eq">b = c</emph>, then <emph role="eq">a = c</emph>
</p>
</item>
<item>
<p>
for any <emph role="eq">a</emph> and <emph role="eq">b</emph>
in the <termref def="dt-value-space"/>
if <emph role="eq">a = b</emph>, then <emph role="eq">a</emph>
and <emph role="eq">b</emph> cannot be distinguished
(i.e., equality is identity)
</p>
</item>
<item><p>
the <termref def="dt-value-space"/>s of all
<termref def="dt-primitive"/> datatypes are disjoint (they do not
share any values)

</p></item>
</ulist>
<p>

</p>
<p>
On every datatype, the operation Equal is defined in terms of the equality
property of the <termref def="dt-value-space"/>: for any values
<emph role="eq">a, b</emph> drawn from the
<termref def="dt-value-space"/>, <emph role="eq">Equal(a,b)</emph> is
true if <emph role="eq">a = b</emph>, and false otherwise.
</p>

<p>
Note that in consequence of the above:
</p>
<ulist>
<item>
<p>given <termref def="dt-value-space"/>&nbsp;<emph role="eq">A</emph> and
<termref def="dt-value-space"/>&nbsp;<emph role="eq">B</emph> where
<emph role="eq">A</emph> and <emph role="eq">B</emph> are disjoint,
every pair of values <emph role="eq">a</emph> from <emph role="eq">A</emph>
and <emph role="eq">b</emph> from <emph role="eq">B</emph>,
<emph role="eq">a != b</emph></p>
</item>
<item><p>
two values which are members of the <termref def="dt-value-space"/>
of the same <termref def="dt-primitive"/> datatype may always be
compared with each other
</p></item>
<item><p>
if a datatype <emph role="eq">T</emph> is
<termref def="dt-derived"/> by <termref def="dt-union"/> from
<termref def="dt-memberTypes"/>&nbsp;<emph role="eq">A, B, ...</emph>
then the <termref def="dt-value-space"/> of <emph role="eq">T</emph> is the
union of <termref def="dt-value-space"/>s of its
<termref def="dt-memberTypes"/>&nbsp;<emph role="eq">A, B, ...</emph>.
Some values in the <termref def="dt-value-space"/> of
<emph role="eq">T</emph> are also values in the
<termref def="dt-value-space"/> of <emph role="eq">A</emph>.
Other values in the <termref def="dt-value-space"/> of
<emph role="eq">T</emph> will be values in the
<termref def="dt-value-space"/> of <emph role="eq">B</emph> and so on.
Values in the <termref def="dt-value-space"/> of <emph role="eq">T</emph>
which are also in the <termref def="dt-value-space"/> of
<emph role="eq">A</emph> can be compared with other values in the
<termref def="dt-value-space"/> of <emph role="eq">A</emph> according
to the above rules.&nbsp; Similarly for values of type
<emph role="eq">T</emph> and <emph role="eq">B</emph> and all the other
<termref def="dt-memberTypes"/>.
</p></item>
 <item><p>
if a datatype <emph role="eq">T'</emph> is <termref def="dt-derived"/>
by <termref def="dt-restriction"/> from an atomic datatype <emph role="eq">T</emph>
then the <termref def="dt-value-space"/> of <emph role="eq">T'</emph> is
a subset of the <termref def="dt-value-space"/> of <emph role="eq">T</emph>.
Values in the <termref def="dt-value-space"/>s of
<emph role="eq">T</emph> and <emph role="eq">T'</emph> can be compared
according to the above rules
</p></item>
<item><p>
if datatypes <emph role="eq">T'</emph> and <emph role="eq">T''</emph> are
<termref def="dt-derived"/> by <termref def="dt-restriction"/> from a
common atomic ancestor <emph role="eq">T</emph> then the
<termref def="dt-value-space"/>s of <emph role="eq">T'</emph> and
<emph role="eq">T''</emph> may overlap. Values in the
<termref def="dt-value-space"/>s
of <emph role="eq">T'</emph> and <emph role="eq">T''</emph> can be
compared according to the above rules
</p></item>
</ulist>

<note>
<p>
There is no schema component corresponding to the <term>equal</term>
<termref def="dt-fundamental-facet"/>.
</p>
</note>
</div3>
</div2>

<div2 id="rf-fund-facets">
<head alt="Information Facets"><phrase diff="add"><termref def="dt-fundamental-facet">Information Facets</termref></phrase></head>

<!--ednote><edtext>I have changed the targets of some hot links, and changed some hot-button property
values from defined terms to "preterminals", since the property values are the preterminals, not
the terms defining their semantics.&nbsp; It was not convenient to mark all of these with
adds/dels.&emsp; –DP</edtext></ednote-->

<p diff="add">(<termref def="dt-fundamental-facet">Information facets</termref> were called "fundamental facets" in
the 1.0 version of this specification.)&nbsp; The purpose of an <termref def="dt-fundamental-facet"></termref>
is to provide a limited piece of information about some aspect
of a datatype.&nbsp; Most <termref def="dt-fundamental-facet">information facets</termref> are given a value
fixed with each primitive datatype's definition, and this value is not changed by
subsequent <termref def="dt-derived">derivations</termref> (even when
it would perhaps be reasonable to expect an application to give a more accurate value based
on the &cfacet;s used to define the <termref def="dt-derived">derivation</termref>).&nbsp; The
<compref ref="dc-cardinality"/>  and <compref ref="dc-bounded"/> facets
are exceptions to this rule; their values may change as a result of certain
<termref def="dt-derived">derivations</termref>.</p>

<note diff="add">
<p>Schema components are identified by kind.&nbsp; <quote>Information</quote> 
is not a kind of component.&nbsp; Each kind of <termref def="dt-fundamental-facet"></termref>
(<quote>ordered</quote>, 
<quote>bounded</quote>, etc.) is realized as a separate kind of schema component. </p>
</note>

<!--ednote><edtext>The WG agreed long ago to use 'information' rather than 'fundamental' to describe fundamental
facets.&nbsp; (We did not come to an agreement on 'controlling' vs 'constraining', and I agreed to make all
references with an entity reference so that we can revert all occurrences readily.)&nbsp; The question here
is:&nbsp; Should we change the simple type property from "{fundamental facets}" to "{information
facets}"?&emsp; &mdash;DP</edtext></ednote-->

<p diff="add">An <termref def="dt-fundamental-facet"></termref> component can occur only
in the <propref ref="defn-fund-facets"/> of a <compref ref="dc-defn"/>, and this is the
only place where <termref def="dt-fundamental-facet"></termref> components
occur.&nbsp; <termdef term="parent" id="dt-info-facet-parent" role="local">The
<compref ref="dc-defn"/> in whose <propref ref="defn-fund-facets"/> an
<termref def="dt-fundamental-facet"></termref> component occurs is that
component&apos;s <term>parent</term>.</termdef>&nbsp; Each kind of <termref def="dt-fundamental-facet"></termref>
component occurs (once) in each <compref ref="dc-defn"/>&apos;s <propref ref="defn-fund-facets"/> set.</p>

<note diff="add">
<p>The value of any <termref def="dt-fundamental-facet"></termref> component can always
be calculated from other properties of its <termref def="dt-info-facet-parent"></termref>.</p></note>

<div3 id="rf-ordered"><head>ordered</head>

<p diff="del">
<termdef id="dt-order-relation" term="order-relation">An
<term>order relation</term> on a <termref def="dt-value-space"/>
is a mathematical relation that imposes a
<termref def="dt-total-order"/> or a <termref def="dt-partial-order"/> on the
members of the <termref def="dt-value-space"/>.
</termdef>
</p>
<p diff="del">
<termdef id="dt-ordered" term="ordered">A
<termref def="dt-value-space"/>, and hence a datatype, is said to be
<term>ordered</term> if there exists an
<termref def="dt-order-relation"/> defined for that
<termref def="dt-value-space"/>.
</termdef>
</p>
<p diff="del">
<termdef id="dt-partial-order" term="partial order">
A <term>partial order</term> is an <termref def="dt-order-relation"/>
that is <term>irreflexive</term>, <term>asymmetric</term> and
<term>transitive</term>.
</termdef>
</p>
<p diff="del">
A <termref def="dt-partial-order"/> has the following properties:
</p>
<ulist diff="del">
<item>
<p>
<!--
a R a
-->
for no <emph role="eq">a</emph> in the <termref def="dt-value-space"/>,
<emph role="eq">a &lt; a</emph>
(irreflexivity)
</p>
</item>
<item>
<p>
<!--
a R b implies not(b R a)
-->
for all <emph role="eq">a</emph> and <emph role="eq">b</emph>
in the <termref def="dt-value-space"/>,
<emph role="eq">a &lt; b</emph>
implies not(<emph role="eq">b &lt; a</emph>)
(asymmetry)
</p>
</item>
<item>
<p>
<!--
a R b and b R c implies a R c
-->
for all <emph role="eq">a</emph>, <emph role="eq">b</emph>
and <emph role="eq">c</emph>  in the <termref def="dt-value-space"/>,
<emph role="eq">a &lt; b</emph> and <emph role="eq">b &lt; c</emph>
implies <emph role="eq">a &lt; c</emph>
(transitivity)
</p>
</item>
<!--
Toys R Us
-->
<!--
<p>
for all <emph role='eq'>Toys</emph> and <emph role='eq'>Us</emph>
 in the <termref def='dt-value-space'/>,
<emph role='eq'>Toys &lt; Us</emph>
(jeffreyity)
</p>
</item>
-->
</ulist>

<p diff="del">
The notation <emph role="eq">a &lt;&gt; b</emph> is used to indicate the
case when <emph role="eq">a != b</emph> and neither
<emph role="eq">a &lt; b</emph> nor <emph role="eq">b &lt; a</emph>.

For any values <emph role="eq">a</emph> and <emph role="eq">b</emph>
from different <termref def="dt-primitive"/>&nbsp;<termref def="dt-value-space"/>s,
<emph role="eq">a &lt;&gt; b</emph>.
</p>
 <p diff="del"><termdef id="dt-incomparable-delled" term="incomparable">When  <emph role="eq">a &lt;&gt; b</emph>, <emph role="eq">a</emph> and <emph role="eq">b</emph> are <term>incomparable</term>,</termdef><termdef id="dt-comparable" term="comparable">otherwise they are <term>comparable</term>.</termdef></p>
<p diff="del">
<termdef id="dt-total-order" term="total order">
A <term>total order</term> is an <termref def="dt-partial-order"/>
such that for no <emph role="eq">a</emph> and <emph role="eq">b</emph>
is it the case that <emph role="eq">a &lt;&gt; b</emph>.
</termdef>
</p>
<p diff="del">
A <termref def="dt-total-order"/> has all of the properties specified
above for <termref def="dt-partial-order"/>, plus
the following property:
</p>
<ulist diff="del">
<item>
<!--
a R b or b R a
-->
<p>
for all <emph role="eq">a</emph> and <emph role="eq">b</emph>
 in the <termref def="dt-value-space"/>,
either <emph role="eq">a &lt; b</emph> or <emph role="eq">b &lt; a</emph>
or <emph role="eq">a = b</emph>
</p>
</item>
</ulist>
<note diff="del">
<p>
The fact that this specification does not define an
<termref def="dt-order-relation"/> for some datatype does not
mean that some other application cannot treat that datatype as
being ordered by imposing its own order relation.
</p>
</note>

<p diff="del">
<termref def="dt-ordered"/> provides for:
</p>
<ulist diff="del">
<item>
<p>
indicating whether an <termref def="dt-order-relation"/> is
defined on a <termref def="dt-value-space"/>, and if so,
whether that <termref def="dt-order-relation"/> is
a <termref def="dt-partial-order"/> or a <termref def="dt-total-order"/>
</p>
</item>
</ulist>

<p diff="add">Some datatypes have a nontrivial order relation associated with
their value spaces (see <specref ref="order"/>).&nbsp; (There is always a
<emph>trivial</emph> partial ordering wherein every value pair that is not
equal is incomparable, which could be associated with any value space.)&nbsp; The
<emph>ordered</emph> facet value is a "near-boolean": one of <pt>false</pt>,
<pt>partial</pt>, and <pt>total</pt>, as prescribed in <specref ref="app-fundamental-facets"/>
for <termref def="dt-primitive"></termref> datatypes;
all <termref def="dt-derived"></termref> datatypes inherit this value without change.&nbsp; The
vale for a  and <termref def="dt-list"></termref> is always <pt>false</pt>
and the value for a <termref def="dt-union"></termref> is computed as described below.</p>

<p diff="add">A <pt>false</pt> value means no order is prescribed; a <pt>total</pt> value
assures that the prescribed order is a total
order; a <pt>partial</pt> value means there is no simple means prescribed to be sure
the prescribed order is either tivial or total based on the
<termref def="dt-derived">derivation</termref> mechanism.</p>

<note diff="add">
<p>Some of the <quote>real-world</quote> datatypes which are the basis for those defined herein
are ordered in some applications, even though no order is prescribed for schema-processing
purposes.&nbsp; For example, <dtref ref="boolean"/> is sometimes ordered, and <dtref ref="string"/>
and <termref def="dt-list"></termref> datatypes <termref def="dt-constructed"></termref> from
ordered <termref def="dt-atomic"></termref> datatypes are sometimes given <quote>lexical</quote>
orderings.&nbsp; They are <emph>not</emph> ordered for schema-processing purposes.</p>
</note>

<div4 id="dc-ordered"><head>The ordered Schema Component</head>

<compdef name="ordered" ref="dc-ordered">
<proplist>
<propdef id="ordered-value" name="value">
One of {<pt>false</pt>, <pt>partial</pt>, <pt>total</pt>}.
</propdef>
</proplist>
</compdef>

<ednote><edtext>The writeup here has been changed to look more like the way logic is currently presented in
Part 1.&nbsp; Some find it <emph>harder</emph> to understand.&nbsp; The editors are trying to
harmonize the two.&nbsp; Until this is sorted out in "editors' committee", the other
facet writeups are not going to change.&nbsp; This will not occur before second working draft.</edtext></ednote>

<p diff="del">
<propref ref="ordered-value"/> depends on <propref ref="defn-variety"/>,
<propref ref="defn-facets"/> and <propref ref="defn-memberTypes"/>
in the <compref ref="dc-defn"/> component in which a
<termref def="dt-ordered"/> component appears as a member of
<propref ref="defn-fund-facets"/>.
</p>

<p diff="del">
When <propref ref="defn-variety"/> is <termref def="dt-atomic"/>,
<propref ref="ordered-value"/> is inherited from
<propref ref="ordered-value"/> of <propref ref="defn-basetype"/>.
For all <termref def="dt-primitive"/> types <propref ref="numeric-value"/>
is as specified	in the table in <specref ref="app-fundamental-facets"/>.
</p>
<p diff="del">
When <propref ref="defn-variety"/> is <termref def="dt-list"/>,
<propref ref="ordered-value"/> is <emph>false</emph>.
</p>

<p diff="del">
When <propref ref="defn-variety"/> is <termref def="dt-union"/>,

<propref ref="ordered-value"/> is <emph>partial</emph> unless one of the
following:
</p>
<ulist diff="del">
<item>
<p>
If every member of <propref ref="defn-memberTypes"/> is derived from
a common ancestor other than the simple ur-type, then <propref ref="ordered-value"/>
is the same as that ancestor's <term>ordered</term> facet
</p>
</item>
<item>
<p>
If every member of <propref ref="defn-memberTypes"/> has a
<propref ref="ordered-value"/> of <emph>false</emph> for the <term>ordered</term>
facet, then <propref ref="ordered-value"/> is <emph>false</emph></p>
</item>
</ulist>


<p diff="add"><propref ref="ordered-value"/> depends on the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-variety"/>,
<propref ref="defn-facets"/> and <propref ref="defn-memberTypes"/>.

<olist role="Case">
<item id="x04042a"><p role="if">the <termref def="dt-info-facet-parent">parent&apos;s</termref>
<propref ref="defn-variety"/> is <pt>atomic</pt></p>
<p role="then">
 <olist role="case">
 <item id="x040428b">
 <p role="if">the <termref def="dt-info-facet-parent"></termref> is <termref def="dt-primitive"></termref></p>
 <p role="then"><propref ref="ordered-value"/> is as specified in the
table in <specref ref="app-fundamental-facets"/>.</p>
 </item>

 <item>
 <p role="otherwise"><propref ref="ordered-value"/> is the <termref def="dt-info-facet-parent">parent&apos;s</termref>
<propref ref="defn-basetype"/>'s <compref ref="dc-ordered"/> <propref ref="ordered-value"/>.</p>
 </item>
 </olist>
</p>
</item>

<item>
<p role="if">the <termref def="dt-info-facet-parent">parent&apos;s</termref>
<propref ref="defn-variety"/> is <pt>list</pt></p>
<p role="then"><propref ref="ordered-value"/> is <pt>false</pt>.</p>
</item>

<item>
<p role="otherwise">the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-variety"/> is <pt>union</pt>;
 <olist role="case">
 <item id="x040428">
 <p role="if">every member of the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-memberTypes"/> is derived from a common ancestor
other than the simple ur-type</p>
 <p role="then"><propref ref="ordered-value"/> is the same as the <compref ref="dc-ordered"/>
component&apos;s <propref ref="ordered-value"/> in that common ancestor&apos;s <propref ref="defn-fund-facets"/>.</p>
 </item>

 <item>
 <p role="if">each member of the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-memberTypes"/> has an <compref ref="dc-ordered"/> component in its 
<propref ref="defn-fund-facets"/> whose <propref ref="ordered-value"/> is <pt>false</pt></p>
 <p role="then"><propref ref="ordered-value"/> is <pt>false</pt>.</p>
 </item>

 <item>
 <p role="otherwise"><propref ref="ordered-value"/> is <pt>partial</pt>.</p>
 </item>
 </olist>
</p>
</item>
</olist>

</p>
</div4>
</div3>

<div3 id="rf-bounded">
<head>bounded</head>

<p diff="del">
<termdef id="dt-inclusive-upper-bound" term="inclusive upper bound">
A value <emph role="eq">u</emph> in an <termref def="dt-ordered"/>
&nbsp;<termref def="dt-value-space"/>&nbsp;<emph role="eq">U</emph>
is said to be an <term>inclusive upper bound</term> of a
<termref def="dt-value-space"/>&nbsp;<emph role="eq">V</emph>
(where <emph role="eq">V</emph> is a subset of <emph role="eq">U</emph>)
if for all <emph role="eq">v</emph> in <emph role="eq">V</emph>,
<emph role="eq">u</emph> &gt;= <emph role="eq">v</emph>.
</termdef>
</p>
<p diff="del">
<termdef id="dt-exclusive-upper-bound" term="exclusive upper bound">
A value <emph role="eq">u</emph> in an <termref def="dt-ordered"/>
&nbsp;<termref def="dt-value-space"/>&nbsp;<emph role="eq">U</emph>
is said to be an <term>exclusive upper bound</term> of a
<termref def="dt-value-space"/>&nbsp;<emph role="eq">V</emph>
(where <emph role="eq">V</emph> is a subset of <emph role="eq">U</emph>)
if for all <emph role="eq">v</emph> in <emph role="eq">V</emph>,
<emph role="eq">u</emph> &gt; <emph role="eq">v</emph>.
</termdef>
</p>
<p diff="del">
<termdef id="dt-inclusive-lower-bound" term="inclusive lower bound">
A value <emph role="eq">l</emph> in an <termref def="dt-ordered"/>
&nbsp;<termref def="dt-value-space"/>&nbsp;<emph role="eq">L</emph>
is said to be an <term>inclusive lower bound</term> of a
<termref def="dt-value-space"/>&nbsp;<emph role="eq">V</emph>
(where <emph role="eq">V</emph> is a subset of <emph role="eq">L</emph>)
if for all <emph role="eq">v</emph> in <emph role="eq">V</emph>,
<emph role="eq">l</emph> &lt;= <emph role="eq">v</emph>.
</termdef>
</p>
<p diff="del">
<termdef id="dt-exclusive-lower-bound" term="exclusive lower bound">
A value <emph role="eq">l</emph> in an <termref def="dt-ordered"/>
&nbsp;<termref def="dt-value-space"/>&nbsp;<emph role="eq">L</emph>
is said to be an <term>exclusive lower bound</term> of a
<termref def="dt-value-space"/>&nbsp;<emph role="eq">V</emph>
(where <emph role="eq">V</emph> is a subset of <emph role="eq">L</emph>)
if for all <emph role="eq">v</emph> in <emph role="eq">V</emph>,
<emph role="eq">l</emph> &lt; <emph role="eq">v</emph>.
</termdef>
</p>
<p diff="del">
<termdef id="dt-bounded" term="bounded">A datatype is <term>bounded</term>
if its <termref def="dt-value-space"/> has either an
<termref def="dt-inclusive-upper-bound"/> or an <termref def="dt-exclusive-upper-bound"/>
and either an <termref def="dt-inclusive-lower-bound"/> or
 an
<termref def="dt-exclusive-lower-bound"/>.
</termdef>
</p>

<p diff="del">
<termref def="dt-bounded"/> provides for:
</p>
<ulist diff="del">
<item>
<p>
indicating whether a <termref def="dt-value-space"/> is
<termref def="dt-bounded"/>
</p>
</item>
</ulist>

<p diff="add">Some ordered datatypes have the property that there is one value greater than or equal to
every other value, and another that less than or equal to every other value.&nbsp; (In the case of derived
datatypes, these two values may not be in the value space of the derived datatype, but must be in the
value space of the primitive datatype from which they have been derived.)  The <emph>bounded</emph>
facet value is <dtref ref="boolean"/> and is generally <pt>true</pt> for such <emph>bounded</emph> 
datatypes.&nbsp; However, it will remain <pt>false</pt> when the mechanism for imposing such a bound
is difficult to detect, as, for example, when the boundedness occurs because of derivation using a
<compref ref="dc-pattern"/> component.</p>

<div4 id="dc-bounded">
<head>The bounded Schema Component</head>
<compdef name="bounded" ref="dc-bounded">
<proplist>
<propdef id="bounded-value" name="value">
A <dtref ref="boolean"/>.
</propdef>
</proplist>
</compdef>

<p><propref ref="bounded-value"/> depends on <phrase diff="add">the <termref def="dt-info-facet-parent">parent&apos;s</termref>
</phrase><propref ref="defn-variety"/>,
<propref ref="defn-facets"/> and <propref ref="defn-memberTypes"/><phrase diff="del">
in the <compref ref="dc-defn"/> component in which a
<compref ref="dc-bounded"/> component appears as a member of
<propref ref="defn-fund-facets"/></phrase>.</p><p>When <phrase diff="add">the <termref def="dt-info-facet-parent"></termref>
is <termref def="dt-primitive"></termref>, <propref ref="bounded-value"/> is as specified in the
table in <specref ref="app-fundamental-facets"/>.&nbsp; Otherwise, when the
<termref def="dt-info-facet-parent">parent&apos;s</termref> </phrase><propref ref="defn-variety"/> is <pt>atomic</pt>,
if one of <compref ref="dc-minInclusive"/> or <compref ref="dc-minExclusive"/>
and one of <compref ref="dc-maxInclusive"/> or <compref ref="dc-maxExclusive"/>
are <phrase diff="del">among <propref ref="defn-facets"/></phrase><phrase diff="add">members of
the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-facets"/> set</phrase>, then
<propref ref="bounded-value"/> is <pt>true</pt>;
<phrase diff="del">else</phrase><phrase diff="add">otherwise</phrase>
<propref ref="bounded-value"/> is <pt>false</pt>.</p>

<p>When <phrase diff="add">the <termref def="dt-info-facet-parent">parent&apos;s</termref>
</phrase><propref ref="defn-variety"/> is <pt>list</pt>,
<propref ref="bounded-value"/> is <pt>false</pt>.</p>

<p>
When the <phrase diff="add"><termref def="dt-info-facet-parent">parent&apos;s</termref>
</phrase><propref ref="defn-variety"/> is <pt>union</pt>,
if <propref ref="bounded-value"/> is <pt>true</pt>
for every member of <phrase diff="del"><propref ref="defn-memberTypes"/>and all members of
<propref ref="defn-memberTypes"/></phrase><phrase diff="add">the
<termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-memberTypes"/>
set and all of these</phrase> share
a common ancestor, then <propref ref="bounded-value"/> is <pt>true</pt>;
<phrase diff="del">else</phrase><phrase diff="add">otherwise</phrase>
<propref ref="bounded-value"/> is <pt>false</pt>.
</p>

</div4>
</div3>

<div3 id="rf-cardinality">
<head>cardinality</head>

<p diff="del">
<termdef id="dt-cardinality" term="cardinality">Every
<termref def="dt-value-space"/> has associated with it the concept of
<term>cardinality</term>.&nbsp; Some <termref def="dt-value-space"/>s
are finite, some are countably infinite while still others could
conceivably be uncountably infinite (although no <termref def="dt-value-space"/>
defined by this specification is uncountable infinite). A datatype is
said to have the cardinality of its
<termref def="dt-value-space"/>.
</termdef>
</p>
<p diff="del">
It
is sometimes useful to categorize <termref def="dt-value-space"/>s
(and hence, datatypes) as to their cardinality.&nbsp; There are two
significant cases:
</p>
<ulist diff="del">
<item>
<p>
<termref def="dt-value-space"/>s that are finite
</p>
</item>
<item>
<p>
<termref def="dt-value-space"/>s that are countably infinite
</p>
</item>
</ulist>

<p diff="del">
<termref def="dt-cardinality"/> provides for:
</p>
<ulist diff="del">
<item>
<p>
indicating whether the <termref def="dt-cardinality"/>
of a <termref def="dt-value-space"/> is
<emph>finite</emph> or <emph>countably infinite</emph>
</p>
</item>
</ulist>

<p diff="add">Every value space has a specific number of members.&nbsp; This number can be characterized as 
<emph>finite</emph> or <emph>infinite</emph>.&nbsp; (Currently there are no datatypes with infinite
value spaces larger than <emph>countable</emph>.)&nbsp; The <emph>cardinality</emph> facet value is
either <pt>finite</pt> or <pt>countably infinite</pt> and is generally <pt>finite</pt> for datatypes with
finite value spaces.&nbsp; However, it will remain <pt>countably infinite</pt> when the mechanism for
causing finiteness is difficult to detect, as, for example, when finiteness occurs because of a
derivation using a <compref ref="dc-pattern"/> component.</p>

<div4 id="dc-cardinality">
<head>The cardinality Schema Component</head>
<compdef name="cardinality" ref="dc-cardinality">
<proplist>
<propdef id="cardinality-value" name="value">
One of {<pt>finite</pt>,  <pt>countably infinite</pt>}.</propdef>
</proplist>
</compdef>

<p>
<propref ref="cardinality-value"/> depends on <phrase diff="add">the <termref def="dt-info-facet-parent">parent&apos;s</termref> </phrase><propref ref="defn-variety"/>,
<propref ref="defn-facets"/>, and <propref ref="defn-memberTypes"/><phrase diff="del">
in the <compref ref="dc-defn"/> component in which a
<compref ref="dc-cardinality"/> component appears as a member of
<propref ref="defn-fund-facets"/></phrase>.</p>

<p diff="del">
When <propref ref="defn-variety"/> is <termref def="dt-atomic"/> and
<propref ref="cardinality-value"/> of <propref ref="defn-basetype"/>
is <emph>finite</emph>, then <propref ref="cardinality-value"/> is
<emph>finite</emph>.
</p>

<p diff="del">When <propref ref="defn-variety"/> is <termref def="dt-atomic"/> and
<propref ref="cardinality-value"/> of <propref ref="defn-basetype"/>
is <emph>countably infinite</emph> and <strong>either</strong> of the following
conditions are true, then <propref ref="cardinality-value"/> is
<emph>finite</emph>; else <propref ref="cardinality-value"/>
is <emph>countably infinite</emph>:
</p>

<olist role="orval" diff="del">
<item>
<p>
one of <termref def="dt-length"/>, <termref def="dt-maxLength"/>,
<termref def="dt-totalDigits"/> is among <propref ref="defn-facets"/>,
</p>
</item>

<item>
<p>
<strong>all</strong> of the following are true:
</p>
<olist role="and">
<item>
<p>
one of <termref def="dt-minInclusive"/> or
<termref def="dt-minExclusive"/>
is among <propref ref="defn-facets"/>
</p>
</item>
<item>
<p>
one of <termref def="dt-maxInclusive"/> or
<termref def="dt-maxExclusive"/>
is among <propref ref="defn-facets"/>
</p>
</item>
<item>
<p>
<strong>either</strong> of the following are true:
</p>
<olist role="orval">
<item>
<p>
<termref def="dt-fractionDigits"/> is among <propref ref="defn-facets"/>
</p>
</item>
<item>
<p>
<propref ref="defn-basetype"/> is one of <dtref ref="date"/>,
<dtref ref="gYearMonth"/>, <dtref ref="gYear"/>, <dtref ref="gMonthDay"/>,
<dtref ref="gDay"/> or <dtref ref="gMonth"/> or any type <termref def="dt-derived"/>
from them
</p>
</item>
</olist>
</item>
</olist>
</item>
</olist>

<p diff="add">When the <termref def="dt-info-facet-parent"></termref> is
<termref def="dt-primitive"></termref>, <propref ref="cardinality-value"/> is as specified in the
table in <specref ref="app-fundamental-facets"/>.&nbsp; Otherwise, when
the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-variety"/> is <pt>atomic</pt>,
<propref ref="cardinality-value"/>
is <pt>countably infinite</pt> unless <strong>any</strong> of the following
conditions are true, in which case <propref ref="cardinality-value"/> is
<pt>finite</pt>:

<olist role="orval">
<item>
<p>the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-basetype"/>'s
<compref ref="dc-cardinality"/> <propref ref="cardinality-value"/> is <pt>finite</pt>,</p>
</item>

<item>
<p>at least one of <compref ref="dc-length"/>, <compref ref="dc-maxLength"/>,
or <compref ref="dc-totalDigits"/> is a member of the
<termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-facets"/> set,</p>
</item>

<item>
<p><strong>all</strong> of the following are true:</p>
 <olist role="and">
 <item>
 <p>one of <compref ref="dc-minInclusive"/> or <compref ref="dc-minExclusive"/>
is a member of the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-facets"/> set</p>
 </item>

 <item>
 <p>one of <compref ref="dc-maxInclusive"/> or <compref ref="dc-maxExclusive"/>
is a member of the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-facets"/> set</p>
</item>

 <item>
 <p><strong>either</strong> of the following are true:</p>
  <olist role="orval">
  <item>
  <p><compref ref="dc-fractionDigits"/> is a member of the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-facets"/> set</p>
  </item>

  <item>
  <p><propref ref="defn-primitive"/> is one of <dtref ref="date"/>,
  <dtref ref="gYearMonth"/>, <dtref ref="gYear"/>, <dtref ref="gMonthDay"/>,
  <dtref ref="gDay"/> or <dtref ref="gMonth"/></p>
  </item>
  </olist>
 </item>
 </olist>
</item>
</olist> 
 </p>

<!--ednote><edtext>The possible lists of items from an infinite itemType is inherently infinite even when the list length is bounded.&nbsp; This is a reported 1.0 bug.&nbsp; Alternatively, the description
of <specref ref="rf-cardinality"/> must be altered to indicate that, for lists, the facet applies not
to the value space but to the possible <termref def="dt-length">lengths</termref>
of the values in that value space.</edtext></ednote-->

<p>
When the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-variety"/> is <pt>list</pt>,
if <compref ref="dc-length"/> or both <phrase diff="del">of
</phrase><compref ref="dc-minLength"/> and <compref ref="dc-maxLength"/>
are <phrase diff="del">among <propref ref="defn-facets"/></phrase><phrase diff="add">members of the
<termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-facets"/> set
and the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-itemType"/>'s
<compref ref="dc-cardinality"/> <propref ref="cardinality-value"/> is <pt>finite</pt></phrase>
then <propref ref="cardinality-value"/> is <pt>finite</pt>;
<phrase diff="del">else</phrase><phrase diff="add">otherwise</phrase>
<propref ref="cardinality-value"/> is <pt>countably infinite</pt>.
</p>

<p>
When the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-variety"/> is <pt>union</pt>,
if <compref ref="dc-cardinality"/>&apos;s <propref ref="cardinality-value"/> is <emph>finite</emph>
for every member of <phrase diff="add">the <termref def="dt-info-facet-parent">parent&apos;s</termref> </phrase><propref ref="defn-memberTypes"/><phrase diff="add"> set</phrase> then
<propref ref="cardinality-value"/> is <pt>finite</pt>,
<phrase diff="del">else</phrase><phrase diff="add">otherwise</phrase> <propref ref="cardinality-value"/>
is <pt>countably infinite</pt>.
</p>
</div4>
</div3>

<div3 id="rf-numeric">
<head>numeric</head>

<p diff="del">
<termdef id="dt-numeric" term="numeric">A datatype is said to be
<term>numeric</term> if its values are conceptually quantities (in some
mathematical number system).
</termdef>
</p>
<p diff="del">
<termdef id="dt-non-numeric" term="non-numeric">A datatype whose values
are not <termref def="dt-numeric"/> is said to be
<term>non-numeric</term>.
</termdef>
</p>
<p diff="del">
<termref def="dt-numeric"/> provides for:
</p>
<ulist diff="del">
<item>
<p>
indicating whether a <termref def="dt-value-space"/> is
<termref def="dt-numeric"/>
</p>
</item>
</ulist>

<!--
<p diff="add">Some ordered datatypes have the property that there is one value greater than or equal to
every other value, and another that less than or equal to every other value.&nbsp; (In the case of derived
datatypes, these two values may not be in the value space of the derived datatype, but must be in the
value space of the primitive datatype from which they have been derived.)  The <emph>bounded</emph>
facet value is <dtref ref="boolean"/> and is generally <pt>true</pt> for such <emph>bounded</emph> 
datatypes.&nbsp; However, it will remain <pt>false</pt> when the mechanism for imposing such a bound
is difficult to detect, as, for example, when the boundedness occurs because of derivation using a
<compref ref="rf-pattern"/> component.</p>
-->

<p diff="add">Some value spaces are made up of things that are generally considered <emph>numeric</emph>, others are not.&nbsp;The <emph>numeric</emph> facet value indicates which are considered numeric.</p><div4 id="dc-numeric">
<head>The numeric Schema Component</head>
<compdef name="numeric" ref="dc-numeric">
<proplist>
<propdef id="numeric-value" name="value">
A <dtref ref="boolean"/>
</propdef>
</proplist>
</compdef>

<p>
<propref ref="numeric-value"/> depends on <phrase diff="add">the <termref def="dt-info-facet-parent">parent&apos;s</termref> </phrase><propref ref="defn-variety"/>,
<propref ref="defn-facets"/>, <propref ref="defn-basetype"/> and
<propref ref="defn-memberTypes"/><phrase diff="del"> in the <compref ref="dc-defn"/> component
in which a <termref def="dt-cardinality"/> component appears as a member of
<propref ref="defn-fund-facets"/></phrase>.
</p>

<p>
When <phrase diff="add">the <termref def="dt-info-facet-parent"></termref> is <termref def="dt-primitive"></termref>, <propref ref="numeric-value"/> is as specified in the
table in <specref ref="app-fundamental-facets"/>.&nbsp; Otherwise, when the <termref def="dt-info-facet-parent">parent&apos;s</termref> </phrase><propref ref="defn-variety"/> is <pt>atomic</pt>,
<propref ref="numeric-value"/> is inherited from
<phrase diff="add">the <termref def="dt-info-facet-parent">parent&apos;s</termref> <propref ref="defn-basetype"/>&apos;s <compref ref="dc-numeric"/></phrase><propref ref="numeric-value"/><phrase diff="del"> of <propref ref="defn-basetype"/>.
For all <termref def="dt-primitive"/> types <propref ref="numeric-value"/>
is as specified	in the table in <specref ref="app-fundamental-facets"/></phrase>.
</p>

<p>
When <phrase diff="add">the <termref def="dt-info-facet-parent">parent&apos;s</termref> </phrase><propref ref="defn-variety"/> is <pt>list</pt>,
<propref ref="numeric-value"/> is <pt>false</pt>.
</p>

<p>
When <phrase diff="add">the <termref def="dt-info-facet-parent">parent&apos;s</termref> </phrase><propref ref="defn-variety"/> is <pt>union</pt>,
if <phrase diff="add"><compref ref="dc-numeric"/>&apos;s </phrase><propref ref="numeric-value"/> is <pt>true</pt>
for every member of <phrase diff="add">the <termref def="dt-info-facet-parent">parent&apos;s</termref> </phrase><propref ref="defn-memberTypes"/><phrase diff="add"> set</phrase> then
<propref ref="numeric-value"/> is <pt>true</pt>,
<phrase diff="del">else</phrase><phrase diff="add">otherwise</phrase> <propref ref="numeric-value"/> is <pt>false</pt>.
</p>

</div4>
</div3>
</div2>

<div2 role="1.0" id="rf-facets">
<head>Constraining Facets</head>

<div3 role="1.0" id="rf-length">
<head>length</head>

<issue id="RQ-147bi" role="1.1">
<p><loc href="&reqs;#E2-35-length-facet" target="reqs">RQ-147b (phase out length facet)</loc></p>
<p>The WG is considering the ramifications of removing the length &cfacet;, letting the schema document elements that currently set that
facet set both minLength and maxLength instead.</p>
</issue>

<p>
<termdef id="dt-length" term="length" role="local">
<term>length</term> is the number
of <emph>units of length</emph>, where <emph>units of length</emph>
varies depending on the type that is being <termref def="dt-derived"/> from.
The value of
<term>length</term>&nbsp;<termref def="dt-must"/> be a
<dtref ref="nonNegativeInteger"/>.
</termdef>
</p>
<p>
For <dtref ref="string"/> and datatypes <termref def="dt-derived"/> from <dtref ref="string"/>,
<term>length</term> is measured in units of <xtermref href="&xmlspec;#dt-character">
character</xtermref>s as defined in <bibref ref="XML"/>.
For <dtref ref="anyURI"/>, <term>length</term> is measured in units of
characters (as for <dtref ref="string"/>).
For <dtref ref="hexBinary"/> and <dtref ref="base64Binary"/> and datatypes <termref def="dt-derived"/> from them,
<term>length</term> is measured in octets (8 bits) of binary data.
For datatypes <termref def="dt-derived"/> by <termref def="dt-list"/>,
<term>length</term> is measured in number of list items.
</p>
<note>
<p>
For <dtref ref="string"/> and datatypes <termref def="dt-derived"/> from <dtref ref="string"/>,
<term>length</term> will not always coincide with "string length" as perceived
by some users or with the number of storage units in some digital representation.
Therefore, care should be taken when specifying a value for <term>length</term>
and in attempting to infer storage requirements from a given value for
<term>length</term>.
</p>
</note>

<p>
<termref def="dt-length"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/>
to values with a specific number of <emph>units of length</emph>,
where <emph>units of length</emph>
varies depending on <propref ref="defn-basetype"/>.
</p>
</item>
</ulist>

<note role="example">
<p>
The following is the definition of a <termref def="dt-user-derived"/>
datatype to represent product codes which must be
exactly 8 characters in length.&nbsp; By fixing the value of the
<term>length</term> facet we ensure that types derived from productCode can
change or set the values of other facets, such as <term>pattern</term>, but
cannot change the length.
</p>
<eg><![CDATA[<simpleType name='productCode'>
   <restriction base='string'>
     <length value='8' fixed='true'/>
   </restriction>
</simpleType>]]></eg>
</note>

<div4 role="1.0" id="dc-length">
<head>The length Schema Component</head>

<compdef name="length" ref="dt-length">
<proplist>
<propdef id="length-value" name="value">
A <dtref ref="nonNegativeInteger"/>.
</propdef>
<propdef id="length-fixed" name="fixed">
A <dtref ref="boolean"/>.
</propdef>
<propdef id="length-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>

<p>
If <propref ref="length-fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref ref="defn-basetype"/> cannot specify a
value for <compref ref="dc-length"/> other than <propref ref="length-value"/>.
</p>
</div4>

<div4 role="1.0" id="xr-length">
<head>XML Representation of length Schema Components</head>

<p>
The XML representation for a <compref ref="dc-length"/> schema
component is a <eltref ref="length"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="length"/>
<reprcomp abstract="length" ref="dc-fractionDigits">
<propmap name="length-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="length-fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise false
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>

</div4>

<div4 role="1.0" id="length-validation-rules">
<head>length Validation Rules</head>

<constraintnote type="cvc" id="cvc-length-valid">
<head>Length Valid</head>
<p>
A value in a <termref def="dt-value-space"/> is facet-valid with
respect to <termref def="dt-length"/>, determined as follows:
</p>
<olist>
<item>
<p>
if the <propref ref="defn-variety"/> is <termref def="dt-atomic"/> then
<olist>
<item>
<p>
if <propref ref="defn-primitive"/> is <dtref ref="string"/> or <dtref ref="anyURI"/>, then the
length of the value, as measured in <xtermref href="&xmlspec;#dt-character">
character</xtermref>s
<termref def="dt-must"/> be equal to <propref ref="length-value"/>;
</p>
</item>
<item>
<p>
if <propref ref="defn-primitive"/> is <dtref ref="hexBinary"/> or <dtref ref="base64Binary"/>, then the
length of the value, as measured in octets of the binary data,
<termref def="dt-must"/> be equal to <propref ref="length-value"/>;
</p>
</item>
<item>
<p>

if <propref ref="defn-primitive"/> is <dtref ref="QName"/> or <dtref ref="NOTATION"/>, then
any <propref ref="length-value"/> is facet-valid.
</p>
</item>
</olist>
</p>
</item>
<item>
<p>
if the <propref ref="defn-variety"/> is <termref def="dt-list"/>,
then the length of the value, as measured
in list items, <termref def="dt-must"/> be equal to <propref ref="length-value"/>
</p>
</item>
</olist>
</constraintnote>
<p>

The use of <termref def="dt-length"/>
on datatypes <termref def="dt-derived"/> from <dtref ref="QName"/> and <dtref ref="NOTATION"/>
is deprecated.&nbsp; Future versions of this
specification may remove this facet for these datatypes.

</p>
</div4>

<div4 role="1.0" id="length-coss">
<head>Constraints on length Schema Components</head>
<constraintnote type="cos" id="length-minLength-maxLength">
<head>length and minLength or maxLength</head>

 <p>If <compref ref="dc-length"/> is a member of <propref ref="defn-facets"/> then
  <olist>
   <item>
    <p>It is an error for <compref ref="dc-minLength"/> to be a member of
<propref ref="defn-facets"/> unless
     <olist>
      <item>
       <p>the <propref ref="minLength-value"/> of <compref ref="dc-minLength"/> &lt;= the <propref ref="length-value"/> of <compref ref="dc-length"/> and</p>
      </item>
      <item>
       <p>there is type definition from which this one is derived by
         one or more restriction steps in which <compref ref="dc-minLength"/> has the same
         <propref ref="minLength-value"/> and <compref ref="dc-length"/> is not specified.</p>
      </item>
     </olist>
    </p>
   </item>
   <item>
    <p>It is an error for <compref ref="dc-maxLength"/> to be a member of
<propref ref="defn-facets"/> unless
     <olist>
      <item>
       <p>the <propref ref="length-value"/> of <compref ref="dc-length"/> &lt;= the <propref ref="maxLength-value"/> of <compref ref="dc-maxLength"/> and</p>
      </item>
      <item>
       <p>there is type definition from which this one is derived by
         one or more restriction steps in which <compref ref="dc-maxLength"/> has the same
         <propref ref="maxLength-value"/> and <compref ref="dc-length"/> is not specified.</p>
      </item>
     </olist>
    </p>
   </item>
  </olist>
 </p>
</constraintnote>

<constraintnote type="cos" id="length-valid-restriction">
<head>length valid restriction</head>
<p>
It is an <termref def="dt-error"/> if <compref ref="dc-length"/>
is among the members of <propref ref="defn-facets"/> of
<propref ref="defn-basetype"/> and <propref ref="length-value"/> is
not equal to the <propref ref="length-value"/> of the parent
<compref ref="dc-length"/>.
</p>
</constraintnote>

</div4>
</div3>

<div3 role="1.0" id="rf-minLength">
<head>minLength</head>

<p>
<termdef id="dt-minLength" term="minLength" role="local">
<term>minLength</term> is
the minimum number of <emph>units of length</emph>, where
<emph>units of length</emph> varies depending on the type that is being
<termref def="dt-derived"/> from.
The value of <term>minLength</term>
&nbsp;<termref def="dt-must"/> be a <dtref ref="nonNegativeInteger"/>.
</termdef>
</p>
<p>
For <dtref ref="string"/> and datatypes <termref def="dt-derived"/> from <dtref ref="string"/>,
<term>minLength</term> is measured in units of <xtermref href="&xmlspec;#dt-character">
character</xtermref>s as defined in <bibref ref="XML"/>.
For <dtref ref="hexBinary"/> and <dtref ref="base64Binary"/> and datatypes <termref def="dt-derived"/> from them,
<term>minLength</term> is measured in octets (8 bits) of binary data.
For datatypes <termref def="dt-derived"/> by <termref def="dt-list"/>,
<term>minLength</term> is measured in number of list items.
</p>
<note>
<p>
For <dtref ref="string"/> and datatypes <termref def="dt-derived"/> from <dtref ref="string"/>,
<term>minLength</term> will not always coincide with "string length" as perceived
by some users or with the number of storage units in some digital representation.
Therefore, care should be taken when specifying a value for <term>minLength</term>
and in attempting to infer storage requirements from a given value for
<term>minLength</term>.
</p>
</note>

<p>
<termref def="dt-minLength"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/>
to values with at least a specific number of <emph>units of length</emph>,
where <emph>units of length</emph>
varies depending on <propref ref="defn-basetype"/>.
</p>
</item>
</ulist>

<note role="example">
<p>
The following is the definition of a <termref def="dt-user-derived"/>
datatype which requires strings to have at least one character (i.e.,
the empty string is not in the <termref def="dt-value-space"/>
of this datatype).
</p>
<eg><![CDATA[<simpleType name='non-empty-string'>
  <restriction base='string'>
    <minLength value='1'/>
  </restriction>
</simpleType>]]></eg>
</note>

<div4 role="1.0" id="dc-minLength">
<head>The minLength Schema Component</head>

<compdef name="minLength" ref="dt-minLength">
<proplist>
<propdef id="minLength-value" name="value">
A <dtref ref="nonNegativeInteger"/>.
</propdef>
<propdef id="minLength-fixed" name="fixed">
A <dtref ref="boolean"/>.
</propdef>
<propdef id="minLength-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>

<p>
If <propref ref="minLength-fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref ref="defn-basetype"/> cannot specify a
value for <compref ref="dc-minLength"/> other than <propref ref="minLength-value"/>.
</p>
</div4>

<div4 role="1.0" id="xr-minLength">
<head>XML Representation of minLength Schema Component</head>

<p>
The XML representation for a <compref ref="dc-minLength"/> schema
component is a <eltref ref="minLength"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="minLength"/>
<reprcomp abstract="minLength" ref="dc-fractionDigits">
<propmap name="minLength-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="minLength-fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise false
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>
</div4>

<div4 role="1.0" id="minLength-validation-rules">
<head>minLength Validation Rules</head>
<constraintnote type="cvc" id="cvc-minLength-valid">
<head>minLength Valid</head>
<p>
A value in a <termref def="dt-value-space"/> is facet-valid with
respect to <termref def="dt-minLength"/>, determined as follows:
</p>
<olist>
<item>
<p>
if the <propref ref="defn-variety"/> is <termref def="dt-atomic"/> then
<olist>
<item>
<p>
if <propref ref="defn-primitive"/> is <dtref ref="string"/> or
<dtref ref="anyURI"/>, then the
length of the value, as measured in<xtermref href="&xmlspec;#dt-character">
character</xtermref>s
<termref def="dt-must"/> be greater than or equal to
<propref ref="minLength-value"/>;
</p>
</item>
<item>
<p>
if <propref ref="defn-primitive"/> is <dtref ref="hexBinary"/> or <dtref ref="base64Binary"/>, then the
length of the value, as measured in octets of the binary data,
<termref def="dt-must"/> be greater than or equal to
<propref ref="minLength-value"/>;
</p>
</item>
<item>
<p>

if <propref ref="defn-primitive"/> is <dtref ref="QName"/> or <dtref ref="NOTATION"/>, then
any <propref ref="minLength-value"/> is facet-valid.
</p>
</item>
</olist>
</p>
</item>
<item>
<p>
if the <propref ref="defn-variety"/> is <termref def="dt-list"/>,
then the length of the value, as measured
in list items, <termref def="dt-must"/> be greater than or equal
to <propref ref="minLength-value"/>
</p>
</item>
</olist>
</constraintnote>
<p>

The use of <termref def="dt-minLength"/>
on datatypes <termref def="dt-derived"/> from <dtref ref="QName"/> and <dtref ref="NOTATION"/>
is deprecated.&nbsp; Future versions of this
specification may remove this facet for these datatypes.

</p>
</div4>

<div4 role="1.0" id="minLength-coss">
<head>Constraints on minLength Schema Components</head>
<constraintnote type="cos" id="minLength-less-than-equal-to-maxLength">
<head>minLength &lt;= maxLength</head>
<p>
If both <compref ref="dc-minLength"/> and <compref ref="dc-maxLength"/>
are members of <propref ref="defn-facets"/>, then the
<propref ref="minLength-value"/> of <compref ref="dc-minLength"/>
&nbsp;<termref def="dt-must"/> be less than or equal to the
<propref ref="maxLength-value"/> of <compref ref="dc-maxLength"/>.
</p>
</constraintnote>

<constraintnote type="cos" id="minLength-valid-restriction">
<head>minLength valid restriction</head>
<p>
It is an <termref def="dt-error"/> if <compref ref="dc-minLength"/>
is among the members of <propref ref="defn-facets"/> of
<propref ref="defn-basetype"/> and <propref ref="minLength-value"/> is
less than the <propref ref="minLength-value"/> of the parent
<compref ref="dc-minLength"/>.
</p>
</constraintnote>
</div4>
</div3>

<div3 role="1.0" id="rf-maxLength">
<head>maxLength</head>

<p>
<termdef id="dt-maxLength" term="maxLength" role="local">
<term>maxLength</term> is
the maximum number of <emph>units of length</emph>, where
<emph>units of length</emph> varies
depending on the type that is being <termref def="dt-derived"/> from.
The value of <term>maxLength</term>
&nbsp;<termref def="dt-must"/> be a <dtref ref="nonNegativeInteger"/>.
</termdef>
</p>
<p>
For <dtref ref="string"/> and datatypes <termref def="dt-derived"/> from <dtref ref="string"/>,
<term>maxLength</term> is measured in units of <xtermref href="&xmlspec;#dt-character">
character</xtermref>s as defined in <bibref ref="XML"/>.
For <dtref ref="hexBinary"/> and <dtref ref="base64Binary"/> and datatypes <termref def="dt-derived"/> from them,
<term>maxLength</term> is measured in octets (8 bits) of binary data.
For datatypes <termref def="dt-derived"/> by <termref def="dt-list"/>,
<term>maxLength</term> is measured in number of list items.
</p>
<note>
<p>
For <dtref ref="string"/> and datatypes <termref def="dt-derived"/> from <dtref ref="string"/>,
<term>maxLength</term> will not always coincide with "string length" as perceived
by some users or with the number of storage units in some digital representation.
Therefore, care should be taken when specifying a value for <term>maxLength</term>
and in attempting to infer storage requirements from a given value for
<term>maxLength</term>.
</p>
</note>

<p>
<termref def="dt-maxLength"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/>
to values with at most a specific number of <emph>units of length</emph>,
where <emph>units of length</emph>
varies depending on <propref ref="defn-basetype"/>.
</p>
</item>
</ulist>

<note role="example">
<p>
The following is the definition of a <termref def="dt-user-derived"/>
datatype which might be used to accept form input with an upper limit
to the number of characters that are acceptable.
</p>
<eg><![CDATA[<simpleType name='form-input'>
  <restriction base='string'>
    <maxLength value='50'/>
  </restriction>
</simpleType>]]></eg>
</note>

<div4 role="1.0" id="dc-maxLength">
<head>The maxLength Schema Component</head>
<compdef name="maxLength" ref="dt-maxLength">
<proplist>
<propdef id="maxLength-value" name="value">
A <dtref ref="nonNegativeInteger"/>.
</propdef>
<propdef id="maxLength-fixed" name="fixed">
A <dtref ref="boolean"/>.
</propdef>
<propdef id="maxLength-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>

<p>
If <propref ref="maxLength-fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref ref="defn-basetype"/> cannot specify a
value for <compref ref="dc-maxLength"/> other than <propref ref="maxLength-value"/>.
</p>

</div4>

<div4 role="1.0" id="xr-maxLength">
<head>XML Representation of maxLength Schema Components</head>

<p>
The XML representation for a <compref ref="dc-maxLength"/> schema
component is a <eltref ref="maxLength"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="maxLength"/>
<reprcomp abstract="maxLength" ref="dc-fractionDigits">
<propmap name="maxLength-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="maxLength-fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise false
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>
</div4>

<div4 role="1.0" id="maxLength-validation-rules">
<head>maxLength Validation Rules</head>
<constraintnote type="cvc" id="cvc-maxLength-valid">
<head>maxLength Valid</head>
<p>
A value in a <termref def="dt-value-space"/> is facet-valid with
respect to <termref def="dt-maxLength"/>, determined as follows:
</p>
<olist>
<item>
<p>
if the <propref ref="defn-variety"/> is <termref def="dt-atomic"/> then
<olist>
<item>
<p>
if <propref ref="defn-primitive"/> is <dtref ref="string"/> or
<dtref ref="anyURI"/>, then the
length of the value, as measured in <xtermref href="&xmlspec;#dt-character">
character</xtermref>s
<termref def="dt-must"/> be less than or equal to
<propref ref="maxLength-value"/>;
</p>
</item>
<item>
<p>
if <propref ref="defn-primitive"/> is <dtref ref="hexBinary"/> or <dtref ref="base64Binary"/>, then the
length of the value, as measured in octets of the binary data,
<termref def="dt-must"/> be less than or equal to <propref ref="maxLength-value"/>;
</p>
</item>
<item>
<p>

if <propref ref="defn-primitive"/> is <dtref ref="QName"/> or <dtref ref="NOTATION"/>, then
any <propref ref="maxLength-value"/> is facet-valid.
</p>
</item>
</olist>
</p>
</item>
<item>
<p>
if the <propref ref="defn-variety"/> is <termref def="dt-list"/>,
then the length of the value, as measured
in list items, <termref def="dt-must"/> be less than or equal to
<propref ref="maxLength-value"/>
</p>
</item>
</olist>
</constraintnote>
<p>

The use of <termref def="dt-maxLength"/>
on datatypes <termref def="dt-derived"/> from <dtref ref="QName"/> and <dtref ref="NOTATION"/>
is deprecated.&nbsp; Future versions of this
specification may remove this facet for these datatypes.

</p></div4>

<div4 role="1.0" id="maxLength-coss">
<head>Constraints on maxLength Schema Components</head>
<constraintnote type="cos" id="maxLength-valid-restriction">
<head>maxLength valid restriction</head>
<p>
It is an <termref def="dt-error"/> if <compref ref="dc-maxLength"/>
is among the members of <propref ref="defn-facets"/> of
<propref ref="defn-basetype"/> and <propref ref="maxLength-value"/> is
greater than the <propref ref="maxLength-value"/> of the parent
<compref ref="dc-maxLength"/>.
</p>
</constraintnote>
</div4>

</div3>

<div3 role="1.0" id="rf-pattern">
<head>pattern</head>

<p>
<termdef id="dt-pattern" term="pattern" role="local">
<term>pattern</term> is a constraint on the
<termref def="dt-value-space"/> of a datatype which is achieved by
constraining the <termref def="dt-lexical-space"/> to literals
which match a specific pattern.&nbsp; The value of <term>pattern</term>
&nbsp;<termref def="dt-must"/> be a <termref def="dt-regex"/>.
</termdef>
</p>

<p>
<termref def="dt-pattern"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/>
to values that are denoted by literals which match a specific
<termref def="dt-regex"/>.
</p>
</item>
</ulist>

<note role="example">
<p>
The following is the definition of a <termref def="dt-user-derived"/>
datatype which is a better representation of postal codes in the
United States, by limiting strings to those which are matched by
a specific <termref def="dt-regex"/>.
</p>
<eg><![CDATA[<simpleType name='better-us-zipcode'>
  <restriction base='string'>
    <pattern value='[0-9]{5}(-[0-9]{4})?'/>
  </restriction>
</simpleType>]]></eg>
</note>

<div4 role="1.0" id="dc-pattern">
<head>The pattern Schema Component</head>
<compdef name="pattern" ref="dt-pattern">
<proplist>
<propdef id="pattern-value" name="value">
A <termref def="dt-regex"/>.
</propdef>
<propdef id="pattern-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>
</div4>

<div4 role="1.0" id="xr-pattern">
<head>XML Representation of pattern Schema Components</head>
<p>
The XML representation for a <compref ref="dc-pattern"/> schema
component is a <eltref ref="pattern"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="pattern"/>
<reprcomp abstract="pattern" ref="dc-fractionDigits">
<reprdep>
<propref ref="pattern-value"/>&nbsp;<termref def="dt-must"/> be a valid
<termref def="dt-regex"/>.
</reprdep>
<propmap name="pattern-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>

</div4>

<div4 role="1.0" id="pattern-rep-constr">
<head>Constraints on XML Representation of pattern</head>
<constraintnote type="src" id="src-multiple-patterns">
<head>Multiple patterns</head>
<p>
If multiple <eltref ref="pattern"/> element information items appear as
&i-children; of a <eltref ref="simpleType"/>, the &i-value;s should
be combined as if they appeared in a single
<termref def="dt-regex"/> as separate
<termref def="dt-branch"/>es.
</p>
</constraintnote>

<note>
<p>
It is a consequence of the schema representation constraint
<specref ref="src-multiple-patterns"/> and of the rules for
<termref def="dt-restriction"/> that <termref def="dt-pattern"/>
facets specified on the <emph>same</emph> step in a type
derivation are <strong>OR</strong>ed together, while <termref def="dt-pattern"/>
facets specified on <emph>different</emph> steps of a type derivation
are <strong>AND</strong>ed together.
</p>
<p>
Thus, to impose two <termref def="dt-pattern"/> constraints simultaneously,
schema authors may either write a single <termref def="dt-pattern"/> which
expresses the intersection of the two <termref def="dt-pattern"/>s they wish to
impose, or define each <termref def="dt-pattern"/> on a separate type derivation
step.
</p>
</note>
</div4>

<div4 role="1.0" id="pattern-validation-rules">
<head>pattern Validation Rules</head>
<constraintnote type="cvc" id="cvc-pattern-valid">
<head>pattern valid</head>
<p>
A literal in a <termref def="dt-lexical-space"/> is facet-valid with
respect to <termref def="dt-pattern"/> if:
</p>
<olist>
<item>
<p>
the literal is among the set of character sequences denoted by
the <termref def="dt-regex"/> specified in <propref ref="pattern-value"/>.
</p>
</item>
</olist>
</constraintnote>
</div4>

</div3>

<div3 role="1.0" id="rf-enumeration">
<head>enumeration</head>

<p>
<termdef id="dt-enumeration" term="enumeration" role="local">
<term>enumeration</term> constrains the <termref def="dt-value-space"/>
to a specified set of values.
</termdef>
</p>
<p>
<term>enumeration</term> does not impose an order relation on the
<termref def="dt-value-space"/> it creates; the value of the
<termref def="dt-ordered"/> property of the <termref def="dt-derived"/>
datatype remains that of the datatype from which it is
<termref def="dt-derived"/>.
</p>

<p>
<termref def="dt-enumeration"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/>
to a specified set of values.
</p>
</item>
</ulist>

<note role="example">
<p>
The following example is a datatype definition for a
<termref def="dt-user-derived"/> datatype which limits the values
of dates to the three US holidays enumerated. This datatype
definition would appear in a schema authored by an "end-user" and
shows how to define a datatype by enumerating the values in its
<termref def="dt-value-space"/>.&nbsp; The enumerated values must be
type-valid literals for the <termref def="dt-basetype"/>.
</p>
<eg><![CDATA[<simpleType name='holidays'>
    <annotation>
        <documentation>some US holidays</documentation>
    </annotation>
    <restriction base='gMonthDay'>
      <enumeration value='--01-01'>
        <annotation>
            <documentation>New Year's day</documentation>
        </annotation>
      </enumeration>
      <enumeration value='--07-04'>
        <annotation>
            <documentation>4th of July</documentation>
        </annotation>
      </enumeration>
      <enumeration value='--12-25'>
        <annotation>
            <documentation>Christmas</documentation>
        </annotation>
      </enumeration>
    </restriction>
</simpleType>]]></eg>
</note>

<div4 role="1.0" id="dc-enumeration">
<head>The enumeration Schema Component</head>
<compdef name="enumeration" ref="dt-enumeration">
<proplist>
<propdef id="enumeration-value" name="value">
A set of values from the <termref def="dt-value-space"/> of the
<propref ref="defn-basetype"/>.
</propdef>
<propdef id="enumeration-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>
</div4>

<div4 role="1.0" id="xr-enumeration">
<head>XML Representation of enumeration Schema Components</head>
<p>
The XML representation for an <compref ref="dc-enumeration"/> schema
component is an <eltref ref="enumeration"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="enumeration"/>
<reprcomp abstract="enumeration" ref="dc-enumeration">
<reprdep>
<propref ref="enumeration-value"/>&nbsp;<termref def="dt-must"/> be
in the <termref def="dt-value-space"/> of <propref ref="defn-basetype"/>.
</reprdep>
<propmap name="enumeration-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>
</div4>

<div4 role="1.0" id="enumeration-rep-constr">
<head>Constraints on XML Representation of enumeration</head>
<constraintnote type="src" id="src-multiple-enumerations">
<head>Multiple enumerations</head>
<p>
If multiple <eltref ref="enumeration"/> element information items appear
as &i-children; of a <eltref ref="simpleType"/> the
<propref ref="enumeration-value"/> of the <compref ref="dc-enumeration"/>
component should be the set of all such &i-value;s.
</p>
</constraintnote>
</div4>

<div4 role="1.0" id="enumeration-validation-rules">
<head>enumeration Validation Rules</head>
<constraintnote type="cvc" id="cvc-enumeration-valid">
<head>enumeration valid</head>
<p>
A value in a <termref def="dt-value-space"/> is facet-valid with
respect to <termref def="dt-enumeration"/> if
the value is one of the values specified in
<propref ref="enumeration-value"/>
</p>
</constraintnote>
</div4>

<div4 role="1.0" id="enumeration-coss">
<head>Constraints on enumeration Schema Components</head>
<constraintnote type="cos" id="enumeration-valid-restriction">
<head>enumeration valid restriction</head>
<p>
It is an <termref def="dt-error"/> if any member of <propref ref="enumeration-value"/> is not in the <termref def="dt-value-space"/>
of <propref ref="defn-basetype"/>.
</p>
</constraintnote>
</div4>

</div3>

<div3 role="1.0" id="rf-whiteSpace">
<head>whiteSpace</head>

<p>
<termdef id="dt-whiteSpace" term="whiteSpace" role="local">
<term>whiteSpace</term> constrains the <termref def="dt-value-space"/>
of types <termref def="dt-derived"/> from <dtref ref="string"/> such that
the various behaviors
specified in <xspecref href="&xmlspec;#AVNormalize">Attribute Value Normalization</xspecref>
in <bibref ref="XML"/> are realized.&nbsp; The value of
<term>whiteSpace</term> must be one of {preserve, replace, collapse}.
</termdef>
</p>
<glist>
<gitem>
<label>preserve</label>
<def>
<p>
No normalization is done, the value is not changed (this is the
behavior required  by <bibref ref="XML"/> for element content)
</p>
</def>
</gitem>
<gitem>
<label>replace</label>
<def>
<p>
All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return)
are replaced with #x20 (space)
</p>
</def>
</gitem>
<gitem>
<label>collapse</label>
<def>
<p>
After the processing implied by <term>replace</term>, contiguous
sequences of #x20's are collapsed to a single #x20, and leading and
trailing #x20's are removed.
</p>
</def>
</gitem>
</glist>
<note>
<p>
The notation #xA used here (and elsewhere in this specification) represents
the Universal Character Set (UCS) code point <code>hexadecimal A</code> (line feed), which is denoted by
U+000A.&nbsp; This notation is to be distinguished from <code>&amp;#xA;</code>,
which is the XML <xnt href="&xmlspec;#NT-CharRef">character reference</xnt>
to that same UCS code point.
</p>
</note>
<p>
<term>whiteSpace</term> is applicable to all <termref def="dt-atomic"/> and
<termref def="dt-list"/> datatypes.&nbsp; For all <termref def="dt-atomic"/>
datatypes other than <dtref ref="string"/> (and types <termref def="dt-derived"/>
by <termref def="dt-restriction"/> from it) the value of <term>whiteSpace</term> is
<code>collapse</code> and cannot be changed by a schema author; for
<dtref ref="string"/> the value of <term>whiteSpace</term> is
<code>preserve</code>; for any type <termref def="dt-derived"/> by
<termref def="dt-restriction"/> from
<dtref ref="string"/> the value of <term>whiteSpace</term> can
be any of the three legal values.&nbsp; For all datatypes
<termref def="dt-derived"/> by <termref def="dt-list"/> the
value of <term>whiteSpace</term> is <code>collapse</code> and cannot
be changed by a schema author.&nbsp; For all datatypes
<termref def="dt-derived"/> by <termref def="dt-union"/>
&nbsp;<term>whiteSpace</term> does not apply directly; however, the
normalization behavior of <termref def="dt-union"/> types is controlled by
the value of <term>whiteSpace</term> on that one of the
<termref def="dt-memberTypes"/> against which the <termref def="dt-union"/>
is successfully validated.
</p>
<note>
<p>
For more information on <term>whiteSpace</term>, see the
discussion on white space normalization in
<xspecref href="&xsdl;#components">Schema Component Details</xspecref>
in <bibref ref="structural-schemas"/>.
</p>
</note>

<p>
<termref def="dt-whiteSpace"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/> according to
the white space normalization rules.
</p>
</item>
</ulist>

<note role="example">
<p>
The following example is the datatype definition for
the <dtref ref="token"/>&nbsp;<termref def="dt-built-in"/>&nbsp;
<termref def="dt-derived"/>
datatype.
</p>
<eg><![CDATA[<simpleType name='token'>
    <restriction base='normalizedString'>
      <whiteSpace value='collapse'/>
    </restriction>
</simpleType>]]></eg>
</note>

<div4 role="1.0" id="dc-whiteSpace">
<head>The whiteSpace Schema Component</head>
<compdef name="whiteSpace" ref="dt-whiteSpace">
<proplist>
<propdef id="whiteSpace-value" name="value">
One of <code>{preserve, replace, collapse}</code>.
</propdef>
<propdef id="whiteSpace-fixed" name="fixed">
A <dtref ref="boolean"/>.
</propdef>
<propdef id="whiteSpace-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>

<p>
If <propref ref="whiteSpace-fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref ref="defn-basetype"/> cannot specify a
value for <compref ref="dc-whiteSpace"/> other than <propref ref="whiteSpace-value"/>.
</p>

</div4>

<div4 role="1.0" id="xr-whiteSpace">
<head>XML Representation of whiteSpace Schema Components</head>

<p>
The XML representation for a <compref ref="dc-whiteSpace"/> schema
component is a <eltref ref="whiteSpace"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="whiteSpace"/>
<reprcomp abstract="whiteSpace" ref="dc-whiteSpace">
<propmap name="whiteSpace-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="whiteSpace-fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise false
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>
</div4>

<div4 role="1.0" id="whiteSpace-validation-rules">
<head>whiteSpace Validation Rules</head>

<note>
<p>
There are no <termref def="dt-cvc"/>s associated <termref def="dt-whiteSpace"/>.
For more information, see the
discussion on white space normalization in
<xspecref href="&xsdl;#components">Schema Component Details</xspecref>
in <bibref ref="structural-schemas"/>.
</p>
</note>
</div4>

<div4 role="1.0" id="whiteSpace-coss">
<head>Constraints on whiteSpace Schema Components</head>
<constraintnote type="cos" id="whiteSpace-valid-restriction">
<head>whiteSpace valid restriction</head>
<p>
It is an <termref def="dt-error"/> if <compref ref="dc-whiteSpace"/>
is among the members of <propref ref="defn-facets"/> of
<propref ref="defn-basetype"/> and any of the following conditions is
true:
</p>
<olist>
<item>
<p>
<propref ref="whiteSpace-value"/> is <emph>replace</emph> or <emph>preserve</emph>
and the <propref ref="whiteSpace-value"/> of the parent
<compref ref="dc-whiteSpace"/> is <emph>collapse</emph>
</p>
</item>
<item>
<p>
<propref ref="whiteSpace-value"/> is <emph>preserve</emph>
and the <propref ref="whiteSpace-value"/> of the parent
<compref ref="dc-whiteSpace"/> is <emph>replace</emph>
</p>
</item>
</olist>
</constraintnote>
</div4>

</div3>

<div3 role="1.0" id="rf-maxInclusive">
<head>maxInclusive</head>

<p>
<termdef id="dt-maxInclusive" term="maxInclusive" role="local">
<term>maxInclusive</term> is the <termref def="dt-inclusive-upper-bound"/>
of the <termref def="dt-value-space"/> for a datatype with the
<termref def="dt-ordered"/> property.&nbsp; The value of
<term>maxInclusive</term>&nbsp;<termref def="dt-must"/> be
in the <termref def="dt-value-space"/> of the
<termref def="dt-basetype"/>.
</termdef>
</p>

<p>
<termref def="dt-maxInclusive"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/> to values
with a specific <termref def="dt-inclusive-upper-bound"/>.
</p>
</item>
</ulist>

<note role="example">
<p>
The following is the definition of a <termref def="dt-user-derived"/>
datatype which limits values to integers less than or equal to
100, using <termref def="dt-maxInclusive"/>.
</p>
<eg><![CDATA[<simpleType name='one-hundred-or-less'>
  <restriction base='integer'>
    <maxInclusive value='100'/>
  </restriction>
</simpleType>]]></eg>
</note>

<div4 role="1.0" id="dc-maxInclusive">
<head>The maxInclusive Schema Component</head>
<compdef name="maxInclusive" ref="dt-maxInclusive">
<proplist>
<propdef id="maxInclusive-value" name="value">
A value from the <termref def="dt-value-space"/> of the
<propref ref="defn-basetype"/>.
</propdef>
<propdef id="maxInclusive-fixed" name="fixed">
A <dtref ref="boolean"/>.
</propdef>
<propdef id="maxInclusive-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>

<p>
If <propref ref="maxInclusive-fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref ref="defn-basetype"/> cannot specify a
value for <compref ref="dc-maxInclusive"/> other than <propref ref="maxInclusive-value"/>.
</p>
</div4>

<div4 role="1.0" id="xr-maxInclusive">
<head>XML Representation of maxInclusive Schema Components</head>
<p>
The XML representation for a <compref ref="dc-maxInclusive"/> schema
component is a <eltref ref="maxInclusive"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="maxInclusive"/>
<reprcomp abstract="maxInclusive" ref="dt-maxInclusive">
<reprdep>
<propref ref="maxInclusive-value"/>&nbsp;<termref def="dt-must"/> be
in the <termref def="dt-value-space"/> of <propref ref="defn-basetype"/>.
</reprdep>
<propmap name="maxInclusive-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="maxInclusive-fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise false, if present, otherwise false
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>
</div4>

<div4 role="1.0" id="maxInclusive-validation-rules">
<head>maxInclusive Validation Rules</head>
<constraintnote type="cvc" id="cvc-maxInclusive-valid">
<head>maxInclusive Valid</head>
<p>
A value in an <termref def="dt-ordered"/>&nbsp;<termref def="dt-value-space"/>
is facet-valid with respect to <termref def="dt-maxInclusive"/>, determined as
follows:
</p>
<olist>
<item>
<p>
if the <termref def="dt-numeric"/> property in
<propref ref="defn-fund-facets"/> is <emph>true</emph>, then the value
<termref def="dt-must"/> be numerically less than or
equal to <propref ref="maxInclusive-value"/>;
</p>
</item>
<item>
<p>
if the <termref def="dt-numeric"/> property in
<propref ref="defn-fund-facets"/> is <emph>false</emph> (i.e.,
<propref ref="defn-basetype"/> is one of the date and time related
datatypes), then the value <termref def="dt-must"/> be chronologically
less than or equal to <propref ref="maxInclusive-value"/>;
</p>
</item>
</olist>
</constraintnote>
</div4>

<div4 role="1.0" id="maxInclusive-coss">
<head>Constraints on maxInclusive Schema Components</head>
<constraintnote type="cos" id="minInclusive-less-than-equal-to-maxInclusive">
<head>minInclusive &lt;= maxInclusive</head>
<p>
It is an <termref def="dt-error"/> for the value specified for
<termref def="dt-minInclusive"/> to be greater than the value
specified for <termref def="dt-maxInclusive"/> for the same datatype.
</p>
</constraintnote>

<constraintnote type="cos" id="maxInclusive-valid-restriction">
<head>maxInclusive valid restriction</head>
<p>
It is an <termref def="dt-error"/> if any of the following conditions
is true:
</p>
<olist>
<item>
<p>
<compref ref="dc-maxInclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="maxInclusive-value"/> is
greater than the <propref ref="maxInclusive-value"/> of the parent
<compref ref="dc-maxInclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-maxExclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="maxInclusive-value"/> is
greater than or equal to the <propref ref="maxExclusive-value"/> of the parent
<compref ref="dc-maxExclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-minInclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="maxInclusive-value"/> is
less than the <propref ref="minInclusive-value"/> of the parent
<compref ref="dc-minInclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-minExclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="maxInclusive-value"/> is
less than or equal to the <propref ref="minExclusive-value"/> of the parent
<compref ref="dc-minExclusive"/>
</p>
</item>
</olist>
</constraintnote>
</div4>

</div3>

<div3 role="1.0" id="rf-maxExclusive">
<head>maxExclusive</head>

<p>
<termdef id="dt-maxExclusive" term="maxExclusive" role="local">
<term>maxExclusive</term> is the <termref def="dt-exclusive-upper-bound"/>
of the <termref def="dt-value-space"/> for a datatype with the
<termref def="dt-ordered"/> property.&nbsp; The value of <term>maxExclusive</term>
&nbsp;<termref def="dt-must"/> be in the <termref def="dt-value-space"/> of the
<termref def="dt-basetype"/> or be equal to <propref ref="maxExclusive-value"/> in
<propref ref="defn-basetype"/>.
</termdef>
</p>

<p>
<termref def="dt-maxExclusive"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/> to values
with a specific <termref def="dt-exclusive-upper-bound"/>.
</p>
</item>
</ulist>

<note role="example">
<p>
The following is the definition of a <termref def="dt-user-derived"/>
datatype which limits values to integers less than or equal to
100, using <termref def="dt-maxExclusive"/>.
</p>
<eg><![CDATA[<simpleType name='less-than-one-hundred-and-one'>
  <restriction base='integer'>
    <maxExclusive value='101'/>
  </restriction>
</simpleType>]]></eg>
<p>
Note that the
<termref def="dt-value-space"/> of this datatype is identical to
the previous one (named 'one-hundred-or-less').
</p>
</note>

<div4 role="1.0" id="dc-maxExclusive">
<head>The maxExclusive Schema Component</head>
<compdef name="maxExclusive" ref="dt-maxExclusive">
<proplist>
<propdef id="maxExclusive-value" name="value">
A value from the <termref def="dt-value-space"/> of the
<propref ref="defn-basetype"/>.
</propdef>
<propdef id="maxExclusive-fixed" name="fixed">
A <dtref ref="boolean"/>.
</propdef>
<propdef id="maxExclusive-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>

<p>
If <propref ref="maxExclusive-fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref ref="defn-basetype"/> cannot specify a
value for <compref ref="dc-maxExclusive"/> other than <propref ref="maxExclusive-value"/>.
</p>
</div4>

<div4 role="1.0" id="xr-maxExclusive">
<head>XML Representation of maxExclusive Schema Components</head>
<p>
The XML representation for a <compref ref="dc-maxExclusive"/> schema
component is a <eltref ref="maxExclusive"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="maxExclusive"/>
<reprcomp abstract="maxExclusive" ref="dt-maxExclusive">
<reprdep>
<propref ref="maxExclusive-value"/>&nbsp;<termref def="dt-must"/> be
in the <termref def="dt-value-space"/> of <propref ref="defn-basetype"/>.
</reprdep>
<propmap name="maxExclusive-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="maxExclusive-fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise false
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>
</div4>

<div4 role="1.0" id="maxExclusive-validation-rules">
<head>maxExclusive Validation Rules</head>
<constraintnote type="cvc" id="cvc-maxExclusive-valid">
<head>maxExclusive Valid</head>
<p>
A value in an <termref def="dt-ordered"/>&nbsp;<termref def="dt-value-space"/>
is facet-valid with respect to <termref def="dt-maxExclusive"/>, determined
as follows:
</p>
<olist>
<item>
<p>
if the <termref def="dt-numeric"/> property in
<propref ref="defn-fund-facets"/> is <emph>true</emph>, then the
value <termref def="dt-must"/> be numerically less than
<propref ref="maxExclusive-value"/>;
</p>
</item>
<item>
<p>
if the <termref def="dt-numeric"/> property in
<propref ref="defn-fund-facets"/> is <emph>false</emph> (i.e.,
<propref ref="defn-basetype"/> is one of the date and time related
datatypes), then the value <termref def="dt-must"/> be chronologically
less than <propref ref="maxExclusive-value"/>;
</p>
</item>
</olist>
</constraintnote>
</div4>

<div4 role="1.0" id="maxExclusive-coss">
<head>Constraints on maxExclusive Schema Components</head>
<constraintnote type="cos" id="maxInclusive-maxExclusive">
<head>maxInclusive and maxExclusive</head>
<p>
It is an <termref def="dt-error"/> for both
<termref def="dt-maxInclusive"/> and <termref def="dt-maxExclusive"/>
to be specified in the same derivation step of a datatype definition.
</p>
</constraintnote>

<constraintnote type="cos" id="minExclusive-less-than-equal-to-maxExclusive">
<head>minExclusive &lt;= maxExclusive</head>
<p>
It is an <termref def="dt-error"/> for the value specified for
<termref def="dt-minExclusive"/> to be greater than the value
specified for <termref def="dt-maxExclusive"/> for the same datatype.
</p>
</constraintnote>

<constraintnote type="cos" id="maxExclusive-valid-restriction">
<head>maxExclusive valid restriction</head>
<p>
It is an <termref def="dt-error"/> if any of the following conditions
is true:
</p>
<olist>
<item>
<p>
<compref ref="dc-maxExclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="maxExclusive-value"/> is
greater than the <propref ref="maxExclusive-value"/> of the parent
<compref ref="dc-maxExclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-maxInclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="maxExclusive-value"/> is
greater than the <propref ref="maxInclusive-value"/> of the parent
<compref ref="dc-maxInclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-minInclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="maxExclusive-value"/> is
less than or equal to the <propref ref="minInclusive-value"/> of the parent
<compref ref="dc-minInclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-minExclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="maxExclusive-value"/> is
less than or equal to the <propref ref="minExclusive-value"/> of the parent
<compref ref="dc-minExclusive"/>
</p>
</item>
</olist>
</constraintnote>
</div4>

</div3>

<div3 role="1.0" id="rf-minExclusive">
<head>minExclusive</head>

<p>
<termdef id="dt-minExclusive" term="minExclusive" role="local">
<term>minExclusive</term> is the <termref def="dt-exclusive-lower-bound"/>
of the <termref def="dt-value-space"/> for a datatype with the
<termref def="dt-ordered"/> property.
The value of <term>minExclusive</term>&nbsp;<termref def="dt-must"/>
be in the <termref def="dt-value-space"/> of the
<termref def="dt-basetype"/>
 or be equal to <propref ref="minExclusive-value"/> in
<propref ref="defn-basetype"/>.
</termdef>
</p>

<p>
<termref def="dt-minExclusive"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/> to values
with a specific <termref def="dt-exclusive-lower-bound"/>.
</p>
</item>
</ulist>

<note role="example">
<p>
The following is the definition of a <termref def="dt-user-derived"/>
datatype which limits values to integers greater than or equal to
100, using <termref def="dt-minExclusive"/>.
</p>
<eg><![CDATA[<simpleType name='more-than-ninety-nine'>
  <restriction base='integer'>
    <minExclusive value='99'/>
  </restriction>
</simpleType>]]></eg>
<p>
Note that the
<termref def="dt-value-space"/> of this datatype is identical to
the previous one (named 'one-hundred-or-more').
</p>
</note>

<div4 role="1.0" id="dc-minExclusive">
<head>The minExclusive Schema Component</head>
<compdef name="minExclusive" ref="dt-minExclusive">
<proplist>
<propdef id="minExclusive-value" name="value">
A value from the <termref def="dt-value-space"/> of the
<propref ref="defn-basetype"/>.
</propdef>
<propdef id="minExclusive-fixed" name="fixed">
A <dtref ref="boolean"/>.
</propdef>
<propdef id="minExclusive-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>

<p>
If <propref ref="minExclusive-fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref ref="defn-basetype"/> cannot specify a
value for <compref ref="dc-minExclusive"/> other than <propref ref="minExclusive-value"/>.
</p>
</div4>

<div4 role="1.0" id="xr-minExclusive">
<head>XML Representation of minExclusive Schema Components</head>

<p>
The XML representation for a <compref ref="dc-minExclusive"/> schema
component is a <eltref ref="minExclusive"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="minExclusive"/>
<reprcomp abstract="minExclusive" ref="dt-minExclusive">
<reprdep>
<propref ref="minExclusive-value"/>&nbsp;<termref def="dt-must"/> be
in the <termref def="dt-value-space"/> of <propref ref="defn-basetype"/>.
</reprdep>
<propmap name="minExclusive-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="minExclusive-fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise false
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>
</div4>

<div4 role="1.0" id="minExclusive-validation-rules">
<head>minExclusive Validation Rules</head>
<constraintnote type="cvc" id="cvc-minExclusive-valid">
<head>minExclusive Valid</head>
<p>
A value in an <termref def="dt-ordered"/>&nbsp;<termref def="dt-value-space"/>
is facet-valid with respect to <termref def="dt-minExclusive"/> if:
</p>
<olist>
<item>
<p>
if the <termref def="dt-numeric"/> property in
<propref ref="defn-fund-facets"/> is <emph>true</emph>, then the
value <termref def="dt-must"/> be numerically greater than
<propref ref="minExclusive-value"/>;
</p>
</item>
<item>
<p>
if the <termref def="dt-numeric"/> property in
<propref ref="defn-fund-facets"/> is <emph>false</emph> (i.e.,
<propref ref="defn-basetype"/> is one of the date and time related
datatypes), then the value <termref def="dt-must"/> be chronologically
greater than <propref ref="minExclusive-value"/>;
</p>
</item>
</olist>
</constraintnote>
</div4>

<div4 role="1.0" id="minExclusive-coss">
<head>Constraints on minExclusive Schema Components</head>
<constraintnote type="cos" id="minInclusive-minExclusive">
<head>minInclusive and minExclusive</head>
<p>
It is an <termref def="dt-error"/> for both
<termref def="dt-minInclusive"/> and <termref def="dt-minExclusive"/>
to be specified for the same datatype.
</p>
</constraintnote>

<constraintnote type="cos" id="minExclusive-less-than-maxInclusive">
<head>minExclusive &lt; maxInclusive</head>
<p>
It is an <termref def="dt-error"/> for the value specified for
<termref def="dt-minExclusive"/> to be greater than or equal to the value
specified for <termref def="dt-maxInclusive"/> for the same datatype.
</p>
</constraintnote>

<constraintnote type="cos" id="minExclusive-valid-restriction">
<head>minExclusive valid restriction</head>
<p>
It is an <termref def="dt-error"/> if any of the following conditions
is true:
</p>
<olist>
<item>
<p>
<compref ref="dc-minExclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="minExclusive-value"/> is
less than the <propref ref="minExclusive-value"/> of the parent
<compref ref="dc-minExclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-maxInclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="minExclusive-value"/> is
greater the <propref ref="maxInclusive-value"/> of the parent
<compref ref="dc-maxInclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-minInclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="minExclusive-value"/> is
less than the <propref ref="minInclusive-value"/> of the parent
<compref ref="dc-minInclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-maxExclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="maxExclusive-value"/> is
greater than or equal to the <propref ref="maxExclusive-value"/> of the parent
<compref ref="dc-maxExclusive"/>
</p>
</item>
</olist>
</constraintnote>
</div4>

</div3>

<div3 role="1.0" id="rf-minInclusive">
<head>minInclusive</head>

<p>
<termdef id="dt-minInclusive" term="minInclusive" role="local">
<term>minInclusive</term> is the <termref def="dt-inclusive-lower-bound"/>
of the <termref def="dt-value-space"/> for a datatype with the
<termref def="dt-ordered"/> property.&nbsp; The value of
<term>minInclusive</term>
&nbsp;<termref def="dt-must"/> be in the <termref def="dt-value-space"/> of the
<termref def="dt-basetype"/>.
</termdef>
</p>

<p>
<termref def="dt-minInclusive"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/> to values
with a specific <termref def="dt-inclusive-lower-bound"/>.
</p>
</item>
</ulist>

<note role="example">
<p>
The following is the definition of a <termref def="dt-user-derived"/>
datatype which limits values to integers greater than or equal to
100, using <termref def="dt-minInclusive"/>.
</p>
<eg><![CDATA[<simpleType name='one-hundred-or-more'>
  <restriction base='integer'>
    <minInclusive value='100'/>
  </restriction>
</simpleType>]]></eg>
</note>

<div4 role="1.0" id="dc-minInclusive">
<head>The minInclusive Schema Component</head>
<compdef name="minInclusive" ref="dt-minInclusive">
<proplist>
<propdef id="minInclusive-value" name="value">
A value from the <termref def="dt-value-space"/> of the
<propref ref="defn-basetype"/>.
</propdef>
<propdef id="minInclusive-fixed" name="fixed">
A <dtref ref="boolean"/>.
</propdef>
<propdef id="minInclusive-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>

<p>
If <propref ref="minInclusive-fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref ref="defn-basetype"/> cannot specify a
value for <compref ref="dc-minInclusive"/> other than <propref ref="minInclusive-value"/>.
</p>
</div4>

<div4 role="1.0" id="xr-minInclusive">
<head>XML Representation of minInclusive Schema Components</head>
<p>
The XML representation for a <compref ref="dc-minInclusive"/> schema
component is a <eltref ref="minInclusive"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="minInclusive"/>
<reprcomp abstract="minInclusive" ref="dt-minInclusive">
<reprdep>
<propref ref="minInclusive-value"/>&nbsp;<termref def="dt-must"/> be
in the <termref def="dt-value-space"/> of <propref ref="defn-basetype"/>.
</reprdep>
<propmap name="minInclusive-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="minInclusive-fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise false
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>
</div4>

<div4 role="1.0" id="minInclusive-validation-rules">
<head>minInclusive Validation Rules</head>
<constraintnote type="cvc" id="cvc-minInclusive-valid">
<head>minInclusive Valid</head>
<p>
A value in an <termref def="dt-ordered"/>&nbsp;<termref def="dt-value-space"/>
is facet-valid with respect to <termref def="dt-minInclusive"/> if:
</p>
<olist>
<item>
<p>
if the <termref def="dt-numeric"/> property in
<propref ref="defn-fund-facets"/> is <emph>true</emph>, then the
value <termref def="dt-must"/> be numerically greater than or equal to
<propref ref="minInclusive-value"/>;
</p>
</item>
<item>
<p>
if the <termref def="dt-numeric"/> property in
<propref ref="defn-fund-facets"/> is <emph>false</emph> (i.e.,
<propref ref="defn-basetype"/> is one of the date and time related
datatypes), then the value <termref def="dt-must"/> be chronologically
greater than or equal to <propref ref="minInclusive-value"/>;
</p>
</item>
</olist>
</constraintnote>
</div4>

<div4 role="1.0" id="minInclusive-coss">
<head>Constraints on minInclusive Schema Components</head>
<constraintnote type="cos" id="minInclusive-less-than-maxExclusive">
<head>minInclusive &lt; maxExclusive</head>
<p>
It is an <termref def="dt-error"/> for the value specified for
<termref def="dt-minInclusive"/> to be greater than or equal to the value
specified for <termref def="dt-maxExclusive"/> for the same datatype.
</p>
</constraintnote>

<constraintnote type="cos" id="minInclusive-valid-restriction">
<head>minInclusive valid restriction</head>
<p>
It is an <termref def="dt-error"/> if any of the following conditions
is true:
</p>
<olist>
<item>
<p>
<compref ref="dc-minInclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="minInclusive-value"/> is
less than the <propref ref="minInclusive-value"/> of the parent
<compref ref="dc-minInclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-maxInclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="minInclusive-value"/> is
greater the <propref ref="maxInclusive-value"/> of the parent
<compref ref="dc-maxInclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-minExclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="minInclusive-value"/> is
less than or equal to the <propref ref="minExclusive-value"/> of the parent
<compref ref="dc-minExclusive"/>
</p>
</item>
<item>
<p>
<compref ref="dc-maxExclusive"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="minInclusive-value"/> is
greater than or equal to the <propref ref="maxExclusive-value"/> of the parent
<compref ref="dc-maxExclusive"/>
</p>
</item>
</olist>
</constraintnote>
</div4>

</div3>

<div3 role="1.0" id="rf-totalDigits">
<head>totalDigits</head>

<p>
<termdef id="dt-totalDigits" term="totalDigits" role="local">
<term>totalDigits</term>
controls the maximum number of values in
the <termref def="dt-value-space"/>

of datatypes <termref def="dt-derived"/> from <dtref ref="decimal"/>,
by restricting it to numbers that are expressible as
<emph role="eq">i &times; 10^-n</emph> where <emph role="eq">i</emph>
and <emph role="eq">n</emph> are integers such that
<emph role="eq">|i| &lt; 10^totalDigits</emph> and
<emph role="eq">0 &lt;= n &lt;= totalDigits</emph>.
The value of
<term>totalDigits</term>&nbsp;<termref def="dt-must"/> be a
<dtref ref="positiveInteger"/>.
</termdef>
</p>

<p>

The term <term>totalDigits</term> is chosen to reflect the fact that it
restricts the <termref def="dt-value-space"/> to those values that can
be represented lexically using at most <emph role="eq">totalDigits</emph>
digits. Note that it does not restrict the <termref def="dt-lexical-space"/>
directly; a lexical representation that adds
additional leading zero digits or trailing fractional zero digits is
still permitted.

</p>






<div4 role="1.0" id="dc-totalDigits">
<head>The totalDigits Schema Component</head>
<compdef name="totalDigits" ref="dt-totalDigits">
<proplist>
<propdef id="totalDigits-value" name="value">
A <dtref ref="positiveInteger"/>.
</propdef>
<propdef id="totalDigits-fixed" name="fixed">
A <dtref ref="boolean"/>.
</propdef>
<propdef id="totalDigits-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>

<p>
If <propref ref="totalDigits-fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref ref="defn-basetype"/> cannot specify a
value for <compref ref="dc-totalDigits"/> other than
<propref ref="totalDigits-value"/>.
</p>
</div4>

<div4 role="1.0" id="xr-totalDigits">
<head>XML Representation of totalDigits Schema Components</head>

<p>
The XML representation for a <compref ref="dc-totalDigits"/> schema
component is a <eltref ref="totalDigits"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="totalDigits"/>
<reprcomp abstract="totalDigits" ref="dc-totalDigits">
<propmap name="totalDigits-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="totalDigits-fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise false
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>
</div4>

<div4 role="1.0" id="totalDigits-validation-rules">
<head>totalDigits Validation Rules</head>
<constraintnote type="cvc" id="cvc-totalDigits-valid">
<head>totalDigits Valid</head>
<p>
A value in a <termref def="dt-value-space"/> is facet-valid with
respect to <termref def="dt-totalDigits"/> if:
</p>
<olist>
<item>
<p>

that value is expressible as <emph role="eq">i &times; 10^-n</emph> where
<emph role="eq">i</emph> and <emph role="eq">n</emph> are integers such that
<emph role="eq">|i| &lt; 10^<propref ref="totalDigits-value"/></emph> and
<emph role="eq">0 &lt;= n &lt;= <propref ref="totalDigits-value"/></emph>.


</p>
</item>
</olist>
</constraintnote>
</div4>

<div4 role="1.0" id="totalDigits-coss">
<head>Constraints on totalDigits Schema Components</head>
<constraintnote type="cos" id="totalDigits-valid-restriction">
<head>totalDigits valid restriction</head>
<p>
It is an <termref def="dt-error"/> if
<compref ref="dc-totalDigits"/> is among the members of
<propref ref="defn-facets"/> of <propref ref="defn-basetype"/>
and <propref ref="totalDigits-value"/> is
greater than the <propref ref="totalDigits-value"/> of the parent
<compref ref="dc-totalDigits"/>
</p>
</constraintnote>

</div4>

</div3>

<div3 role="1.0" id="rf-fractionDigits">
<head>fractionDigits</head>

<p>
<termdef id="dt-fractionDigits" term="fractionDigits" role="local">
<term>fractionDigits</term>
controls the size of the minimum difference
between values

in the <termref def="dt-value-space"/> of datatypes <termref def="dt-derived"/>
from <term>decimal</term>,
by restricting the <termref def="dt-value-space"/> to numbers that are
expressible as <emph role="eq">i &times; 10^-n</emph> where
<emph role="eq">i</emph> and <emph role="eq">n</emph>
are integers and <emph role="eq">0 &lt;= n &lt;= fractionDigits</emph>.
The value of <term>fractionDigits</term>&nbsp;<termref def="dt-must"/>
be a <dtref ref="nonNegativeInteger"/>.
</termdef>
</p>

<p>

The term <term>fractionDigits</term> is chosen to reflect the fact that it
restricts the <termref def="dt-value-space"/> to those values that can be
represented lexically using at most <emph role="eq">fractionDigits</emph>
to the right of the decimal point. Note that it does not restrict the
<termref def="dt-lexical-space"/> directly; a
non-<termref def="dt-canonical-representation"/> that adds additional
leading zero digits or trailing fractional zero digits is still permitted.

</p>




<note role="example">
<p>
The following is the definition of a <termref def="dt-user-derived"/>
datatype which could be used to represent the magnitude
of a person's body temperature on the Celsius scale.
This definition would appear in a schema authored by an "end-user"
and shows how to define a datatype by specifying facet values which
constrain the range of the <termref def="dt-basetype"/>.
</p>
<eg><![CDATA[<simpleType name='celsiusBodyTemp'>
  <restriction base='decimal'>
    <totalDigits value='4'/>
    <fractionDigits value='1'/>
    <minInclusive value='36.4'/>
    <maxInclusive value='40.5'/>
  </restriction>
</simpleType>
]]></eg>
</note>

<div4 role="1.0" id="dc-fractionDigits">
<head>The fractionDigits Schema Component</head>
<compdef name="fractionDigits" ref="dt-fractionDigits">
<proplist>
<propdef id="fractionDigits-value" name="value">
A <dtref ref="nonNegativeInteger"/>.
</propdef>
<propdef id="fractionDigits-fixed" name="fixed">
A <dtref ref="boolean"/>.
</propdef>
<propdef id="fractionDigits-annotation" name="annotation">
Optional.&nbsp; An <xspecref href="&xsdl;#Annotation">annotation</xspecref>.
</propdef>
</proplist>
</compdef>

<p>
If <propref ref="fractionDigits-fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref ref="defn-basetype"/> cannot specify a
value for <compref ref="dc-fractionDigits"/> other than
<propref ref="fractionDigits-value"/>.
</p>
</div4>

<div4 role="1.0" id="xr-fractionDigits">
<head>XML Representation of fractionDigits Schema Components</head>

<p>
The XML representation for a <compref ref="dc-fractionDigits"/> schema
component is a <eltref ref="fractionDigits"/> element information item. The
correspondences between the properties of the information item and
properties of the component are as follows:
</p>

<reprdef>
<reprelt eltname="fractionDigits"/>
<reprcomp abstract="fractionDigits" ref="dc-fractionDigits">
<propmap name="fractionDigits-value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap name="fractionDigits-fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise false
</propmap>
<propmap name="defn-annotation">
The annotations corresponding to all the <eltref ref="annotation"/>
element information items in the &i-children;, if any.
</propmap>
</reprcomp>
</reprdef>
</div4>

<div4 role="1.0" id="fractionDigits-validation-rules">
<head>fractionDigits Validation Rules</head>
<constraintnote type="cvc" id="cvc-fractionDigits-valid">
<head>fractionDigits Valid</head>
<p>
A value in a <termref def="dt-value-space"/> is facet-valid with
respect to <termref def="dt-fractionDigits"/> if:
</p>
<olist>
<item>
<p>

that value is expressible as <emph role="eq">i &times; 10^-n</emph> where
<emph role="eq">i</emph> and <emph role="eq">n</emph>
are integers and <emph role="eq">0 &lt;= n &lt;= <propref ref="fractionDigits-value"/></emph>.


</p>
</item>
</olist>
</constraintnote>
</div4>

<div4 role="1.0" id="fractionDigits-coss">
<head>Constraints on fractionDigits Schema Components</head>
<constraintnote type="cos" id="fractionDigits-totalDigits">
<head>fractionDigits less than or equal to totalDigits</head>
<p>
It is an <termref def="dt-error"/> for <termref def="dt-fractionDigits"/> to
be greater than <termref def="dt-totalDigits"/>.
</p>
</constraintnote>
<constraintnote type="cos" id="fractionDigits-valid-restriction">
<head>fractionDigits valid restriction</head>
<p>
It is an <termref def="dt-error"/> if <termref def="dt-fractionDigits"/>
is among the members of <propref ref="defn-facets"/> of <propref ref="defn-basetype"/> and
<propref ref="fractionDigits-value"/> is greater than the <propref ref="fractionDigits-value"/> of the parent
<termref def="dt-fractionDigits"/>.
</p>
</constraintnote>
</div4>
</div3>

</div2>

</div1>

<div1 role="1.0" id="conformance">
<head>Conformance</head>
<p>
This specification describes two levels of conformance for
datatype processors.&nbsp; The first is
required of all processors.&nbsp; Support for the other will depend on the
application environments for which the processor is intended.
</p>
<p>
<termdef id="dt-minimally-conforming" term="minimally conforming">
<term>Minimally conforming</term> processors <termref def="dt-must"/>
completely and correctly implement the <termref def="dt-cos"/> and
<termref def="dt-cvc"/>
.
</termdef>
</p>
<p>
<termdef id="dt-interchange" term="conformance to the XML Representation
of Schemas">
Processors which accept schemas in the form of XML documents as described
in <specref ref="xr-defn"/> (and other relevant portions of
<specref ref="datatype-components"/>) are additionally said to provide
<term>conformance to the XML Representation of Schemas</term>,
and <termref def="dt-must"/>, when processing schema documents, completely and
correctly implement all
<termref def="dt-src"/>s
in this specification, and <termref def="dt-must"/> adhere exactly to the
specifications in <specref ref="xr-defn"/>  (and other relevant portions of
<specref ref="datatype-components"/>) for mapping
the contents of such
documents to <xtermref href="&xsdl;#key-component">schema components</xtermref>
for use in validation.
</termdef>
</p>
<note>
<p>
By separating the conformance requirements relating to the concrete
syntax of XML schema documents, this specification admits processors
which validate using schemas stored in optimized binary representations,
dynamically created schemas represented as programming language data
structures, or implementations in which particular schemas are compiled
into executable code such as C or Java.&nbsp; Such processors can be said to
be <termref def="dt-minimally-conforming">minimally conforming</termref>
but not necessarily in <termref def="dt-interchange">conformance to
the XML Representation of Schemas</termref>.
</p>
</note>
</div1>

</body>
<back>
<div1 role="1.0" id="schema">
<head>Schema for Datatype Definitions (normative)</head>
<eg xml:space="preserve" text="./&meForTxt;.xsd.txt"/>
</div1>
<div1 role="1.0" id="dtd-for-datatypeDefs">
<head>DTD for Datatype Definitions (non-normative)</head>
<eg xml:space="preserve" text="./&meForTxt;.dtd.txt"/>
</div1>

<!-- ********************************** BEGIN NEW 1.1 MATERIAL (JUNK) ************************************* -->
<div1 id="temporaryJunk" diff="add"><head>Temporary Stuff (to be added elsewhere)</head>

<note id="year-sec-conformance"><p>
All <termref def="dt-minimally-conforming"/> processors <termref def="dt-must"/>
support year values with a minimum of 4 digits (i.e., <code>YYYY</code>) and a minimum fractional second precision of milliseconds or three decimal digits (i.e. <code>s.sss</code>).  However,
<termref def="dt-minimally-conforming"/> processors <termref def="dt-may"/>
set an application-defined limit on the maximum number of digits
they are prepared to support in these two cases, in which case that application-defined
maximum number <termref def="dt-must"/> be clearly documented.
</p></note>

<p>
<termdef id="dt-constructed" term="constructed"><term>Constructed</term>
datatypes are those that are defined in terms of other datatypes.</termdef></p>

<p><termdef id="dt-derived-DONTREFYET" term="derived"><term>Derived</term>
datatypes are those that are <termref def="dt-constructed"/> by restiction or extension.</termdef></p>

</div1>

<!-- ********************************** END NEW 1.1 MATERIAL (JUNK) ************************************* -->

<!-- ********************************** BEGIN NEW 1.1 MATERIAL (Const Val Spaces) ************************************* -->

<div1 id="constructedValueSpaces" diff="add">
<head>Built-up Value Spaces</head>
<p>Some datatypes, such as <dtref ref="integer"/>, describe well-known mathematically abstract 
systems.&nbsp; Others, such as the date/time datatypes, describe <unusual>real-life</unusual>, 
<unusual>applied</unusual> systems.&nbsp; Certain
of the systems described by datatypes, both abstract and
applied, have values in their value spaces most easily described as things having several <emph>properties</emph>, which in turn have values which are
in some sense <unusual>primitive</unusual> or are from the value spaces of simpler datatypes.</p>

<p>In this document, the arguments to functions are assumed to be <unusual>call by
value</unusual> unless explicitly noted to the contrary, meaning that if the argument is modified
during the processing of the algorithm, that modification is <emph>not</emph> reflected in the
<unusual>outside world</unusual>.&nbsp; On the other hand, the arguments to procedures are assumed
to be <unusual>call by location</unusual>, meaning that modifications <emph>are</emph> so reflected,
since that is the only way the processing of the algorithm can have any effect.</p>

<p>Properties always have values.&nbsp; <termdef id="dt-optional" term="optional">An <term>optional</term>
property is <emph>permitted</emph> but not <emph>required</emph> to have the special
value <pt>absent</pt>.</termdef></p>

<p>Those values that are more primitive, and are used (among other things) herein to
construct object value spaces but which we do not explicitly define are described here:
<ulist>
<item><p>A <term>number (without precision)</term> is an
ordinary mathematical number; see <specref ref="sec-numericalValues"/> for a discussion of
<unusual>ordinary</unusual> versus <unusual>precision-carrying</unusual> numbers.&nbsp; The numbers generally used in describing datatypes are <emph>&decimal;s</emph> and <emph>&integer;s</emph>.</p></item>

<item><p><dt id="constant" name="constant">An <term>enumerated constant</term> is an
undefined <unusual>thing</unusual> whose only property is that it is unequal to any other
<term>constants</term> and to any member of any defined datatype.</dt>  (There are a few
<term>constants</term> which are specified by name to be members of the value space of more than
one primitive datatype.&nbsp; Such <term>constants</term> are differentiated by their name <emph>and
associated datatype</emph>; this is because members of the value space of distinct primitive
datatypes are always distinct.&nbsp; Apart from that, <term>constants</term> are differentiated one
from the other by their name.&nbsp; They have no other inherent properties; their effect is defined
in the context in which they occur.&nbsp; Examples of <term>constants</term> are <pt>positiveInfinity</pt> and <pt>absent</pt>.</p></item>
</ulist>
</p>

<div2 id="sec-numericalValues"><head>Numerical Values</head>
<p>The following standard operators are defined here in case the reader is unsure of their definition:
<ulist>
<item><p><termdef id="dt-div" term="div">If <var>m</var> and <var>n</var> are numbers, then
<var>m</var>&nbsp;<term>div</term> <var>n</var> is the greatest integer in&nbsp;
<var>m</var>&nbsp;/&nbsp;<var>n</var>&nbsp;.</termdef></p>

</item><item><p><termdef term="mod" id="dt-mod">If <var>m</var> and <var>n</var> are numbers, then
<var>m</var> <term>mod</term> <var>n</var> is&nbsp;
(<var>m</var>&nbsp;/&nbsp;<var>n</var>)&nbsp;&minus;&nbsp;(&nbsp;<var>m</var>&nbsp;<termref def="dt-div"></termref>&nbsp;<var>n</var>)&nbsp;.</termdef>
</p></item></ulist>
</p>

<note><p><var>n</var>&nbsp;<termref def="dt-div"></termref>&nbsp;1&nbsp; is a convenient and short way of
expressing <quote>the greatest integer in <var>n</var></quote>.</p></note>

<div3 id="sec-precision"><head>Precision</head>
<p>Numbers are sometimes thought of as including both a numerical value and a
<unusual>precision</unusual>.&nbsp; Precision can be thought of as a band
<unusual>plus or minus</unusual> from the numerical value itself.&nbsp; For
example, <quote>five plus-or-minus two</quote> or <quote>two million to the
nearest thousand</quote>.</p>

<p>There is a smaller class of <unusual>precision numbers</unusual> which do
not require the <quote>plus-or-minus</quote> in order to indicate their
precision.&nbsp; They indicate their precision by the number of digits to the
right of the decimal point.&nbsp; 5.0 has precision plus-or-minus 0.05, but
5.00 has precision plus-or-minus 0.005.</p><p>There is also a kind of precision
where the plus-or-minus is expressed as a percentage (or other proportion) of
the numerical value, rather than an exact value:&nbsp; <quote>15 plus-or-minus
10 percent</quote> or <quote>15000 plus-or-minus 10 percent</quote>, where the
same percentage indicates a different absolute precision depending on the
size.&nbsp; This kind of precision is properly called <quote>geometric
precision</quote>; the absolute precision first described is properly called
<quote>arithmetic precision</quote>.</p>

<p>A close approximation to geometric precision also can, for some combinations
of numerical value and precision, be indicated without the
<quote>plus-or-minus</quote>:&nbsp; The precision is indicated by the total
number of digits (not counting  leading zero digits).&nbsp; 5.0 has precision
plus-or-minus 1 percent but 5.00 has precision plus-or-minus one-tenth percent.</p>

<p>Geometric precision doesn't quite match with the digit count.&nbsp; 5.0 and 50
both have precision plus-or-minus 1 percent but 1.5 and 15 both have precision
plus-or-minus 3 percent.&nbsp; For various reasons we choose to call this digit-count
precision <quote>floating-point precision</quote>.</p>

<p>The <dtref ref="precisionDecimal"/> datatype described in this specification
embodies both arithmetic and floating-point precision for numbers whose numerical
values are &decimal;s, with arithmetic precision describable simply
by the number of fraction digits.  It turns out that for these particular precision
numbers, there is a relation between the arithmetic precision (expressed as  the
number of fraction digits) and floating-point precision (expressed as the total
number of digits, excluding redundant leading zero digits).&nbsp; If <var>a</var>
is the arithmetic precision of a <dtref ref="precisionDecimal"/> number whose
numerical value is <var>n</var>, then the floating-point precision is&nbsp;
(log(|&nbsp;<var>n</var>&nbsp;&minus;&nbsp;10<sup><var>a</var></sup>&nbsp;|)&nbsp;+&nbsp;1)&nbsp;<termref def="dt-div"></termref>&nbsp;1&nbsp;.&nbsp;
This formula, of course, doesn't work for numerical value zero.&nbsp; In that case, we find it convenient (and
consonant with established practice) to freeze floating-point precision at 1 and still allow various
arithmetic precision values.</p>

<p>One point needs to be made about the notations and the precisions they can
indicate.&nbsp; It's impossible for ordinary decimal notation to indicate a
positive arithmetic precision (as in <quote>one million to the nearest thousand</quote>);
this needs <unusual>scientific notation</unusual>:&nbsp; 1000E3 (or 1.000E6).</p>
</div3>

<div3><head> Exact Lexical Mappings</head>
<p><?xm-replace_text {p}?>

<defset role="prod"><head>Numerals and Fragments Thereof</head>
<prodgroup>

<prod id="nt-digit"><lhs>digit</lhs><rhs><charclass>0-9</charclass></rhs></prod>

<prod id="nt-unsNoDecNuml"><lhs>unsignedNoDecimalPtNumeral</lhs><rhs><nt def="nt-digit"/>+</rhs></prod>

<prod id="nt-sNoDecNuml"><lhs>signedDecimalPtNumeral</lhs><rhs>(<string>+</string>&nbsp;|&nbsp;<string>-</string>)&nbsp;<nt def="nt-unsNoDecNuml"/></rhs></prod>

<prod id="nt-noDecNuml"><lhs>noDecimalPtNumeral</lhs><rhs>(<string>+</string>&nbsp;|&nbsp;<string>-</string>)?&nbsp;<nt def="nt-unsNoDecNuml"/></rhs></prod>

<prod id="nt-fracFrag"><lhs>fracFrag</lhs><rhs><nt def="nt-digit"/>+</rhs></prod>

<prod id="nt-unsDecNuml"><lhs>unsignedDecimalPtNumeral</lhs>
<rhs>(<nt def="nt-unsNoDecNuml"/>&nbsp;<string>.</string>&nbsp;<nt def="nt-fracFrag"/>?)&nbsp;|&nbsp;(<string>.</string>&nbsp;<nt def="nt-fracFrag"/>)</rhs></prod>

<prod id="nt-unsFullDecNuml"><lhs>unsignedFullDecimalPtNumeral</lhs>
<rhs><nt def="nt-unsNoDecNuml"/>&nbsp;<string>.</string>&nbsp;<nt def="nt-fracFrag"/></rhs></prod>

<prod id="nt-decNuml"><lhs>decimalPtNumeral</lhs><rhs>(<string>+</string>&nbsp;|&nbsp;<string>-</string>)?&nbsp;<nt def="nt-unsDecNuml"/></rhs></prod>

<prod id="nt-unsSciNuml"><lhs>unsignedScientificNotationNumeral</lhs>
<rhs>(<nt def="nt-unsNoDecNuml"/>&nbsp;|&nbsp;<nt def="nt-unsDecNuml"/>) (<string>e</string>&nbsp;|&nbsp;<string>E</string>) <nt def="nt-noDecNuml"/></rhs></prod>

<prod id="nt-sciNuml"><lhs>scientificNotationNumeral</lhs>
<rhs>(<string>+</string>&nbsp;|&nbsp;<string>-</string>)?&nbsp;<nt def="nt-unsSciNuml"/></rhs></prod>
</prodgroup></defset>

<defsetsum ref="defs-genNNLexMaps"/>

<defsetsum ref="defs-genNNCanMaps"/>

Some numerical datatypes include some or all of three <dtref ref="constant"/> non-numerical values:&nbsp;
<pt>positiveInfinity</pt>, <pt>negativeInfinity</pt>, and <pt>notANumber</pt>.&nbsp; Their lexical spaces
include non-numeral lexical representations for these non-numeric values:

<defset><head>Special Non-numerical Lexical Representations Used With Numerical Datatypes</head>
<prod id="nt-numSpecReps"><lhs>numericalSpecialRep</lhs>
<rhs><string>INF</string>&nbsp;|&nbsp;<string>+INF</string>&nbsp;|&nbsp;<string>-INF</string>&nbsp;|&nbsp;<string>NaN</string></rhs></prod>
</defset>

<defsetsum ref="defs-NumericSpecialLexmap"/>

<defsetsum ref="defs-NumericSpecialCanmap"/>

</p>
</div3>

<div3><head><?xm-replace_text {head}?></head>
<p>
<?xm-replace_text {p}?>
</p>
</div3></div2>

<div2 id="d-t-values"><head>Date/time Values</head>

<issue id="RQ-122i" role="1.1">
<p><loc href="&reqs;#dateTime-values" target="reqs">RQ-122 (define dateTime value space)</loc></p>
<p>Much of the material defining the various date/time datatypes is found here and is or will be referenced
in the sections defining each individual date/time datatype.  See e.g. <specref ref="gDay"/>.</p>
</issue>

<p>There are several different primitive but related datatypes defined
in the specification which pertain to various combinations of dates and
times, and parts thereof.&nbsp; They all use related value-space models, which
are described in detail in this section.&nbsp; It is not difficult for a casual
reader of the descriptions of the individual datatypes elsewhere in this
specification to misunderstand some of the details of just what the datatypes
are intended to represent, so more detail is presented here in this section.</p>

<div3 id="dTReal"><head>Dates and Times in the Real World</head>
<p><phrase role="UNSURE">Except for the tables of lengths of months and occurrences of leap-seconds,
this section is informative, not normative.</phrase></p>

<p>There are various concepts involving dates (counting days) and times (counting moments)
that have developed over the millenia.&nbsp; This section does not pretend to be a complete
tutorial on the history; it only discusses the methods which are necessary to understand
just which set of the possible reasonable choices has been adopted for Schema date/time datatypes.</p>

<div4 id="secMinDay"><head>Seconds, Minutes, and Days</head>
<p>A day is, at least approximately, the time of one rotation of the Earth about
its axis with respect to the Sun.&nbsp; Each day is divided into 24 hours; each hour
into 60 minutes, and each minute <emph>usually</emph> into 60 seconds.&nbsp; (The hedges
in those sentences are deliberate, and their resolution shows why one must be careful
to insure that all users of Schema date/time datatypes are in fact correctly using
the same datatype.)&nbsp; For the purposes of this section and the next, a day always
begins and ends when the rotation of the Earth about its axis places the Sun exactly
(at least for UT1, and approximately for the others) overhead (at its <quote>zenith</quote>)
<emph>at 0 degrees longitude</emph>.</p><p>Thus a day is (usually) 86400
(=&nbsp;60&nbsp;&times;&nbsp;60&nbsp;&times;&nbsp;24) seconds.</p>
<p>
<termdef term="UT1" id="dt-ut1"><term>Universal Time 1</term> (<term>UT1</term>) is
<quote>real</quote> time:  One day is (exactly, or at least as close as can be astronomically
measured) one revolution of the Earth about its axis with respect to the Sun.&nbsp; The day is
divided into 86400 equal-length seconds, which may vary in length from day to day.</termdef> 
<termdef id="dt-tai" term="TAI"><term>International Atomic Time</term> (<term>TAI</term> or
<term>Temps Atomique International</term>) is time measured in seconds as established by a
collection of atomic clocks maintained by various national standards agencies.</termdef>  The time
counts that Schema has chosen to represent
are based on <termref def="dt-utc"></termref>:  <termdef term="UTC" id="dt-utc"><term>Universal Coordinated Time</term>
(<term>UTC</term>) is an adaptation of TAI which closely
approximates UT1 by adding <termref def="dt-leapsec">leap-seconds</termref>
to selected <termref def="dt-utc"></termref> days.</termdef> 
Relations between them are as follows:
<ulist>
<item><p>TAI seconds are all the same length, and there
are exactly 86400 seconds in each day.</p></item>
<item><p>UT1 seconds vary in length, but there are exactly
86400 seconds each day.&nbsp; Days always have the sun at zenith at noon in Greenwich,
England.&nbsp; (As a historical note, the TAI second, defined
in 1956 in terms of the excitation frequency of Cesium atoms, was chosen to be the average
length of a UT1 second during the year 1900.)</p></item>
<item><p>Noon of TAI days do not necessarily match the Sun
at the zenith. In 1958, TAI
was promulgated and synchronized with UT1.&nbsp; Since then, the difference
has been slowly increasing, with a given number of seconds from that date measured in
UT1 coming later than that same number measured in
TAI.</p></item>
<item><p><termref def="dt-utc"></termref> seconds are the same as TAI seconds, but
<termdef id="dt-leapsec" term="leap-second"><termref def="dt-utc"></termref> day
boundaries are kept approximately in sync with UT1 by
adding an extra <term>leap-second</term> or so to a day once in a while</termdef>;
therefore occasionally a <termref def="dt-utc"></termref> day is not exactly 86400
seconds.&nbsp; In <phrase role="UNSURE">1972</phrase>, <termref def="dt-utc"></termref>
was synchronized with TAI (and UT1)  to lock them all together
<phrase role="UNSURE">retroactively to the date when TAI was synchronized with
UT1</phrase>.&nbsp; <termref def="dt-utc"></termref> is now kept within 0.9 seconds of
UT1 by an international standards organization which
declares on an <emph>ad hoc</emph> basis when additional leap-seconds
are added (or subtracted, although the physical situations that might require
substraction seem unlikely to occur).&nbsp; As of 2003, the difference between the two
is 32 seconds.&nbsp; New leap-seconds
are always added immediately preceding midnight (when the Earth's rotation puts
the Sun opposite the noon zenith) at 0 degrees longitude (i.e., midnight in the
timezone so determined).</p>
<p>
As of the writing of this specification, leap-seconds have been added to <termref def="dt-utc"></termref> at
the end of each of the following days (as identified by the Gregorian calendar,
see <specref ref="dayYM"/>), and no future leap-seconds have been announced:
</p>
<p><table border="1"><thead>
<tr><td>Date</td><td>Number of Leap-seconds</td>
<td>Date</td><td>Number of Leap-seconds</td></tr>
</thead><tbody>
<tr><td>1960-12-31</td><td>1.422818</td><td>1975-12-31</td><td>1</td></tr>
<tr><td>1961-07-31</td><td>0.224752</td><td>1976-12-31</td><td>1</td></tr>
<tr><td>1961-01-31</td><td>0.198288</td><td>1977-12-31</td><td>1</td></tr>
<tr><td>1963-10-30</td><td>0.8514208</td><td>1978-12-31</td><td>1</td></tr>
<tr><td>1963-12-31</td><td>0.0685152</td><td>1989-12-31</td><td>1</td></tr>
<tr><td>1964-03-31</td><td>0.217936</td><td>1981-06-30</td><td>1</td></tr>
<tr><td>1964-08-31</td><td>0.298288</td><td>1982-06-30</td><td>1</td></tr>
<tr><td>1964-01-31</td><td>0.258112</td><td>1983-06-30</td><td>1</td></tr>
<tr><td>1965-02-28</td><td>0.176464</td><td>1985-06-30</td><td>1</td></tr>
<tr><td>1965-06-30</td><td>0.258112</td><td>1987-12-31</td><td>1</td></tr>
<tr><td>1965-08-31</td><td>0.180352</td><td>1989-12-31</td><td>1</td></tr>
<tr><td>1965-12-31</td><td>0.158112</td><td>1990-12-31</td><td>1</td></tr>
<tr><td>1968-01-31</td><td>1.872512</td><td>1992-06-30</td><td>1</td></tr>
<tr><td>1971-12-31</td><td>3.814318</td><td>1993-06-30</td><td>1</td></tr>
<tr><td>1972-06-30</td><td>1</td><td>1994-06-30</td><td>1</td></tr>
<tr><td>1972-12-31</td><td>1</td><td>1995-12-31</td><td>1</td></tr>
<tr><td>1973-12-31</td><td>1</td><td>1997-06-30</td><td>1</td></tr>
<tr><td>1974-12-31</td><td>1</td><td>1998-12-31</td><td>1</td></tr>
</tbody></table></p>
<p>
<phrase role="UNSURE">Leap-seconds added prior to 1972-06-30 (when <termref def="dt-utc"></termref>'s
first post-adoption leap-second was added) were inherited from previous
<quote>standard</quote> times.</phrase>  (Data in the table was derived
from data provided by the US Naval Observatory.)</p>

<!--ednote><edtext>Do
we need more of a reference?</edtext></ednot-->

</item>
</ulist>
</p>
<note>
<p>There are inherently no precise measurements of the difference between
UT1 on the one hand and proleptic (i.e., used to measure times prior to their
adoption) TAI and <termref def="dt-utc"></termref> on the other before 1958, although they are known (by virtue of
early astornomical records) to differ from UT1 by several hours around year
0000.&nbsp; Users must be aware that
they differ, if they deal with extremely accurate measures over widely separated
moments, and must be sure they know which system is being used.
</p></note>
<p>Schema date/time datatypes (except <dtref ref="duration"/>) are
leap-second-aware; that is to say, they use <termref def="dt-utc"></termref> rather than UT1 or
TAI.&nbsp; <dtref ref="duration"/> is a special case; it is <emph>not</emph> leap-second 
aware, but the algorithm for adding durations to or subtracting them from other date/time 
datatypes compensates.</p>

</div4><div4 id="dayYM"><head>Counting Days:  Years and Months</head>
<p>Once one decides on how many seconds are in each day, one must also count the days&mdash;and
months and years.&nbsp; The standard used for Schema date/time datatypes is the so-called
<quote>Gregorian calendar</quote>.&nbsp; Since days are (generally) 86400 seconds, and one
wants each year to correspond to one complete cycle of the Earth around the Sun (which
is not exactly a multiple of 86400 seconds), and traditionally months have various numbers
of days, the following algorithm was chosen to determine which days
fell in which months in which years:  Counting from an agreed-upon arbitrary day, years are
numbered consecutively, each year has 12 months (numbered 1 through 12, as well as named)
within it, and each day has between 28 and 31 days (also numbered from 1), depending on
the month and year according to the following table:</p>
<table border="1"><thead><tr><th>Month</th><th>Nbr of Days</th></tr></thead>
<tbody><tr><th>1 (January)</th><th>31</th></tr>
<tr><th>2 (February)</th><th>If the associated year is divisble by 400, or by 4 but not 100,
then 29; otherwise 28</th></tr>
<tr><th>3 (March)</th><th>31</th></tr>
<tr><th>4 (April)</th><th>30</th></tr>
<tr><th>5 (May)</th><th>31</th></tr>
<tr><th>6 (June)</th><th>30</th></tr>
<tr><th>7 (July)</th><th>31</th></tr>
<tr><th>8 (August)</th><th>31</th></tr>
<tr><th>9 (September)</th><th>30</th></tr>
<tr><th>10 (October)</th><th>31</th></tr>
<tr><th>11 (November)</th><th>30</th></tr>
<tr><th>12 (December)</th><th>31</th></tr></tbody></table><p>For example, the three numbers
(year, month, and day) for 20 January 2003 (2003-01-20) are 2003, 1, and 20 respectively.</p>

<issue id="RQ-123i" role="1.1">
<p><loc href="&reqs;#year-zero" target="reqs">RQ-123 (year 0000 in date/time datatypes)</loc></p>
<p>The following rewrite includes allowing year 0000 (1 BCE) and redefining all the lexical representations with negative years from that
specified in Schema 1.0, as warned in a Note in Schema 1.0 2E.&nbsp; A formal Note calling attention to this change elsewhere in the
"normative" part of this specification will be added.</p>
</issue>

<p>The count of years, months, and days were made official and locked to <quote>real</quote> time
by decree of (the Roman Catholic) Pope Gregory in 1582 (from which comes the name
<quote>Gregorian</quote>).&nbsp; Since then, and somewhat even before, days had been counted
with reasonable historical accuracy so that the Gregorian calendar algorithm can even be
used proleptically, i.e., to establish dates prior to its official adoption.&nbsp;
By relatively recent convention (it began to be adopted by astronomers during the 1800s), there is a year
numbered zero; this makes calculating the difference between two dates easier.&nbsp; The year called
<quote>1 of the Common Era</quote> (<quote>1 CE</quote>, or <quote>1 AD</quote>) is numbered one; the
preceding year is numbered zero, not minus one.&nbsp; (Warning:  The date using the proleptic
Gregorian calendar will not generally be the same for a given day as the date using the
<quote>Julian</quote> calendar which was in common use prior to the adoption of the
Gregorian calendar, nor will Gregorian years <quote>before the Common Era</quote> (<quote>BCE</quote>, 
or <quote>BC</quote>) be numbered the same as with the current standard negative numbering.)</p>
<p>There are also standard
schemes for numbering days without reference to months and years.&nbsp; The most common is
 <termdef id="dt-mjd" term="MJD">the <term>modified Julian date</term> (<term>MJD</term>),
which counts days from 17 Nov 1858 (1858-11-17).</termdef>  The older count is
<termdef id="dt-jd" term="JD">the <term>Julian date</term> (<term>JD</term>), which
sets its zero day exactly 2,400,000.5 days earlier than MJD.</termdef> 
(JD days begin at noon!)  Schema, however, counts seconds rather than days and arbitrarily
begins its initial moment at the beginning of 1 Jan 1 CE (0001-01-01), to describe certain 
functions.&nbsp; (Since a schema
implementation need not expose this count, implementers are free to use other base 
moments and/or to count by days, providing they retain awareness of 
<termref def="dt-leapsec">leap-seconds</termref>.)</p>
<p>Note that the JD <emph>day-counting scheme</emph> is not the same as the Julian  <emph>calendar</emph> 
which was supplanted by the Gregorian calendar described above.</p>
</div4>
<div4><head>Timezones:  When does a Day Start?</head>
<p>All of the preceding discussion applies to <quote>real</quote> times 
<emph>at the <quote>Greenwich meridian</quote>, the meridian where longitude is 0 
degrees</emph>.&nbsp; Human society has found it convenient to have noon all over the 
globe at least approximately when the Sun is overhead&mdash;and more recently also 
to have moments numbered the same in nearby localities, with the differences between 
separated localities well-known.&nbsp; Thus the invention of 
timezones.&nbsp; A <emph>timezone</emph> is 
a way of describing a local time by specifying the number of hours and minutes which 
must be added to the <quote>standard</quote> time to get the local time.&nbsp; The 
<quote>standard</quote> time is selected to be that where noon is when the Sun is 
exactly overhead at 0 degrees longitude; <termref def="dt-utc"></termref> is officially locked to that particular 
timezone.&nbsp; Schema date/time datatypes (except <dtref ref="duration"/>) are timezone-sensitive; 
that is to say, they retain knowledge of a timezone if one is specified in a lexical representation.</p>
<p>A moment in time is like a point on a line; the point does not change if we change where we 
put zero on the line, but the number we use to represent that point changes.&nbsp; Similarly, when 
one specifies a moment in time, one can specify the same moment regardless of which timezone 
one specifies, but the numbers one uses for year, month, day, hour, minute, and second will be different.</p>
</div4></div3>

<div3 id="theSevenPropertyModel"><head>The Seven-property Model</head>

<p>There are two distinct ways to model moments in time:  either by tracking their year,
month, day, hour, minute and second (with fractional seconds as needed), or by tracking
their time (measured generally in seconds or days) from some starting moment.&nbsp; Each has
its advantages.&nbsp; The two are isomorphic; the Gregorian calendar algorithm, modified for
<termref def="dt-leapsec">leap-seconds</termref>, is the isomorphism from the first to the
second and is one-to-one.&nbsp; For definiteness, we choose to model the first
using five &integer; and one &decimal; properties.&nbsp; We superimpose
the second by providing one &decimal;-valued function which gives the corresponding count of
seconds from zero (the <unusual>time on the time line</unusual>).</p>

<p>There is also a seventh <dtref ref="integer"/> property which
specifies the timezone.&nbsp; Values for the six primary properties are always stored in
<termref def="dt-utc"></termref>, so having the timezone makes it possible to calculate the corresponding <unusual>raw</unusual> values,
as they would be reckoned in that timezone.

<defset role="prop">
<head>Properties of <dt id="dt-dt-7PropMod" name="date/timeSevenPropertyModel">Date/time Seven-property Models</dt></head>
<vpropdef><name id="vp-dt-year">year</name>
<limits>an &integer;</limits>
</vpropdef>
<vpropdef><name id="vp-dt-month">month</name>
<limits>an &integer; between 1 and 12 inclusive</limits>
</vpropdef>
<vpropdef><name id="vp-dt-day">day</name>
<limits>an &integer; between 1 and 28, 29, 30, or 31 inclusive, depending on
<pfref ref="vp-dt-month"/> and <pfref ref="vp-dt-year"/></limits>
</vpropdef>
<vpropdef><name id="vp-dt-hour">hour</name>
<limits>an &integer; between 0 and 23 inclusive, or 24 if both <pfref ref="vp-dt-minute"/> and <pfref ref="vp-dt-second"/>
are zero</limits>
</vpropdef>
<vpropdef><name id="vp-dt-minute">minute</name>
<limits>an &integer; between 0 and 59 inclusive</limits>
</vpropdef>
<vpropdef><name id="vp-dt-second">second</name>
<limits>a &decimal; greater than or equal 0, less than 60 except as prescribed in the table of leap-seconds
in <specref ref="secMinDay"/>; must be less than 60 if <pfref ref="vp-dt-timezone"/> is <pt>absent</pt>.</limits>
</vpropdef>
<vpropdef><name id="vp-dt-timezone">timezone</name>
<limits>an <termref def="dt-optional"></termref> &integer; between &minus;840 and 840 inclusive</limits>
</vpropdef>
</defset>
</p>
<p>The model just described is called herein the <quote>seven-property</quote> model for date/time 
datatypes.&nbsp; It is used <unusual>as is</unusual> for <dtref ref="dateTime"/>; all other date/time 
datatypes except <dtref ref="duration"/> use the same model except that some of the six primary 
properties are <emph>required</emph> to have the value <pt>absent</pt>, instead of being required 
to have a numerical value.&nbsp; (An <emph><termref def="dt-optional"></termref></emph> 
property, like <pfref ref="vp-dt-timezone"/>, is always <emph>permitted</emph> 
to have the value <pt>absent</pt>.)</p><p><pfref ref="vp-dt-timezone"/> 
values are limited to 14 hours,  which is 840 (=&nbsp;60&nbsp;&times;&nbsp;14) 
minutes.</p>

<note>
<p>Leap-seconds are not permitted when <pfref ref="vp-dt-timezone"/> is
<pt>absent</pt>, because the presence of a leap-second value together with  particular
<pfref ref="vp-dt-hour"/> and <pfref ref="vp-dt-minute"/> values determines a
<pfref ref="vp-dt-timezone"/> so it might as well be explicit.&nbsp; (All date/time
datatypes that do not require <pfref ref="vp-dt-second"/> to be <pt>absent</pt> also prohibit
that value for <pfref ref="vp-dt-hour"/> and <pfref ref="vp-dt-minute"/>.)</p>
</note>

<p>
While calculating, property values from the <dtref ref="dateTime"/> 1971-12-31T00:00:00 are used to fill in
for those that are <pt>absent</pt>, except that if <pfref ref="vp-dt-day"/> is <pt>absent</pt>
but <pfref ref="vp-dt-month"/> is not, the largest permitted
day for that month is used.&nbsp; 1971-12-31T00:00:00 happens to permit both the maximum number
of days and the maximum number of seconds.

<defsetsum ref="defs-dt-ToTl"/>

</p>

<p>Values from any one date/time datatype using the seven-component model (all except <dtref ref="duration"/>)
are ordered the same as their <pfref ref="vp-dt-timeOnTimeline"/> values, except that if one value&apos;s
<pfref ref="vp-dt-timezone"/>
is <pt>absent</pt> and the other&apos;s is not, and using maximum and minimum <pfref ref="vp-dt-timezone"/>
values for the one whose <pfref ref="vp-dt-timezone"/> is actually <pt>absent</pt> changes the resulting (strict)
inequality, the original two values are incomparable.

<!--  (I don't think we'll use this algorithm.)
<defset role="func"><head>The <unusual>14-hour difference</unusual> Algorithm</head>
<pfdef><pfsdt><pf id="f-dt-14HrDiff">14HourDifference</pf><dtref ref="boolean"/></pfsdt>
<pfargs><pfarg><var>dttz</var>
<limits>a <dtref ref="dt-dt-7PropMod"/> value whose <pfref ref="vp-dt-timezone"/> is <emph>not</emph> <pt>absent</pt></limits></pfarg>
<pfarg><var>dt</var>
<limits>a <dtref ref="dt-dt-7PropMod"/> value whose <pfref ref="vp-dt-timezone"/> <emph>is</emph> <pt>absent</pt></limits></pfarg></pfargs>
<algorithm>
<olist>
<item><p>Set <var>dt</var>&apos;s <pfref ref="vp-dt-timezone"/> to 840.</p></item>
<item><p>Simultaneously set the six <unusual>raw</unusual> computed properties to the current
<unusual>real</unusual> values of <var>dt</var>&apos;s corresponding properties.&nbsp; (This will change the
values of the properties themselves to reflect the <pfref ref="vp-dt-timezone"/>.)</p></item>
<item><p>Set <var>b</var> to&nbsp;
(<var>dt</var>&nbsp;&lt;&nbsp;<var>dttz</var>)&emsp; (either <pt>true</pt> or <pt>false</pt>)</p></item>
<item><p>Set <var>dt</var>&apos;s <pfref ref="vp-dt-timezone"/> to &minus;840.</p></item>
<item><p>Again simultaneously set the six <unusual>raw</unusual> computed properties to the (original)
<unusual>real</unusual> values of <var>dt</var>&apos;s corresponding properties.</p></item>
<item><p>Set <var>c</var> to&nbsp; (<var>dt</var>&nbsp;&lt;&nbsp;<var>dttz</var>)&nbsp;.</p></item>
<item><p>Return<ulist>
<item><p><pt>true</pt>&emsp; when <var>b</var> and <var>c</var> are the same, and</p></item>
<item><p><pt>false</pt>&emsp; otherwise.</p></item>
</ulist></p></item>
</olist>
(Note that changing the property values of <var>dt</var> does not affect the properties of the object that
was supplied as the argument.)
</algorithm>
</pfdef>
</defset>

<pt>true</pt> is returned precisely when the two <dtref ref="dt-dt-7PropMod"/> values are separated by
at least 14 hours when the timezoned one&apos;s <pfref ref="vp-dt-timezone"/> is ignored.&nbsp; Then no matter what
<pfref ref="vp-dt-timezone"/> is forced on the one with an <pt>absent</pt> <pfref ref="vp-dt-timezone"/>, the
order will always be the same.&nbsp; If it <emph>can</emph> be different with different
<pfref ref="vp-dt-timezone"/> values, i.e., <pfref ref="f-dt-14HrDiff"/> returns <pt>false</pt>, then 
the two are incomparable.
-->
</p>
</div3>

<div3><head>Lexical Mappings</head>

<p><termdef id="dt-dt-frag" term="date/time fragment" role="local">Each lexical representation is made up 
of certain <term>date/time fragments</term>, each of which 
corresponds to a particular property of the datatype value.</termdef>&nbsp; They are defined by 
the following productions.

<defset><head>Date/time Lexical Representation Fragments</head>
<prod id="nt-yrFrag"><lhs>yearFrag</lhs>
<rhs><string>-</string>?&nbsp;((<charclass>1-9</charclass>&nbsp;<nt def="nt-digit"/>&nbsp;<nt def="nt-digit"/>&nbsp;<nt def="nt-digit"/>+))&nbsp;|&nbsp;(<string>0</string>&nbsp;<nt def="nt-digit"/>&nbsp;<nt def="nt-digit"/>&nbsp;<nt def="nt-digit"/>))</rhs></prod>
<prod id="nt-moFrag"><lhs>monthFrag</lhs>
<rhs>(<string>0</string>&nbsp;<charclass>1-9</charclass>)&nbsp;|&nbsp;(<string>1</string>&nbsp;<charclass>01</charclass>)</rhs></prod>
<prod id="nt-daFrag"><lhs>dayFrag</lhs>
<rhs>(<charclass>0-2</charclass>&nbsp;<nt def="nt-digit"/>)&nbsp;|&nbsp;(<string>3</string>&nbsp;<charclass>01</charclass>)</rhs></prod>
<prod id="nt-hrFrag"><lhs>hourFrag</lhs>
<rhs>(<charclass>01</charclass>&nbsp;<nt def="nt-digit"/>)&nbsp;|&nbsp;(<string>2</string>&nbsp;<charclass>0-4</charclass>)</rhs></prod>
<prod id="nt-miFrag"><lhs>minuteFrag</lhs>
<rhs><charclass>0-5</charclass>&nbsp;<nt def="nt-digit"/></rhs></prod>
<prod id="nt-seFrag"><lhs>secondFrag</lhs>
<rhs><charclass>0-6</charclass>&nbsp;<nt def="nt-digit"/>&nbsp;(<string>.</string>&nbsp;<nt def="nt-digit"/>+)?</rhs></prod>
<prod id="nt-tzFrag"><lhs>timezoneFrag</lhs><rhs><string>Z</string>&nbsp;|&nbsp;((<string>+</string>&nbsp;|&nbsp;<string>-</string>)&nbsp;(<string>0</string>&nbsp;<nt def="nt-digit"/>&nbsp;|&nbsp;<string>1</string>&nbsp;<charclass>0-4</charclass>)&nbsp;<string>:</string>&nbsp;<nt def="nt-miFrag"/>)</rhs></prod>
</defset>
</p>

<!-- (deal with constraints later) **********************************
<constraintnote id="con-dt-days" type="lexical"><head>Day-of-month Representations</head>
<p>An <nt def="nt-daFrag"/> is further limited if in a year/month context which does not permit 31 days,
as specified in the table of day
limits in <specref ref="dayYM"/>.<phrase role="UNSURE"> Perhaps this constraint should be
placed on the lexical representations of gMonthDay, date, and dateTime.</phrase>
</p></constraintnote>
<constraintnote id="con-dt-hours" type="lexical"><head>Midnight Representations</head>
<p>An <nt def="nt-hrFrag"/> may not be <string>24</string> in a context where <nt def="nt-miFrag"/> and
<nt def="nt-seFrag"/> are present and either or both map to a value other
than zero.<phrase role="UNSURE"> Perhaps this constraint should be placed on the lexical
representations of time and dateTime.</phrase></p></constraintnote>
<constraintnote id="con-dt-leapSec" type="lexical"><head>Leap-second Representations</head>
<p>An <nt def="nt-seFrag"/> may not begin with the digit <string>6</string> unless in the
context where the value
falls within a permitted leap second, as specified in the table of leap-seconds
in <specref ref="secMinDay"/>.<phrase role="UNSURE"> Perhaps this constraint should be placed on
the lexical representations of time and dateTime.</phrase>
</p></constraintnote>
************************************* -->

<p>
Each fragment other than <nt def="nt-tzFrag"/> defines a subset of the 
<termref def="dt-lexical-space"></termref> of <dtref ref="decimal"/>; 
the corresponding <termref def="dt-lexical-mapping"></termref> is the 
<dtref ref="decimal"/> <termref role="the" def="dt-lexical-mapping">lexical mapping</termref> 
restricted to that subset.&nbsp; These fragment <termref def="dt-lexical-mapping">lexical 
mappings</termref> are combined separately for each date/time datatype (other 
than <dtref ref="duration"/>) to make up <termref role="the" def="dt-lexical-mapping">the complete lexical
mapping</termref> for that datatype.&nbsp; The <pfref ref="f-dt-yrMap"/> mapping is 
used to obtain the value of the <pfref ref="vp-dt-year"/> property, 
the <pfref ref="f-dt-moMap"/> mapping is used to obtain the value of the 
<pfref ref="vp-dt-month"/> property, etc.  Each datatype which specifies some properties to be mandatorily
<pt>absent</pt> also does not permit the corresponding lexical fragments in its lexical representations.

<defsetsum ref="defs-func-on-dt-frags"/>

</p>

<p>(The redundancy between <string>Z</string>, <string>+00:00,</string> and <string>-00:00</string>,
and the possibility of trailing fractional <string>0</string> digits for <nt def="nt-seFrag"/>, are the only
redundancies preventing these mappings from being one-to-one.)</p>

<p>The following fragment <termref def="dt-canonical-mapping">canonical 
mappings</termref> for each value-object property are combined as appropriate to make the
<termref def="dt-canonical-mapping"></termref> for each date/time datatype (other
than <dtref ref="duration"/>):

<defsetsum ref="defs-func-to-dt-frags"/>

</p>

</div3>
</div2>
</div1>

<!-- ********************************** END NEW 1.1 MATERIAL (DATE/TIME) ************************************* -->

<!-- ********************************** START NEW 1.1 MATERIAL (FUNCTIONS) ************************************* -->

<div1 id="ap-funcDefs"><head diff="add">Function Definitions</head>

<p diff="add">The more important functions and procedures defined here are summarized in the
text&nbsp; When there is a text summary, the name of the function in each is a
<unusual>hot-link</unusual> to the same name in the other.&nbsp; All other links
to these functions link to the complete definition in this section.</p>

<div2 diff="add"><head>Generic Number-related Functions</head>

<p>The following functions are used with various numeric and date/time datatypes.

<defset role="aux"><head>Auxiliary Functions for Operating on Numeral Fragments</head>

<funcdef><name id="f-digitVal">digitValue</name>
&integer;<limits>a nonnegative &integer; less than ten</limits>
<args><arg><var>d</var><limits>matches <nt def="nt-digit"/></limits></arg></args>
<summary>Maps each digit to its numerical value.</summary>
<algorithm>Return
<ulist>
<item><p>0&emsp; when&nbsp; <var>d</var>&nbsp;=&nbsp;<string>0</string>&nbsp;,</p></item>
<item><p>1&emsp; when&nbsp; <var>d</var>&nbsp;=&nbsp;<string>1</string>&nbsp;,</p></item>
<item><p>2&emsp; when&nbsp; <var>d</var>&nbsp;=&nbsp;<string>2</string>&nbsp;,</p></item>
<item><p><emph>etc.</emph></p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-digitSeqVal">digitSequenceValue</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>S</var><limits>a finite sequence of
&string;s, each term matching <nt def="nt-digit"/>.</limits></arg></args>
<summary>Maps a sequence of digits to the position-weighted sum of the terms numerical values.</summary>
<algorithm>Return the sum of 
<pfref ref="f-digitVal"/>(<var>S</var><sub><var>i</var></sub>)&nbsp;&times;&nbsp;10<sup>length(<var>S</var>)&minus;<var>i</var></sup>&nbsp;
where <var>i</var> runs over the domain of <var>S</var>.
</algorithm>
</funcdef>

<funcdef><name id="f-fracDigitSeqVal">fractionDigitSequenceValue</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>S</var><limits>a finite sequence of
&string;s, each term matching <nt def="nt-digit"/>.</limits></arg></args>
<summary>Maps a sequence of digits to the position-weighted sum of the terms numerical values, weighted appropriately for fractional digits.</summary>
<algorithm>Return the sum of 
<pfref ref="f-digitVal"/>(<var>S</var><sub><var>i</var></sub>)&nbsp;&minus;&nbsp;10<sup>&minus;<var>i</var></sup>&nbsp;
where <var>i</var> runs over the domain of <var>S</var>.
</algorithm>
</funcdef>
 
<funcdef><name id="f-fracFragVal">fractionFragValue</name>
&decimal;<limits>a nonnegative &decimal;</limits>
<args><arg><var>N</var><limits>matches <nt def="nt-fracFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-fracFrag"/> to the appropriate fractional &decimal;.</summary>
<argsetup><var>N</var> is necessarily the left-to-right concatenation of a finite sequence <var>S</var> of
&string;s, each term matching <nt def="nt-digit"/>.</argsetup>
<algorithm>Return <pfref ref="f-fracDigitSeqVal"/>(<var>S</var>).</algorithm>
</funcdef>
 
</defset>

<defset id="defs-genNNLexMaps"><head>Generic Numeral-to-Number Lexical Mappings</head>

<funcdef><name id="f-unsNoDecVal">unsignedNoDecimalMap</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>N</var><limits>matches <nt def="nt-unsNoDecNuml"/></limits></arg></args>
<summary>Maps an <nt def="nt-unsNoDecNuml"/> to its numerical value.</summary>
<argsetup><var>N</var> is the left-to-right concatenation of a finite sequence <var>S</var> of
&string;s, each term matching <nt def="nt-digit"/>.</argsetup>
<algorithm>Return <pfref ref="f-digitSeqVal"/>(<var>S</var>).</algorithm>
</funcdef>

<funcdef><name id="f-noDecVal">noDecimalMap</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>N</var><limits>matches <nt def="nt-noDecNuml"/></limits></arg></args>
<summary>Maps an <nt def="nt-noDecNuml"/> to its numerical value.</summary>
<argsetup><var>N</var> necessarily consists of an optional sign(<string>+</string> or <string>-</string>) and then
a &string; <var>U</var> that matches <nt def="nt-unsNoDecNuml"/>.</argsetup>
<algorithm>Return
<ulist>
<item><p>&minus;<pfref ref="f-unsNoDecVal"/>(<var>U</var>)&emsp; when <string>-</string> is present, and</p></item>
<item><p><pfref ref="f-unsNoDecVal"/>(<var>U</var>)&emsp; otherwise.</p></item>
</ulist></algorithm>
</funcdef>

<funcdef><name id="f-unsDecVal">unsignedDecimalPtMap</name>
&decimal;<limits>a nonnegative &decimal;</limits>
<args><arg><var>D</var><limits>matches <nt def="nt-unsDecNuml"/></limits></arg></args>
<summary>Maps an <nt def="nt-unsDecNuml"/> to its numerical value.</summary>
<argsetup><var>D</var> necessarily consists of an optional &string; <var>N</var> matching <nt def="nt-unsNoDecNuml"/>, 
a decimal point, and then an optional &string; <var>F</var> matching <nt def="nt-fracFrag"/>.</argsetup>
<algorithm>Return
<ulist>
<item><p><pfref ref="f-unsNoDecVal"/>(<var>N</var>)&emsp; when <var>F</var> is not present,</p></item>
<item><p><pfref ref="f-fracFragVal"/>(<var>F</var>)&emsp; when <var>N</var> is not present, and</p></item>
<item><p><pfref ref="f-unsNoDecVal"/>(<var>N</var>)&nbsp;+&nbsp;<pfref ref="f-fracFragVal"/>(<var>F</var>)&emsp;
otherwise.</p></item>
</ulist></algorithm>
</funcdef>
 
<funcdef><name id="f-decVal">decimalPtMap</name>
&decimal;<limits>a &decimal;</limits>
<args><arg><var>N</var><limits>matches <nt def="nt-decNuml"/></limits></arg></args>
<summary>Maps a <nt def="nt-decNuml"/> to its numerical value.</summary>
<argsetup><var>N</var> necessarily consists of an optional sign(<string>+</string> or <string>-</string>) and then
an instance <var>U</var> of <nt def="nt-unsDecNuml"/>.</argsetup>
<algorithm>
Return
<ulist>
<item><p>&minus;<pfref ref="f-unsDecVal"/>(<var>U</var>)&emsp; when <string>-</string> is present, and</p></item>
<item><p><pfref ref="f-unsDecVal"/>(<var>U</var>)&emsp; otherwise.</p></item>
</ulist></algorithm>
</funcdef>

<funcdef><name id="f-sciVal">scientificMap</name>
&decimal;<limits></limits>
<args><arg><var>N</var><limits>matches <nt def="nt-sciNuml"/></limits></arg></args>
<summary>Maps a <nt def="nt-sciNuml"/> to its numerical value.</summary>
<argsetup><var>N</var> necessarily consists of an instance <var>C</var> of either <nt def="nt-noDecNuml"/> or
<nt def="nt-decNuml"/>, either an <string>e</string> or an <string>E</string>, and then an instance
<var>E</var> of <nt def="nt-noDecNuml"/>.</argsetup>
<algorithm>Return
<ulist>
<item><p>
<pfref ref="f-decVal"/>(<var>C</var>)&nbsp;&minus;&nbsp;10&nbsp;^&nbsp;<pfref ref="f-unsDecVal"/>(<var>E</var>)&emsp;
when a <string>.</string> is present in <var>N</var>, and</p></item>
<item><p>
<pfref ref="f-noDecVal"/>(<var>C</var>)&nbsp;&minus;&nbsp;10&nbsp;^&nbsp;<pfref ref="f-unsDecVal"/>(<var>E</var>)&emsp;
otherwise.</p></item>
</ulist></algorithm>
</funcdef>

</defset>

<defset role="aux"><head>Auxiliary Functions for Producing Numeral Fragments</head>

<funcdef><name id="f-digit">digit</name>
<nt def="nt-digit"/><limits>matches <nt def="nt-digit"/></limits>
<args><arg><var>i</var><limits>between 0 and 9 inclusive</limits></arg></args>
<summary>Maps each &integer; between 0 and 9 to the corresponding <nt def="nt-digit"/>.</summary>
<algorithm>Return<ulist>
<item><p><string>0</string>&emsp; when&nbsp; <var>i</var>&nbsp;=&nbsp;0&nbsp;,</p></item>
<item><p><string>1</string>&emsp; when&nbsp; <var>i</var>&nbsp;=&nbsp;1&nbsp;,</p></item>
<item><p><string>2</string>&emsp; when&nbsp; <var>i</var>&nbsp;=&nbsp;2&nbsp;,</p></item>
<item><p>etc.</p></item></ulist></algorithm>
</funcdef>

<funcdef><name id="f-digitRemSeq">digitRemainderSeq</name>
<phrase>sequence of &integer;s</phrase><limits>sequence of nonnegative &integer;s</limits>
<args><arg><var>i</var><limits>a nonnegative &integer;</limits></arg></args>
<summary>Maps each nonnegative &integer; to a sequence of &integer;s used by <pfref ref="f-digitSeq"/> to ultimately create an <nt def="nt-unsNoDecNuml"/>.</summary>
<algorithm>Return that sequence <var>s</var> for which
<ulist>
<item><p><var>s</var><sub>0</sub>&nbsp;=&nbsp;<var>i</var>&nbsp; and</p></item>
<item><p><var>s</var><sub><var>j</var>+1</sub>&nbsp;=&nbsp;<var>s</var><sub><var>j</var></sub>&nbsp;<termref def="dt-div"></termref>&nbsp;10&nbsp;.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-digitSeq">digitSeq</name>
<phrase>sequence of &integer;s</phrase><limits>sequence of &integer;s where each term is between 0 and 9 inclusive</limits>
<args><arg><var>i</var><limits>a nonnegative &integer;</limits></arg></args>
<summary>Maps each nonnegative &integer; to a sequence of &integer;s used by <pfref ref="f-unsNoDecCanFragMap"/> to create an <nt def="nt-unsNoDecNuml"/>.</summary>
<algorithm>Return that sequence <var>s</var> for which&nbsp;
<var>s</var><sub><var>j</var></sub>&nbsp;=<pfref ref="f-digitRemSeq"/>(<var>i</var>)<sub><var>j</var></sub>&nbsp;<termref def="dt-mod"></termref>&nbsp;10&nbsp;.
</algorithm>
</funcdef>

<funcdef><name id="f-lastSigDigit">lastSignificantDigit</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>s</var><limits>a sequence of nonnegative &integer;s</limits></arg></args>
<summary>Maps a sequence of nonnegative &integer;s to the index of the first zero term.</summary>
<algorithm>Return the smallest nonnegative &integer; <var>j</var> such that
<var>s</var>(<var>i</var>)<sub><var>j</var>+1</sub> is 0.
</algorithm>
</funcdef>

<funcdef><name id="f-fracDigitRemSeq">FractionDigitRemainderSeq</name>
<phrase>sequence of &decimal;s</phrase><limits>a sequence of nonnegative &decimal;s</limits>
<args><arg><var>f</var><limits>nonnegative and less than 1</limits></arg></args>
<summary>Maps each nonnegative &decimal; less than 1 to a sequence of &decimal;s used by <pfref ref="f-fracDigitSeq"/> to ultimately create an <nt def="nt-unsNoDecNuml"/>.</summary>
<algorithm>Return that sequence <var>s</var> for which
<ulist>
<item><p><var>s</var><sub>0</sub>&nbsp;=&nbsp;<var>f</var>&nbsp;&minus;&nbsp;10&nbsp;, and</p></item>
<item><p><var>s</var><sub><var>j</var>+1</sub>&nbsp;=&nbsp;(<var>s</var><sub><var>j</var></sub>&nbsp;<termref def="dt-mod"></termref>&nbsp;1)&nbsp;&minus;&nbsp;10&nbsp;.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-fracDigitSeq">fractionDigitSeq</name>
<phrase>sequence of &integer;s</phrase><limits>a sequence of integer;s where each term is between 0 and 9 inclusive</limits>
<args><arg><var>f</var><limits>nonnegative and less than 1</limits></arg></args>
<summary>Maps each nonnegative &decimal; less than 1 to a sequence of &integer;s used by <pfref ref="f-fracDigitsMap"/> to ultimately create an <nt def="nt-unsNoDecNuml"/>.</summary>
<argsetup></argsetup>
<algorithm>Return that sequence <var>s</var> for which&nbsp;
<var>s</var><sub><var>j</var></sub>&nbsp;=&nbsp;<pfref ref="f-fracDigitRemSeq"/>(<var>f</var>)<sub><var>j</var></sub>&nbsp;<termref def="dt-div"></termref>&nbsp;1&nbsp;.
</algorithm>
</funcdef>

<funcdef><name id="f-fracDigitsMap">fractionDigitsCanonicalFragmentMap</name>
<nt def="nt-fracFrag"/><limits>matches <nt def="nt-fracFrag"/></limits>
<args><arg><var>f</var><limits>nonnegative and less than 1</limits></arg></args>
<summary>Maps each nonnegative &decimal; less than 1 to a &string; used by <pfref ref="f-unsDecCanFragMap"/> to create an <nt def="nt-unsDecNuml"/>.</summary>
<algorithm>Return&nbsp;
<pfref ref="f-digit"/>(<pfref ref="f-fracDigitSeq"/>(<var>f</var>)<sub>0</sub>)&nbsp;&concat; .&nbsp;.&nbsp;. &concat;
<pfref ref="f-digit"/>(<pfref ref="f-fracDigitSeq"/>(<var>f</var>)<sub><pfref ref="f-lastSigDigit"/>(<pfref ref="f-fracDigitRemSeq"/>(<var>f</var>))</sub>)&nbsp;.</algorithm>
</funcdef>

</defset>

<defset id="defs-genNNCanMaps"><head>Generic Number to Numeral Canonical Mappings</head>

<funcdef><name id="f-unsNoDecCanFragMap">unsignedNoDecimalPtCanonicalMap</name>
<nt def="nt-unsNoDecNuml"/><limits>matches <nt def="nt-unsNoDecNuml"/></limits>
<args><arg><var>i</var><limits>a nonnegative &integer;</limits></arg></args>
<summary>Maps a nonnegative &integer; to a <nt def="nt-unsNoDecNuml"/>, its <termref def="dt-canonical-representation"/>.</summary>
<algorithm>Return
<pfref ref="f-digit"/>(<pfref ref="f-digitSeq"/>(<var>i</var>)<sub><pfref ref="f-lastSigDigit"/>(<pfref ref="f-digitRemSeq"/>(<var>i</var>))</sub>)&nbsp;&concat;
.&nbsp;.&nbsp;.&nbsp;&concat;
<pfref ref="f-digit"/>(<pfref ref="f-digitSeq"/>(<var>i</var>)<sub>0</sub>)&nbsp;.&emsp; (Note
that the concatenation is in reverse order.)</algorithm>
</funcdef>

<funcdef><name id="f-noDecCanMap">noDecimalPtCanonicalMap</name>
<nt def="nt-noDecNuml"/><limits>matches <nt def="nt-noDecNuml"/></limits>
<args><arg><var>i</var><limits>an &integer;</limits></arg></args>
<summary>Maps an &integer; to a <nt def="nt-noDecNuml"/>, its <termref def="dt-canonical-representation"/>.</summary>
<argsetup></argsetup>
<algorithm>Return
<ulist>
<item><p><string>-</string>&nbsp;&concat;&nbsp;<pfref ref="f-unsNoDecCanFragMap"/>(&minus;<var>i</var>)&emsp;
when <var>i</var> is negative,</p></item>
<item><p><pfref ref="f-unsNoDecCanFragMap"/>(<var>i</var>)&emsp; otherwise.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-unsDecCanFragMap">unsignedDecimalPtCanonicalMap</name>
<nt def="nt-unsDecNuml"/><limits>matches <nt def="nt-unsDecNuml"/></limits>
<args><arg><var>n</var><limits>a nonnegative &decimal;</limits></arg></args>
<summary>Maps a nonnegative &decimal; to a <nt def="nt-unsDecNuml"/>, its <termref def="dt-canonical-representation"/>.</summary>
<argsetup></argsetup>
<algorithm>Return&nbsp; <pfref ref="f-unsNoDecCanFragMap"/>(<var>n</var><termref def="dt-div"></termref>1)&nbsp;&concat;
<string>.</string>&nbsp;&concat; <pfref ref="f-fracDigitsMap"/>(<var>n</var><termref def="dt-mod"></termref>1)&nbsp;.</algorithm>
</funcdef>

<funcdef><name id="f-decCanFragMap">decimalPtCanonicalMap</name>
<nt def="nt-decNuml"/><limits>matches <nt def="nt-decNuml"/></limits>
<args><arg><var>n</var><limits>a &decimal;</limits></arg></args>
<summary>Maps a &decimal; to a <nt def="nt-decNuml"/>, its <termref def="dt-canonical-representation"/>.</summary>
<algorithm>Return
<ulist>
<item><p><string>-</string>&nbsp;&concat;&nbsp;<pfref ref="f-unsDecCanFragMap"/>(&minus;<var>i</var>)&emsp;
when <var>i</var> is negative,</p></item>
<item><p><pfref ref="f-unsDecCanFragMap"/>(<var>i</var>)&emsp; otherwise.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-unsSciCanFragMap">unsignedScientificCanonicalMap</name>
<nt def="nt-unsSciNuml"/><limits>matches <nt def="nt-unsSciNuml"/></limits>
<args><arg><var>n</var><limits>a nonnegative &decimal;</limits></arg></args>
<summary>Maps a nonnegative &decimal; to a <nt def="nt-unsSciNuml"/>, its <termref def="dt-canonical-representation"/>.</summary>
<algorithm>
Return&nbsp; <pfref ref="f-unsDecCanFragMap"/>(<var>n</var>&nbsp;/&nbsp;10<sup>log(<var>n</var>)&nbsp;<termref def="dt-div"></termref>&nbsp;1</sup>)&nbsp;&concat;
<string>E</string>&nbsp;&concat;
<pfref ref="f-noDecCanMap"/>(log(<var>n</var>)&nbsp;<termref def="dt-div"></termref>&nbsp;1)
</algorithm>
</funcdef>

<funcdef><name id="f-sciCanFragMap">scientificCanonicalMap</name>
<nt def="nt-sciNuml"/><limits>matches <nt def="nt-sciNuml"/></limits>
<args><arg><var>n</var><limits>a &decimal;</limits></arg></args>
<summary>Maps a &decimal; to a <nt def="nt-sciNuml"/>, its <termref def="dt-canonical-representation"/>.</summary>
<algorithm>Return
<ulist>
<item><p><string>-</string>&nbsp;&concat;&nbsp;<pfref ref="f-unsSciCanFragMap"/>(&minus;<var>n</var>)&emsp;
when <var>n</var> is negative,</p></item>
<item><p><pfref ref="f-unsSciCanFragMap"/>(<var>i</var>)&emsp; otherwise.</p></item>
</ulist>
</algorithm>
</funcdef>
</defset>

</p><p>For example:
</p>
<ulist><item><p>123.4567&nbsp;<termref def="dt-mod"></termref>&nbsp;1&nbsp;=&nbsp;0.4567&nbsp; and&nbsp; 123.4567&nbsp;<termref def="dt-div"></termref>&nbsp;1&nbsp;=&nbsp;123&nbsp;.</p></item>
<item><p><pfref ref="f-digitRemSeq"/>(123)&nbsp; is&nbsp; 123&nbsp;,&nbsp;12&nbsp;,&nbsp;1&nbsp;,&nbsp;0&nbsp;,&nbsp;0&nbsp;,&nbsp;.&nbsp;.&nbsp;.&nbsp;.</p></item>
<item><p><pfref ref="f-digitSeq"/>(123)&nbsp; is&nbsp; 3&nbsp;,&nbsp;2&nbsp;,&nbsp;1&nbsp;,&nbsp;0&nbsp;,&nbsp;0&nbsp;,&nbsp;.&nbsp;.&nbsp;.&nbsp;.</p></item>
<item><p><pfref ref="f-lastSigDigit"/>(<pfref ref="f-digitRemSeq"/>(123))&nbsp;=&nbsp;2&emsp; (Sequences count from 0.)</p></item>
<item><p><pfref ref="f-unsNoDecCanFragMap"/>(123)&nbsp;=&nbsp;<string>123</string></p></item>
<item><p><pfref ref="f-fracDigitRemSeq"/>(0.4567)&nbsp; is&nbsp; 4.567&nbsp;,&nbsp;5.67&nbsp;,&nbsp;6.7&nbsp;,&nbsp;7&nbsp;,&nbsp;0&nbsp;,&nbsp;0&nbsp;,&nbsp;.&nbsp;.&nbsp;.&nbsp;.</p></item>
<item><p><pfref ref="f-fracDigitSeq"/>(0.4567)&nbsp; is&nbsp; 4&nbsp;,&nbsp;5&nbsp;,&nbsp;6&nbsp;,&nbsp;7&nbsp;,&nbsp;0&nbsp;,&nbsp;0&nbsp;,&nbsp;.&nbsp;.&nbsp;.&nbsp;.</p></item>
<item><p><pfref ref="f-lastSigDigit"/>(<pfref ref="f-fracDigitRemSeq"/>(0.4567))&nbsp;=&nbsp;3</p></item>
<item><p><pfref ref="f-fracDigitsMap"/>(0.4567)&nbsp;=&nbsp;<string>4567</string></p></item>
<item><p><pfref ref="f-unsDecCanFragMap"/>(123.4567)&nbsp;=&nbsp;<string>123.4567</string></p></item></ulist>

<defset id="defs-NumericSpecialLexmap"><head>Lexical Mapping for Non-numerical <dtref ref="constant"/>s Used With Numerical Datatypes</head>
<funcdef><name id="f-specRepVal">specialRepValue</name>
<dtref ref="constant"/><limits>one of <pt>positiveInfinity</pt>, <pt>negativeInfinity</pt>, or <pt>notANumber</pt>.</limits>
<args><arg><var>S</var><limits>matches <nt def="nt-numSpecReps"/></limits>
</arg></args>
<summary>Maps the <termref def="dt-lexical-representation">lexical representations</termref> of <dtref ref="constant"/>s used with some numerical datatypes to those <dtref ref="constant"/>s.</summary>
<algorithm>Return
<ulist>
<item><p><pt>positiveInfinity</pt>&emsp; when <var>S</var> is <string>INF</string> or <string>+INF</string>,</p></item>
<item><p><pt>negativeInfinity</pt>&emsp; when <var>S</var> is <string>-INF</string>, and</p></item>
<item><p><pt>notANumber</pt>&emsp; when <var>S</var> is <string>NaN</string></p></item>
</ulist>
</algorithm>
</funcdef>
</defset>

<defset id="defs-NumericSpecialCanmap"><head>Canonical Mapping for Non-numerical <dtref ref="constant"/>s Used With Numerical Datatypes</head>
<funcdef><name id="f-specValCanMap">specialRepCanonicalMap</name>
<nt def="nt-numSpecReps"/><limits>matches <nt def="nt-numSpecReps"/></limits>
<args><arg><var>c</var><limits>one of <pt>positiveInfinity</pt>,
<pt>negativeInfinity</pt>, and <pt>notANumber</pt></limits></arg></args>
<summary>Maps the <dtref ref="constant"/>s used with some numerical datatypes to their <termref def="dt-canonical-representation">canonical representations</termref>.</summary>
<algorithm>Return
<ulist>
<item><p><string>INF</string>&emsp; when <var>c</var> is <pt>positiveInfinity</pt></p></item>
<item><p><string>-INF</string>&emsp; when <var>c</var> is <pt>negativeInfinity</pt></p></item>
<item><p><string>NaN</string>&emsp; when <var>c</var> is <pt>notANumber</pt></p></item>
</ulist>
</algorithm>
</funcdef>
</defset>

<defset role="func"><head alt="Auxilliary Functions for Reading Instances of precisionDecimalRep">Auxilliary
Functions for Reading Instances of <nt def="nt-precDecRep"/></head>

<funcdef><name id="vp-decPrecision">decimalPtPrecision</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>LEX</var><limits>matches <nt def="nt-decNuml"/></limits></arg></args>
<summary>Maps a <nt def="nt-decNuml"/> onto an &integer; presumably intended as the <pfref ref="vp-pd-precision"/> of
a <dtref ref="precisionDecimal"/> value.</summary>
<argsetup><var>LEX</var> necessarily contains a decimal point (<string>.</string>) and may
optionally contain a following <nt def="nt-fracFrag"/> <var>F</var> consisting of some number
<var>n</var> of <nt def="nt-digit"/>s.</argsetup>
<algorithm>Return<ulist>
<item><p><var>n</var>&emsp; when <var>F</var> is present, and</p></item>
<item><p>0&emsp; otherwise.</p></item>
</ulist></algorithm></funcdef>

<funcdef><name id="vp-sciPrecision">scientificPrecision</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>LEX</var><limits>matches <nt def="nt-sciNuml"/></limits></arg></args>
<summary>Maps a <nt def="nt-sciNuml"/> onto an &integer; presumably intended as the <pfref ref="vp-pd-precision"/> of
a <dtref ref="precisionDecimal"/> value.</summary>
<argsetup><var>LEX</var> necessarily contains a <nt def="nt-noDecNuml"/> or <nt def="nt-decNuml"/>
<var>C</var> preceeding an exponent indicator (<string>E</string> or <string>e</string>,
and a following <nt def="nt-noDecNuml"/> <var>E</var>.</argsetup>
<algorithm>Return<ulist>
<item><p>&minus;<pfref ref="f-noDecVal"/>(<var>E</var>)&emsp; when <var>C</var> 
is a <nt def="nt-noDecNuml"/>, and</p></item>
<item><p><pfref ref="vp-decPrecision"/>(<var>C</var>)&nbsp;&minus;&nbsp;<pfref ref="f-noDecVal"/>(<var>E</var>)&emsp;
otherwise.</p></item></ulist>
</algorithm></funcdef>
</defset>

<defset id="defs-precDecLexmap"><head>Lexical Mapping</head>
<funcdef><name id="f-precDecLexmap">precisionDecimalLexicalMap</name>
<dtref ref="precisionDecimal"/><limits>a <dtref ref="precisionDecimal"/> value</limits>
<args><arg><var>LEX</var><limits>matches <nt def="nt-precDecRep"/></limits></arg></args>
<summary>Maps a <nt def="nt-precDecRep"/> onto a complete <dtref ref="precisionDecimal"/> value.</summary>
<varsetup><var>pD</var> be a complete <dtref ref="precisionDecimal"/> value.</varsetup>
<algorithm>
<olist>
<item><p>Set <var>pD</var>&apos;s <pfref ref="vp-pd-numVal"/> to 
<ulist>
<item><p><pfref ref="f-noDecVal"/>(<var>LEX</var>)&emsp; when
<var>LEX</var> is an instance of <nt def="nt-noDecNuml"/>,</p></item>
<item><p><pfref ref="f-decVal"/>(<var>LEX</var>)&emsp; when
<var>LEX</var> is an instance of <nt def="nt-decNuml"/>,</p></item>
<item><p><pfref ref="f-sciVal"/>(<var>LEX</var>)&emsp; when
<var>LEX</var> is an instance of <nt def="nt-sciNuml"/> and</p></item>
<item><p><pfref ref="f-specRepVal"/>(<var>LEX</var>)&emsp; otherwise.</p></item>
</ulist>
</p></item>
<item><p>set <var>pD</var>&apos;s <pfref ref="vp-pd-precision"/> to<ulist>
 <item><p>0&emsp; when <var>LEX</var> is a <nt def="nt-noDecNuml"/>,</p></item>
 <item><p><pfref ref="vp-decPrecision"/>(<var>LEX</var>)&emsp; when <var>LEX</var>
 is a  <nt def="nt-decNuml"/>,</p></item>
 <item><p><pfref ref="vp-sciPrecision"/>(<var>LEX</var>)&emsp; when <var>LEX</var>
 is a <nt def="nt-sciNuml"/>, and</p></item>
 <item><p><pt>absent</pt>&emsp; otherwise</p></item>
</ulist></p>
</item>
<item><p>Set <var>pD</var>&apos;s <pfref ref="vp-pd-sign"/> to<ulist>
<item><p><pt>absent</pt>&emsp; when <var>LEX</var> is <string>NaN</string></p></item>
<item><p><pt>negative</pt>&emsp; when
the first character of <var>LEX</var> is <string>-</string>, and</p></item>
<item><p><pt>positive</pt>&emsp; otherwise.</p></item></ulist></p>
</item> 
</olist>
</algorithm></funcdef>
</defset>
<ednote><edtext>The algorithm for <pfref ref="f-precDecCanmap"/> has not yet been written.</edtext></ednote>

<defset id="defs-precDecCanmap"><head>Canonical Mapping</head>
<funcdef><name id="f-precDecCanmap">precisionDecimalCanonicalMap</name>
<nt def="nt-precDecRep"/><limits>a &string; matching <nt def="nt-precDecRep"/></limits>
<args><arg><var>pD</var><limits>a <dtref ref="precisionDecimal"/> value</limits></arg></args>
<summary>Maps a <dtref ref="precisionDecimal"/> to its <termref def="dt-canonical-representation"></termref>, a <nt def="nt-precDecRep"/>.</summary>
<algorithm><phrase role="UNSURE">(TBD)</phrase></algorithm>
</funcdef>
</defset>

</div2>

<div2><head alt="duration-related Definitions" diff="add"><dtref ref="duration"/>-related Definitions</head>

<p><phrase diff="add">The following functions are primarily used with the <dtref ref="duration"/> datatype
and its derivatives.</phrase>

<defset role="aux"><head>Auxiliary <dtref ref="duration"/>-related Functions
Operating on Representation Fragments</head>

<funcdef><name id="f-duYrMap">duYearFragmentMap</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>Y</var><limits>matches <nt def="nt-duYrFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-duYrFrag"/> to an &integer;, intended as part of the value of the <pfref ref="vp-du-month"/> property of a <dtref ref="duration"/> value.</summary>
<argsetup><var>Y</var> is necessarily the letter <string>Y</string> followed by a numeral <var>N</var>:</argsetup>
<algorithm>Return <pfref ref="f-noDecVal"/>(<var>N</var>).</algorithm>
</funcdef>

<funcdef><name id="f-duMoMap">duMonthFragmentMap</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>M</var><limits>matches <nt def="nt-duYrFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-duMoFrag"/> to an &integer;, intended as part of the value of the <pfref ref="vp-du-month"/> property of a <dtref ref="duration"/> value.</summary>
<argsetup><var>M</var> is necessarily the letter <string>M</string> followed by a numeral <var>N</var>:</argsetup>
<algorithm>Return <pfref ref="f-noDecVal"/>(<var>N</var>).</algorithm>
</funcdef>

<funcdef><name id="f-duDaMap">duDayFragmentMap</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>D</var><limits>matches <nt def="nt-duDaFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-duDaFrag"/> to an &integer;, intended as part of the value of the <pfref ref="vp-du-second"/> property of a <dtref ref="duration"/> value.</summary>
<argsetup><var>D</var> is necessarily the letter <string>D</string> followed by a numeral <var>N</var>:</argsetup>
<algorithm>Return <pfref ref="f-noDecVal"/>(<var>N</var>).</algorithm>
</funcdef>

<funcdef><name id="f-duHrMap">duHourFragmentMap</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>H</var><limits>matches <nt def="nt-duHrFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-duHrFrag"/> to an &integer;, intended as part of the value of the <pfref ref="vp-du-second"/> property of a <dtref ref="duration"/> value.</summary>
<argsetup><var>D</var> is necessarily the letter <string>D</string> followed by a numeral <var>N</var>:</argsetup>
<algorithm>Return <pfref ref="f-noDecVal"/>(<var>N</var>).</algorithm>
</funcdef>

<funcdef><name id="f-duMiMap">duMinuteFragmentMap</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>M</var><limits>matches <nt def="nt-duMiFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-duMiFrag"/> to an &integer;, intended as part of the value of the <pfref ref="vp-du-second"/> property of a <dtref ref="duration"/> value.</summary>
<argsetup><var>M</var> is necessarily the letter <string>M</string> followed by a numeral <var>N</var>:</argsetup>
<algorithm>Return <pfref ref="f-noDecVal"/>(<var>N</var>).</algorithm>
</funcdef>

<funcdef><name id="f-duSeMap">duSecondFragmentMap</name>
&decimal;<limits>a nonnegative &decimal;</limits>
<args><arg><var>S</var><limits>matches <nt def="nt-duSeFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-duSeFrag"/> to a &decimal;, intended as part of the value of the <pfref ref="vp-du-second"/> property of a <dtref ref="duration"/> value.</summary>
<argsetup><var>S</var> is necessarily <string>S</string> followed by a numeral <var>N</var>:</argsetup>
<algorithm>Return
<ulist><item><p><pfref ref="f-decVal"/>(<var>N</var>)&emsp; when <string>.</string> occurs
in <var>N</var>, and</p></item>
<item><p><pfref ref="f-noDecVal"/>(<var>N</var>)&emsp; otherwise.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-duYMMap">duYearMonthFragmentMap</name>
&integer;<limits>a nonnegative &integer;</limits>
<args><arg><var>YM</var><limits>matches <nt def="nt-duYMFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-duYMFrag"/> into an &integer;, intended as part of the <pfref ref="vp-du-month"/> property of a <dtref ref="duration"/> value.</summary>
<argsetup><var>YM</var> necessarily consists of an 
instance <var>Y</var> of <nt def="nt-duYrFrag"/> and/or an instance <var>M</var> of
<nt def="nt-duMoFrag"/>:</argsetup>
<varsetup>
<ulist>
<item><p><var>y</var> be <pfref ref="f-duYrMap"/>(<var>Y</var>) (or 0 if <var>Y</var> is not present) and</p></item> 
<item><p><var>m</var> be <pfref ref="f-duMoMap"/>(<var>M</var>) (or 0 if <var>M</var> is not present).</p></item> 
</ulist>
</varsetup>
<algorithm>Return&nbsp; 12&nbsp;&times;&nbsp;<var>y</var>&nbsp;+ <var>m</var>&nbsp;.</algorithm>
</funcdef>

<funcdef><name id="f-duTMap">duTimeFragmentMap</name>
&decimal;<limits>a nonnegative &decimal;</limits>
<args><arg><var>T</var><limits>matches <nt def="nt-duTFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-duTFrag"/> into a &decimal;, intended as part of the <pfref ref="vp-du-second"/> property of a <dtref ref="duration"/> value.</summary>
<argsetup><var>T</var> necessarily consists of an instance 
<var>H</var> of <nt def="nt-duHrFrag"/>, and/or an instance <var>M</var> of
<nt def="nt-duMiFrag"/>, and/or an instance <var>S</var> of
<nt def="nt-duSeFrag"/>.</argsetup>
<varsetup> 
<ulist>
<item><p><var>h</var> be <pfref ref="f-duDaMap"/>(<var>H</var>) 
(or 0 if <var>H</var> is not present),</p></item> 
<item><p><var>m</var> be <pfref ref="f-duMiMap"/>(<var>M</var>) 
(or 0 if <var>M</var> is not present), and</p></item> 
<item><p><var>s</var> be <pfref ref="f-duSeMap"/>(<var>S</var>) 
(or 0 if <var>S</var> is not present).</p></item> 
</ulist>
</varsetup>
<algorithm>Return&nbsp; 
3600&nbsp;&times;&nbsp;<var>h</var>&nbsp;+&nbsp;60&nbsp;&times;&nbsp;<var>m</var>&nbsp;+&nbsp;s&nbsp;.</algorithm>
</funcdef>

<funcdef><name id="f-duDTMap">duDayTimeFragmentMap</name>
&decimal;<limits>a nonnegative &decimal;</limits>
<args><arg><var>DT</var><limits>matches <nt def="nt-duDTFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-duDTFrag"/> into a &decimal;, which is the potential value of the <pfref ref="vp-du-second"/> property of a <dtref ref="duration"/> value.</summary>
<argsetup><var>DT</var> necesarily consists of an instance 
<var>D</var> of <nt def="nt-duDaFrag"/> and/or an instance <var>T</var> of
<nt def="nt-duTFrag"/>.</argsetup>
<varsetup> 
<ulist>
<item><p><var>d</var> be <pfref ref="f-duDaMap"/>(<var>D</var>) 
(or 0 if <var>D</var> is not present) and</p></item> 
<item><p><var>t</var> be <pfref ref="f-duTMap"/>(<var>T</var>) 
(or 0 if <var>T</var> is not present).</p></item> 
</ulist>
</varsetup>
<algorithm>Return&nbsp; 86400&nbsp;&times;&nbsp;<var>d</var>&nbsp;+&nbsp;<var>t</var>&nbsp;.</algorithm>
</funcdef>
</defset>

<defset id="defs-durationLexmap">
<head alt="The duration Lexical Mapping">The <dtref ref="duration"/> Lexical Mapping</head>
<funcdef><name id="f-durationMap">durationMap</name>
<dtref ref="duration"/><limits>a complete <dtref ref="duration"/> value</limits>
<args><arg><var>DUR</var><limits>matches <nt def="nt-durationRep"/></limits>
</arg></args>
<summary>Separates the <nt def="nt-durationRep"/> into the month part and the seconds part, 
then maps them into the <pfref ref="vp-du-month"/> and <pfref ref="vp-du-second"/> of the 
<dtref ref="duration"/> value.</summary>
<argsetup><var>DUR</var> consists of possibly a 
leading <string>-</string>, followed by 
<string>P</string> and then an instance <var>Y</var> of <nt def="nt-duYMFrag"/> 
and/or an instance <var>D</var> of 
<nt def="nt-duDTFrag"/>:</argsetup>
<algorithm>Return a <dtref ref="duration"/> whose
<ulist>
<item><p><pfref ref="vp-du-month"/> value is
<ulist>
<item><p>0&emsp; if <var>Y</var> is not present,</p></item>
<item><p>&minus;<pfref ref="f-duYMMap"/>(<var>Y</var>)&emsp; if 
both <string>-</string> and <var>Y</var> are present, and</p></item>
<item><p><pfref ref="f-duYMMap"/>(<var>Y</var>)&emsp; otherwise.</p></item>
</ulist></p></item></ulist> 
and whose
<ulist>
<item><p><pfref ref="vp-du-second"/> value is
<ulist>
<item><p>0&emsp; if <var>D</var> is not present,</p></item>
<item><p>&minus;<pfref ref="f-duDTMap"/>(<var>D</var>)&emsp; if 
both <string>-</string> and <var>D</var> are present, and</p></item>
<item><p><pfref ref="f-duDTMap"/>(<var>D</var>)&emsp; otherwise.</p></item>
</ulist></p></item></ulist> 
</algorithm>
</funcdef>
</defset>

<defset id="defs-yearMonthDurationLexmap"><head>The <dtref ref="yearMonthDuration"/> Lexical Mapping</head>

<funcdef><name id="f-yearMonthDurationMap">yearMonthDurationMap</name>
<dtref ref="yearMonthDuration"/><limits>a complete <dtref ref="yearMonthDuration"/> value</limits>
<args><arg><var>YM</var><limits>matches <nt def="nt-yearMonthDurationRep"/></limits></arg></args>
<summary>Maps the lexical representation into the <pfref ref="vp-du-month"/> of a
<dtref ref="yearMonthDuration"/> value.&nbsp; (A
<dtref ref="yearMonthDuration"/>&apos;s <pfref ref="vp-du-second"/> is always
zero.)&nbsp; <pfref ref="f-yearMonthDurationMap"/> is a restriction of <pfref ref="f-durationMap"/>.</summary>
<argsetup><var>YM</var> necessarily consists of
an optional leading <string>-</string>, followed by
<string>P</string> and then an instance <var>Y</var> of
<nt def="nt-duYMFrag"/>:</argsetup>
<algorithm>Return a <dtref ref="yearMonthDuration"/> whose
<ulist>
<item><p><vpropref ref="vp-du-month"/> value is
 <ulist>
 <item><p>&minus;<pfref ref="f-duYMMap"/>(<var>Y</var>)&emsp; if <string>-</string> is
present in <var>YM</var> and</p></item>
 <item><p><pfref ref="f-duYMMap"/>(<var>Y</var>)&emsp; otherwise, and</p></item>
</ulist>
</p></item>
<item><p><vpropref ref="vp-du-second"/> value is (necessarily) 0.</p></item>
</ulist>
</algorithm>
</funcdef>
</defset>

<defset id="defs-dayTimeDurationLexmap"><head>The <dtref ref="dayTimeDuration"/> Lexical Mapping</head>

<funcdef><name id="f-dayTimeDurationMap">dayTimeDurationMap</name>
<dtref ref="dayTimeDuration"/><limits>a complete <dtref ref="dayTimeDuration"/> value</limits>
<args><arg><var>DT</var><limits>a <dtref ref="dayTimeDuration"/> value</limits></arg></args>
<summary>Maps the lexical representation into the <pfref ref="vp-du-second"/> of a
<dtref ref="dayTimeDuration"/> value.&nbsp; (A
<dtref ref="dayTimeDuration"/>&apos;s <pfref ref="vp-du-month"/> is always
zero.)&nbsp; <pfref ref="f-dayTimeDurationMap"/> is a restriction of <pfref ref="f-durationMap"/>.</summary>
<argsetup><var>DT</var> necessarily
consists of possibly a leading <string>-</string>, followed by
<string>P</string> and then an instance <var>D</var> of
<nt def="nt-duDTFrag"/>:</argsetup>
<algorithm>Return a <dtref ref="dayTimeDuration"/> whose
<ulist>
<item><p><vpropref ref="vp-du-month"/> value is (necessarily) 0, and</p>
</item>
<item><p><vpropref ref="vp-du-second"/> value is
 <ulist>
 <item><p>&minus;<pfref ref="f-duDTMap"/>(<var>D</var>)&emsp; if <string>-</string> is
present in <var>DT</var> and</p></item>
 <item><p><pfref ref="f-duDTMap"/>(<var>D</var>)&emsp; otherwise.</p>
 </item>
 </ulist></p>
</item>
</ulist>
</algorithm>
</funcdef>

</defset>

<defset role="aux"><head>Auxiliary <dtref ref="duration"/>-related Functions
Producing Representation Fragments</head>

<funcdef><name id="f-duYMCan">duYearMonthCanonicalFragmentMap</name>
<nt def="nt-duYMFrag"/><limits>a &string; matching <nt def="nt-duYMFrag"/></limits>
<args><arg><var>ym</var><limits>a nonnegative &integer;</limits></arg></args>
<summary>Maps a nonnegative &integer;, presumably the absolute value of the <pfref ref="vp-du-month"/> of a <dtref ref="duration"/> value, to a <nt def="nt-duYMFrag"/>, a fragment of a <dtref ref="duration"/> <termref def="dt-lexical-representation"></termref>.</summary>
<varsetup>
<ulist><item><p><var>y</var> be&nbsp; <var>ym</var>&nbsp;<termref def="dt-div"></termref>&nbsp;12&nbsp;, and</p></item>
<item><p><var>m</var> be&nbsp; <var>ym</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;12&nbsp;,</p></item>
</ulist>
</varsetup>
<algorithm>Return
<ulist><item><p><pfref ref="f-unsNoDecCanFragMap"/>(<var>y</var>)&nbsp;&concat; <string>Y</string>&nbsp;&concat; <pfref ref="f-unsNoDecCanFragMap"/>(<var>m</var>)&nbsp;&concat; <string>M</string>&emsp;
when neither <var>y</var> nor <var>m</var> is zero,</p></item>
<item><p><pfref ref="f-unsNoDecCanFragMap"/>(<var>y</var>)&nbsp;&concat; <string>Y</string>&emsp;
when <var>y</var> is not zero but <var>m</var> is, and</p></item>
<item><p>&nbsp;<pfref ref="f-unsNoDecCanFragMap"/>(<var>m</var>)&nbsp;&concat; <string>M</string>&emsp;
when <var>y</var> is zero.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-duDCan">duDayCanonicalFragmentMap</name>
<nt def="nt-duDaFrag"/><limits>a &string; matching <nt def="nt-duDaFrag"/></limits>
<args><arg><var>d</var><limits>a nonnegative &integer;</limits></arg></args>
<summary>Maps a nonnegative &integer;, presumably the day normalized value from the <pfref ref="vp-du-second"/> of a <dtref ref="duration"/> value, to a <nt def="nt-duDaFrag"/>, a fragment of a <dtref ref="duration"/> <termref def="dt-lexical-representation"></termref>.</summary>
<algorithm>Return
<ulist><item><p><pfref ref="f-unsNoDecCanFragMap"/>(<var>d</var>)&nbsp;&concat; <string>D</string>&emsp;
when <var>d</var> is not zero, and</p></item>
<item><p>the empty string (<string></string>)&emsp; when <var>d</var> is zero.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-duHCan">duHourCanonicalFragmentMap</name>
<nt def="nt-duHrFrag"/><limits>a &string; matching <nt def="nt-duHrFrag"/></limits>
<args><arg><var>h</var><limits>a nonnegative &integer;</limits></arg></args>
<summary>Maps a nonnegative &integer;, presumably the hour normalized value from the <pfref ref="vp-du-second"/> of a <dtref ref="duration"/> value, to a <nt def="nt-duHrFrag"/>, a fragment of a <dtref ref="duration"/> <termref def="dt-lexical-representation"></termref>.</summary>
<algorithm>Return
<ulist><item><p><pfref ref="f-unsNoDecCanFragMap"/>(<var>h</var>)&nbsp;&concat; <string>H</string>&emsp;
when <var>h</var> is not zero, and</p></item>
<item><p>the empty string (<string></string>)&emsp; when <var>h</var> is zero.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-duMCan">duMinuteCanonicalFragmentMap</name>
<nt def="nt-duMiFrag"/><limits>a &string; matching <nt def="nt-duMiFrag"/></limits>
<args><arg><var>m</var><limits>a nonnegative &integer;</limits></arg></args>
<summary>Maps a nonnegative &integer;, presumably the minute normalized value from the <pfref ref="vp-du-second"/> of a <dtref ref="duration"/> value, to a <nt def="nt-duMiFrag"/>, a fragment of a <dtref ref="duration"/> <termref def="dt-lexical-representation"></termref>.</summary>
<algorithm>Return
<ulist><item><p><pfref ref="f-unsNoDecCanFragMap"/>(<var>m</var>)&nbsp;&concat; <string>M</string>&emsp; 
when <var>m</var> is not zero, and</p></item>
<item><p>the empty string (<string></string>)&emsp; when <var>m</var> is zero.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-duSCan">duSecondCanonicalFragmentMap</name>
<nt def="nt-duSeFrag"/><limits>matches <nt def="nt-duSeFrag"/></limits>
<args><arg><var>s</var><limits>a nonnegative &decimal;</limits></arg></args>
<summary>Maps a nonnegative &decimal;, presumably the second normalized value from the <pfref ref="vp-du-second"/> of a <dtref ref="duration"/> value, to a <nt def="nt-duSeFrag"/>, a fragment of a <dtref ref="duration"/> <termref def="dt-lexical-representation"></termref>.</summary><algorithm>Return
<ulist><item><p><pfref ref="f-unsNoDecCanFragMap"/>(<var>s</var>)&nbsp;&concat; <string>S</string>&nbsp; 
when <var>s</var> is a non-zero integer,</p></item>
<item><p><pfref ref="f-unsDecCanFragMap"/>(<var>s</var>)&nbsp;&concat; <string>S</string>&nbsp; 
when <var>s</var> is not an integer, and</p></item>
<item><p>the empty string (<string></string>) when <var>s</var> is zero.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-duTCan">duTimeCanonicalFragmentMap</name><nt def="nt-duTFrag"/>
<limits>a &string; matching <nt def="nt-duTFrag"/></limits>
<args><arg><var>h</var><limits>a nonnegative &integer;</limits></arg>
<arg><var>m</var><limits>a nonnegative &integer;</limits></arg>
<arg><var>s</var><limits>a nonnegative &decimal;</limits></arg></args>
<summary>Maps three nonnegative numbers, presumably the hour, minute, and second normalized values from a <dtref ref="duration"/>&apos;s <pfref ref="vp-du-second"/>, to a <nt def="nt-duTFrag"/>, a fragment of a <dtref ref="duration"/> <termref def="dt-lexical-representation"></termref>.</summary><algorithm>Return
<ulist><item><p><string>T</string>&nbsp;&concat;
<pfref ref="f-duHCan"/>(<var>h</var>)&nbsp;&concat;
<pfref ref="f-duMCan"/>(<var>m</var>)&nbsp;&concat;
<pfref ref="f-duSCan"/>(<var>s</var>)&emsp; 
when <var>h</var>, <var>m</var>, and <var>s</var> are not all zero, and</p></item>
<item><p>the empty string (<string></string>) when all arguments are zero.</p></item>
</ulist>
</algorithm>
</funcdef>

<funcdef><name id="f-duDTCan">duDayTimeCanonicalFragmentMap</name>
<nt def="nt-duDTFrag"/><limits>matches <nt def="nt-duDTFrag"/></limits>
<args><arg><var>ss</var><limits>a nonnegative &decimal;</limits></arg></args>
<summary>Maps a nonnegative &decimal;, presumably the absolute value of the <pfref ref="vp-du-second"/> of a <dtref ref="duration"/> value, to a <nt def="nt-duDTFrag"/>, a fragment of a <dtref ref="duration"/> <termref def="dt-lexical-representation"></termref>.</summary>
<varsetup>
<ulist><item><p><var>d</var> is&nbsp; 
<var>ss</var>&nbsp;<termref def="dt-div"></termref>&nbsp;86400&nbsp;,</p></item>
<item><p><var>h</var> is&nbsp; 
(<var>ss</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;86400)&nbsp;<termref def="dt-div"></termref>&nbsp;3600&nbsp;,</p></item>
<item><p><var>m</var> is&nbsp; 
(<var>ss</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;3600)&nbsp;<termref def="dt-div"></termref>&nbsp;60&nbsp;, and</p></item>
<item><p><var>s</var> is&nbsp; 
<var>ss</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;60&nbsp;,</p></item>
</ulist>
</varsetup>
<algorithm>Return
<ulist><item><p><pfref ref="f-duDCan"/>(<var>d</var>)&nbsp;&concat; 
<pfref ref="f-duTCan"/>(<var>h</var>,&nbsp;<var>m</var>,&nbsp;<var>s</var>)&emsp; 
when <var>ss</var> is not zero and</p></item>
<item><p><string>T0S</string>&emsp; when <var>ss</var> is zero.</p></item>
</ulist>
</algorithm>
</funcdef>
</defset>

<defset id="defs-durationCanmap">
<head>The <dtref ref="duration"/> Canonical Mapping</head>
<funcdef><name id="f-durationCanMap">durationCanonicalMap</name>
<nt def="nt-durationRep"/><limits>matches <nt def="nt-durationRep"/></limits>
<args><arg><var>v</var><limits>a complete <dtref ref="duration"/> value</limits></arg></args>
<summary>Maps a <dtref ref="duration"/>&apos;s property values  to <nt def="nt-durationRep"/> fragments and combines the fragments into a complete <nt def="nt-durationRep"/>.</summary>
<varsetup>
<ulist>
<item><p><var>m</var> be <var>v</var>&apos;s <vpropref ref="vp-du-month"/>,</p></item>
<item><p><var>s</var> be <var>v</var>&apos;s <vpropref ref="vp-du-second"/>, and</p></item>
<item><p><var>sgn</var> be <string>-</string> if <var>m</var> or 
<var>s</var> is negative and
the empty string (<string></string>) otherwise.</p></item>
</ulist>
</varsetup>
<algorithm>Return
<ulist><item><p><var>sgn</var>&nbsp;&concat; <string>P</string>&nbsp;&concat; 
<pfref ref="f-duYMCan"/>(|&nbsp;<var>m</var>&nbsp;|)&nbsp;&concat; 
<pfref ref="f-duDTCan"/>(|&nbsp;<var>s</var>&nbsp;|)&nbsp;&nbsp;&nbsp; 
when neither <var>m</var> nor <var>s</var> is zero,</p></item>
<item><p><var>sgn</var>&nbsp;&concat; <string>P</string>&nbsp;&concat; 
<pfref ref="f-duYMCan"/>(|&nbsp;<var>m</var>&nbsp;|)&nbsp;&nbsp;&nbsp; 
when <var>m</var> is not zero but <var>s</var> is, and</p></item>
<item><p><var>sgn</var>&nbsp;&concat; <string>P</string>&nbsp;&concat; 
<pfref ref="f-duDTCan"/>(|&nbsp;<var>s</var>&nbsp;|)&nbsp;&nbsp;&nbsp; 
when <var>m</var> is zero.</p></item>
</ulist>
</algorithm>
</funcdef></defset>

<defset id="defs-yearMonthDurationCanmap"><head>The <dtref ref="yearMonthDuration"/> Canonical Mapping</head>

<funcdef><name id="f-yearMonthDurationCanMap">yearMonthDurationCanonicalMap</name>
<nt def="nt-yearMonthDurationRep"/><limits>matches <nt def="nt-yearMonthDurationRep"/></limits>
<args><arg><var>ym</var><limits>a complete <dtref ref="yearMonthDuration"/> value</limits></arg></args>
<summary>Maps a <dtref ref="yearMonthDuration"/>&apos;s <vpropref ref="vp-du-month"/> value  to
a <nt def="nt-yearMonthDurationRep"/>.&nbsp; (The <vpropref ref="vp-du-second"/> value is necessarily zero and is ignored.)&nbsp; <pfref ref="f-yearMonthDurationCanMap"/> is a restriction of <pfref ref="f-durationCanMap"/>.</summary>
<varsetup>
<ulist>
<item><p><var>m</var> be <var>ym</var>&apos;s <vpropref ref="vp-du-month"/> and</p></item>
<item><p><var>sgn</var> be <string>-</string> if <var>m</var> is negative and
the empty string (<string></string>) otherwise.</p></item>
</ulist>
</varsetup>
<algorithm>
Return&nbsp; <var>sgn</var>&nbsp;&concat; <string>P</string>&nbsp;&concat; 
<pfref ref="f-duYMCan"/>(|&nbsp;<var>m</var>&nbsp;|)&nbsp;.
</algorithm>
</funcdef>

</defset>

<defset id="defs-dayTimeDurationCanmap"><head>The <dtref ref="dayTimeDuration"/> Canonical Mapping</head>

<funcdef><name id="f-dayTimeDurationCanMap">dayTimeDurationCanonicalMap</name>
<nt def="nt-dayTimeDurationRep"/><limits>matches <nt def="nt-dayTimeDurationRep"/></limits>
<args><arg><var>dt</var><limits>a complete <dtref ref="dayTimeDuration"/> value</limits></arg></args>
<summary>Maps a <dtref ref="dayTimeDuration"/>&apos;s <vpropref ref="vp-du-second"/> value  to
a <nt def="nt-dayTimeDurationRep"/>.&nbsp; (The <vpropref ref="vp-du-month"/> value is necessarily zero and is ignored.)&nbsp; <pfref ref="f-dayTimeDurationCanMap"/> is a restriction of <pfref ref="f-durationCanMap"/>.</summary>
<varsetup>
<ulist>
<item><p><var>s</var> be <var>dt</var>&apos;s <vpropref ref="vp-du-month"/> and</p></item>
<item><p><var>sgn</var> be <string>-</string> if <var>s</var> is negative and
the empty string (<string></string>) otherwise.</p></item>
</ulist>
</varsetup>
<algorithm>Return&nbsp;<var>sgn</var>&nbsp;&concat; <string>P</string>&nbsp;&concat; 
<pfref ref="f-duYMCan"/>(|&nbsp;<var>s</var>&nbsp;|)&nbsp;.
</algorithm>
</funcdef>

</defset>
</p>
</div2>

<div2 diff="add"><head>Date/time-related Definitions</head>

<p>When adding and subtracting numbers from date/time properties, the immediate results may not conform 
to the limits specified.&nbsp; Accordingly, the following procedures are used to
<unusual>normalize</unusual> potential property values to corresponding values that do
conform to the appropriate limits.&nbsp; Normalization is required when dealing with timezone
changes (as when converting to and from <unusual>raw</unusual> values) and when adding
<dtref ref="duration"/> values to or subtracting them from <dtref ref="dateTime"/> values.

<defset role="aux"><head>Date/time Datatype Normalizing Procedures</head>
<procdef><name id="f-dt-normMo">normalizeMonth</name>
<args>
<arg><var>yr</var><limits>an &integer;</limits></arg>
<arg><var>mo</var><limits>an &integer;</limits></arg>
</args>
<algorithm>
<olist>
<item><p>
Add&nbsp; (<var>mo</var>&nbsp;&minus;&nbsp;1)&nbsp;<termref def="dt-div"></termref>&nbsp;12&nbsp; to <var>yr</var>.
</p></item>
<item><p>
Set <var>mo</var> to&nbsp; (<var>mo</var>&nbsp;&minus;&nbsp;1)&nbsp;<termref def="dt-mod"></termref>&nbsp;12&nbsp;.
</p></item>
</olist>
</algorithm>
</procdef>

<procdef><name id="f-dt-normDa">normalizeDay</name>
<args>
<arg><var>yr</var><limits>an &integer;</limits></arg>
<arg><var>mo</var><limits>an &integer;</limits></arg>
<arg><var>da</var><limits>an &integer;</limits></arg>
</args>
<summary>Normalizes month and year values to values that obey the appropriate constraints.</summary>
<algorithm>
<olist>
<item><p><pfref ref="f-dt-normMo"/>(<var>yr</var>,&nbsp;<var>mo</var>)</p></item>
<item><p>Repeat until <var>da</var> is positive and not greater than the limit specified in the table of day
limits in <specref ref="dayYM"/> (which depends on <var>yr</var> and <var>mo</var>):
 <olist>
 <item><p>If <var>da</var> exceeds the upper limit from the table then:
  <olist>
  <item><p>Subtract that limit from <var>da</var>.</p></item>
  <item><p>Add 1 to <var>mo</var>.</p></item>
  <item><p><pfref ref="f-dt-normMo"/>(<var>yr</var>,&nbsp;<var>mo</var>)</p></item>
  </olist>
 </p></item>
 <item><p>If <var>da</var> is not positive then:
  <olist>
  <item><p>Subtract 1 from <var>mo</var>.</p></item>
  <item><p><pfref ref="f-dt-normMo"/>(<var>yr</var>,&nbsp;<var>mo</var>)</p></item>
  <item><p>Add the new upper limit from the table to <var>da</var>.</p></item>
  </olist>
 </p></item>
 </olist>
</p></item>
</olist>
</algorithm>
</procdef>

<procdef><name id="f-dt-normMi">normalizeMinute</name>
<args>
<arg><var>yr</var><limits>an &integer;</limits></arg>
<arg><var>mo</var><limits>an &integer;</limits></arg>
<arg><var>da</var><limits>an &integer;</limits></arg>
<arg><var>hr</var><limits>an &integer;</limits></arg>
<arg><var>mi</var><limits>an &integer;</limits></arg>
</args>
<summary>Normalizes minute, hour, month, and year values to values that obey the appropriate constraints.</summary>
<algorithm>
<olist>
<item><p>Add &nbsp; <var>mi</var>&nbsp;<termref def="dt-div"></termref>&nbsp;60&nbsp; to <var>hr</var>.</p></item>
<item><p>Set <var>mi</var> to&nbsp; <var>mi</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;60&nbsp;.</p></item>
<item><p>Add&nbsp; <var>hr</var>&nbsp;<termref def="dt-div"></termref>&nbsp;24&nbsp; to <var>da</var>.</p></item>
<item><p>Set <var>hr</var> to&nbsp; <var>hr</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;24&nbsp;.</p></item>
<item><p><pfref ref="f-dt-normDa"/>(<var>yr</var>,&nbsp;<var>mo</var>,&nbsp;<var>da</var>).</p></item>
</olist>
</algorithm>
</procdef>

<procdef><name id="f-dt-normSe">lsiNormalizeSecond</name>
<args>
<arg><var>yr</var><limits>an &integer;</limits></arg>
<arg><var>yr</var><limits>an &integer;</limits></arg>
<arg><var>da</var><limits>an &integer;</limits></arg>
<arg><var>hr</var><limits>an &integer;</limits></arg>
<arg><var>mi</var><limits>an &integer;</limits></arg>
<arg><var>se</var><limits>a &decimal;</limits></arg>
</args>
<summary>Normalizes second, minute, hour, month, and year values to values that obey the appropriate
constraints.&nbsp; (This algorithm is <unusual>leap-second insensitive</unusual>.)</summary>
<algorithm>
<olist>
<item><p>Add&nbsp; <var>se</var>&nbsp;<termref def="dt-div"></termref>&nbsp;60&nbsp; to <var>mi</var>.</p></item>
<item><p>Set <var>se</var> to&nbsp; <var>se</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;60&nbsp;.</p></item>
<item><p><pfref ref="f-dt-normMi"/>(<var>yr</var>,&nbsp;<var>mo</var>,&nbsp;<var>da</var>,&nbsp;<var>hr</var>,&nbsp;<var>mi</var>).</p></item>
</olist>
</algorithm>
</procdef>

<procdef><name id="f-dt-lSNormSe">lssNormalizeSecond</name>
<args>
<arg><var>yr</var><limits> an &integer;</limits></arg>
<arg><var>mo</var><limits> an &integer;</limits></arg>
<arg><var>da</var><limits> an &integer;</limits></arg>
<arg><var>hr</var><limits> an &integer;</limits></arg>
<arg><var>mi</var><limits> an &integer;</limits></arg>
<arg><var>se</var><limits> a &decimal;</limits></arg>
</args>
<summary>Normalizes second, minute, hour, month, and year values to values that obey the appropriate
constraints.&nbsp; (This algorithm is <unusual>leap-second sensitive</unusual>.)</summary>
<algorithm>
<olist>
<item><p><pfref ref="f-dt-normDa"/>(<var>yr</var>,&nbsp;<var>mo</var>,&nbsp;<var>da</var>).</p></item>
<item><p>Add&nbsp; 60&nbsp;&times;&nbsp;<var>mi</var>&nbsp;+&nbsp;3600&nbsp;&times;&nbsp;<var>hr</var>
to <var>se</var>&nbsp;.</p></item>
<item><p>Set <var>mi</var> and <var>hr</var> to zero.</p></item>
<item><p>Repeat until <var>se</var> is nonnegative and less than 86400 plus the number of leap-seconds
specified by the leap-second table in <specref ref="secMinDay"/> (which depends on
<var>yr</var>, <var>mo</var>, and <var>da</var>):
 <olist>
 <item><p>If <var>se</var> equals or exceeds 86400 plus the upper limit from the table then:
  <olist>
  <item><p>Subtract&nbsp; (86400 plus that leap-second count) from <var>se</var>.</p></item>
  <item><p>Add 1 to <var>da</var>.</p></item>
  </olist>
 </p></item>
 <item><p>If <var>se</var> is negative then:
  <olist>
  <item><p>Subtract 1 from <var>da</var>.</p></item>
  <item><p>Add 86400 plus the new leap-second count from the table to <var>se</var>.</p></item>
  </olist>
 </p></item>
 <item><p><pfref ref="f-dt-normDa"/>(<var>yr</var>,&nbsp;<var>mo</var>,&nbsp;<var>da</var>).</p></item>
 </olist>
</p></item>
<item><p>
 <olist>
 <item><p>If <var>se</var> is less than 86340 then:
  <olist>
  <item><p>Set <var>mi</var> to <var>se</var>&nbsp;<termref def="dt-div"></termref>&nbsp;60.</p></item>
  <item><p>Set <var>se</var> to <var>se</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;60.</p></item>
  </olist>
 </p></item>
 <item><p>If <var>se</var> is not less than 86340 then:
  <olist>
  <item><p>Set <var>mi</var> to 1439.</p></item>
  <item><p>Subtract 86340 from <var>se</var>.</p></item>
  </olist>
 </p></item>
 </olist>
</p></item>
<item><p><pfref ref="f-dt-normMi"/>(<var>yr</var>,&nbsp;<var>mo</var>,&nbsp;<var>da</var>,&nbsp;<var>hr</var>,&nbsp;<var>mi</var>)</p></item>
</olist>
</algorithm>
</procdef>
</defset>
</p>

<note>
<p>The <unusual>raw-value</unusual> functions following all have very similar algorithms</p>
</note>

<p>
<defset>
<head role="aux"><unusual>Raw</unusual> Properties of Date/time Seven-property Models</head>

<funcdef><name id="vp-dt-rawYear">rawYear</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>dt</var><limits>a <dtref ref="dt-dt-7PropMod"/> value</limits></arg></args>
<summary>Returns the <unusual>raw</unusual> year value of a <dtref ref="dt-dt-7PropMod"/>, i.e., the <unusual>local timezone</unusual> year, as opposed to the <termref def="dt-utc"></termref> year.  (This matters only near the year boundaries.)</summary>
<varsetup>
<ulist>
<item><p><var>yr</var> be 1971 when <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> is <pt>absent</pt>, and <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> otherwise,</p></item>
<item><p><var>mo</var> be 12 or <var>dt</var>&apos;s <pfref ref="vp-dt-month"/>&nbsp;, similarly,</p></item>
<item><p><var>da</var> be (the limit specified in the table of day limits in <specref ref="dayYM"/>
(which depends on <var>yr</var> and <var>mo</var>)) or <var>dt</var>&apos;s <pfref ref="vp-dt-day"/>&nbsp;, similarly,</p></item>
<item><p><var>hr</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-hour"/>&nbsp;, similarly, and</p></item>
<item><p><var>mi</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-minute"/>&nbsp;, similarly.</p></item>
</ulist>
</varsetup>
<algorithm>
<olist>
 <item><p>Add <pfref ref="vp-dt-timezone"/> to <var>mi</var></p></item>
 <item><p><pfref ref="f-dt-normMi"/>(<var>yr</var>,&nbsp;<var>mo</var>,&nbsp;<var>da</var>,&nbsp;<var>hr</var>,&nbsp;<var>mi</var>).</p></item>
 <item><p>If <pfref ref="vp-dt-timezone"/> or <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> is <pt>absent</pt>,
return <var>dt</var>&apos;s <pfref ref="vp-dt-year"/>; otherwise, return <var>yr</var>.</p></item>
 </olist>
</algorithm>
</funcdef>

<funcdef><name id="vp-dt-rawMonth">rawMonth</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>dt</var><limits>a <dtref ref="dt-dt-7PropMod"/> value</limits></arg></args>
<summary>Returns the <unusual>raw</unusual> month value of a <dtref ref="dt-dt-7PropMod"/>, i.e., the <unusual>local timezone</unusual> month, as opposed to the <termref def="dt-utc"></termref> month.  (This matters only near the month boundaries.)</summary>
<varsetup>
<ulist>
<item><p><var>yr</var> be 1971 when <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> is <pt>absent</pt>, and <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> otherwise,</p></item>
<item><p><var>mo</var> be 12 or <var>dt</var>&apos;s <pfref ref="vp-dt-month"/>&nbsp;, similarly,</p></item>
<item><p><var>da</var> be (the limit specified in the table of day limits in <specref ref="dayYM"/>
(which depends on <var>yr</var> and <var>mo</var>)) or <var>dt</var>&apos;s <pfref ref="vp-dt-day"/>&nbsp;, similarly,</p></item>
<item><p><var>hr</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-hour"/>&nbsp;, similarly, and</p></item>
<item><p><var>mi</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-minute"/>&nbsp;, similarly.</p></item>
</ulist>
</varsetup>
<algorithm>
<olist>
<item><p>Add <pfref ref="vp-dt-timezone"/> to <var>mi</var></p></item>
<item><p><pfref ref="f-dt-normMi"/>(<var>yr</var>,&nbsp;<var>mo</var>,&nbsp;<var>da</var>,&nbsp;<var>hr</var>,&nbsp;<var>mi</var>).</p></item>
<item><p>If <pfref ref="vp-dt-timezone"/> or <var>dt</var>&apos;s <pfref ref="vp-dt-month"/> is <pt>absent</pt>,
return <var>dt</var>&apos;s <pfref ref="vp-dt-month"/>; otherwise, return <var>mo</var>.</p></item>
</olist>
</algorithm>
</funcdef>

<funcdef><name id="vp-dt-rawDay">rawDay</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>dt</var><limits>a <dtref ref="dt-dt-7PropMod"/> value</limits></arg></args>
<summary>Returns the <unusual>raw</unusual> day value of a <dtref ref="dt-dt-7PropMod"/>, i.e., the <unusual>local timezone</unusual> day, as opposed to the <termref def="dt-utc"></termref> day.</summary>
<varsetup>
<ulist>
<item><p><var>yr</var> be 1971 when <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> is <pt>absent</pt>, and <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> otherwise,</p></item>
<item><p><var>mo</var> be 12 or <var>dt</var>&apos;s <pfref ref="vp-dt-month"/>&nbsp;, similarly,</p></item>
<item><p><var>da</var> be (the limit specified in the table of day limits in <specref ref="dayYM"/>
(which depends on <var>yr</var> and <var>mo</var>)) or <var>dt</var>&apos;s <pfref ref="vp-dt-day"/>&nbsp;, similarly,</p></item>
<item><p><var>hr</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-hour"/>&nbsp;, similarly, and</p></item>
<item><p><var>mi</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-minute"/>&nbsp;, similarly.</p></item>
</ulist>
</varsetup>
<algorithm>
<olist>
 <item><p>Add <pfref ref="vp-dt-timezone"/> to <var>mi</var></p></item>
 <item><p><pfref ref="f-dt-normMi"/>(<var>yr</var>,&nbsp;<var>mo</var>,&nbsp;<var>da</var>,&nbsp;<var>hr</var>,&nbsp;<var>mi</var>).</p></item>
 <item><p>If <pfref ref="vp-dt-timezone"/> or <var>dt</var>&apos;s <pfref ref="vp-dt-day"/> is <pt>absent</pt>,
return <var>dt</var>&apos;s <pfref ref="vp-dt-day"/>; otherwise, return <var>da</var>.</p></item>
 </olist>
</algorithm>
</funcdef>

<funcdef><name id="vp-dt-rawHour">rawHour</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>dt</var><limits>a <dtref ref="dt-dt-7PropMod"/> value</limits></arg></args>
<summary>Returns the <unusual>raw</unusual> hour value of a <dtref ref="dt-dt-7PropMod"/>, i.e., the <unusual>local timezone</unusual> hour, as opposed
to the <termref def="dt-utc"></termref> hour.</summary>
<varsetup>
<ulist>
<item><p><var>yr</var> be 1971 when <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> is <pt>absent</pt>, and <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> otherwise,</p></item>
<item><p><var>mo</var> be 12 or <var>dt</var>&apos;s <pfref ref="vp-dt-month"/>&nbsp;, similarly,</p></item>
<item><p><var>da</var> be (the limit specified in the table of day limits in <specref ref="dayYM"/>
(which depends on <var>yr</var> and <var>mo</var>)) or <var>dt</var>&apos;s <pfref ref="vp-dt-day"/>&nbsp;, similarly,</p></item>
<item><p><var>hr</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-hour"/>&nbsp;, similarly, and</p></item>
<item><p><var>mi</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-minute"/>&nbsp;, similarly.</p></item>
</ulist>
</varsetup>
<algorithm>
<olist>
<item><p>Add <pfref ref="vp-dt-timezone"/> to <var>mi</var></p></item>
<item><p><pfref ref="f-dt-normMi"/>(<var>yr</var>,&nbsp;<var>mo</var>,&nbsp;<var>da</var>,&nbsp;<var>hr</var>,&nbsp;<var>mi</var>).</p></item>
<item><p>If <pfref ref="vp-dt-timezone"/> or <var>dt</var>&apos;s <pfref ref="vp-dt-hour"/> is <pt>absent</pt>,
return <var>dt</var>&apos;s <pfref ref="vp-dt-hour"/>; otherwise, return <var>hr</var>.</p></item>
</olist>
</algorithm>
</funcdef>

<funcdef><name id="vp-dt-rawMinute">rawMinute</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>dt</var><limits>a <dtref ref="dt-dt-7PropMod"/> value</limits></arg></args>
<summary>Returns the <unusual>raw</unusual> minute value of a <dtref ref="dt-dt-7PropMod"/>, i.e., the <unusual>local timezone</unusual> minute, as opposed
to the <termref def="dt-utc"></termref> minute.</summary>
<varsetup>
<ulist>
<item><p><var>yr</var> be 1971 when <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> is <pt>absent</pt>, and <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> otherwise,</p></item>
<item><p><var>mo</var> be 12 or <var>dt</var>&apos;s <pfref ref="vp-dt-month"/>&nbsp;, similarly,</p></item>
<item><p><var>da</var> be (the limit specified in the table of day limits in <specref ref="dayYM"/>
(which depends on <var>yr</var> and <var>mo</var>)) or <var>dt</var>&apos;s <pfref ref="vp-dt-day"/>&nbsp;, similarly,</p></item>
<item><p><var>hr</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-hour"/>&nbsp;, similarly, and</p></item>
<item><p><var>mi</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-minute"/>&nbsp;, similarly.</p></item>
</ulist>
</varsetup>
<algorithm>
<olist>
<item><p>Add <pfref ref="vp-dt-timezone"/> to <var>mi</var></p></item>
<item><p><pfref ref="f-dt-normMi"/>(<var>yr</var>,&nbsp;<var>mo</var>,&nbsp;<var>da</var>,&nbsp;<var>hr</var>,&nbsp;<var>mi</var>).</p></item>
<item><p>If <pfref ref="vp-dt-timezone"/> or <var>dt</var>&apos;s <pfref ref="vp-dt-minute"/> is <pt>absent</pt>,
return <var>dt</var>&apos;s <pfref ref="vp-dt-minute"/>; otherwise, return <var>mi</var>.</p></item>
</olist>
</algorithm>
</funcdef>

<funcdef><name id="vp-dt-rawSecond">rawSecond</name>
&decimal;<limits>a &decimal;</limits>
<args><arg><var>dt</var><limits>a <dtref ref="dt-dt-7PropMod"/> value</limits></arg></args>
<summary>Returns the <unusual>raw</unusual> second value of a <dtref ref="dt-dt-7PropMod"/>, i.e., the <unusual>local timezone</unusual> second,
as opposed to the <termref def="dt-utc"></termref> second; however, for seconds, there is no difference.</summary>
<algorithm>Return <pfref ref="vp-dt-second"/> value unchanged.</algorithm>
</funcdef>

<procdef><name id="p-setDTFromRaw">setDateTimeFromRaw</name>
<args><arg><var>dt</var><limits>a <dtref ref="dt-dt-7PropMod"/> value</limits></arg>
<arg><var>rawYr</var><limits>an <termref def="dt-optional"></termref> &integer;</limits></arg>
<arg><var>rawMo</var><limits>an <termref def="dt-optional"></termref> &integer;</limits></arg>
<arg><var>rawDa</var><limits>an <termref def="dt-optional"></termref> &integer;</limits></arg>
<arg><var>rawHr</var><limits>an <termref def="dt-optional"></termref> &integer;</limits></arg>
<arg><var>rawMi</var><limits>an <termref def="dt-optional"></termref> &integer;</limits></arg>
<arg><var>rawSe</var><limits>an <termref def="dt-optional"></termref> &decimal;</limits></arg></args>
<summary>Sets the properties of a <dtref ref="dt-dt-7PropMod"/> from the  <unusual>raw</unusual> values provided (the <unusual>local timezone</unusual>
values, as opposed to the <termref def="dt-utc"></termref> values).  <pt>absent</pt> values are given default values
for computation, but ultimately <pt>absent</pt> properties remain <pt>absent</pt>.</summary>
<varsetup>
<ulist>
<item><p><var>yr</var> be <var>rawYear</var> when <var>rawYear</var> is not <pt>absent</pt>, <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> when
<var>dt</var>&apos;s <pfref ref="vp-dt-year"/> is not <pt>absent</pt> but <var>rawYear</var> is, and 1971 otherwise,</p></item>
<item><p><var>mo</var> be <var>rawMo</var>, <var>dt</var>&apos;s <pfref ref="vp-dt-month"/>, or 12, similarly,</p></item>
<item><p><var>da</var> be <var>rawDa</var>, <var>dt</var>&apos;s <pfref ref="vp-dt-day"/>, or the limit specified in the table of day limits in <specref ref="dayYM"/>
(which depends on <var>yr</var> and <var>mo</var>), similarly,</p></item>
<item><p><var>hr</var> be <var>rawHr</var>, <var>dt</var>&apos;s <pfref ref="vp-dt-hour"/>, or 0, similarly,</p></item>
<item><p><var>mi</var> be <var>rawMi</var>, <var>dt</var>&apos;s <pfref ref="vp-dt-minute"/>, or 0, similarly, and</p></item>
<item><p><var>se</var> be <var>rawSe</var>, <var>dt</var>&apos;s <pfref ref="vp-dt-second"/>, or 0, similarly.</p></item>
</ulist>
</varsetup>
<algorithm>
<olist>
<item><p>If <var>dt</var>&apos;s <pfref ref="vp-dt-timezone"/> is not <pt>absent</pt>,
 <olist>
 <item><p>Subtract <pfref ref="vp-dt-timezone"/> from <var>mi</var></p></item>
 <item><p><pfref ref="f-dt-normMi"/>(<var>yr</var>,<var>mo</var>,<var>da</var>,<var>hr</var>,<var>mi</var>).</p></item>
</olist></p></item>
<item><p>Set <pfref ref="vp-dt-year"/> to <var>yr</var> when <pfref ref="vp-dt-year"/> is not <pt>absent</pt>,
 <pfref ref="vp-dt-month"/> to <var>mo</var> when <pfref ref="vp-dt-month"/> is not <pt>absent</pt>, etc.</p></item>
</olist>
</algorithm>
</procdef>
</defset>

<defset id="defs-dt-ToTl">
<head>Time on Timeline for Date/time Seven-property Models</head>

<funcdef><name id="vp-dt-timeOnTimeline">timeOnTimeline</name>
&decimal;<limits>a &decimal;</limits>
<args><arg><var>dt</var><limits>a <dtref ref="dt-dt-7PropMod"/> value</limits></arg></args>
<summary>Maps a <dtref ref="dt-dt-7PropMod"/> value to the &decimal; representing its position on the <unusual>time line</unusual>.</summary>
<varsetup>
<ulist>
<item><p><var>yr</var> be 1970 when <var>dt</var>&apos;s <pfref ref="vp-dt-year"/> is <pt>absent</pt>,
and&nbsp; <var>dt</var>&apos;s <pfref ref="vp-dt-year"/>&nbsp;&minus;&nbsp;1&nbsp; otherwise,</p></item>
<item><p><var>mo</var> be 12 or <var>dt</var>&apos;s <pfref ref="vp-dt-month"/>&nbsp;, similarly,</p></item>
<item><p><var>da</var> be&nbsp; (the limit specified in the table of day limits)&nbsp;&minus;&nbsp;1&nbsp;
or&nbsp; (<var>dt</var>&apos;s <pfref ref="vp-dt-day"/>)&nbsp;&minus;&nbsp;1&nbsp;, similarly,</p></item>
<item><p><var>hr</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-hour"/>&nbsp;, similarly, and</p></item>
<item><p><var>mi</var> be 0 or <var>dt</var>&apos;s <pfref ref="vp-dt-minute"/>&nbsp;, similarly.</p></item>
</ulist>
</varsetup>
<algorithm>
<olist>
<item><p>(<pfref ref="vp-dt-year"/>)
<olist>
<item><p>Set <var>ToTl</var> to&nbsp;
31536000&nbsp;&times;&nbsp;<var>yr</var>&nbsp;.</p></item>
</olist></p></item>
<item><p>(Leap-year Days, <pfref ref="vp-dt-month"/>, and <pfref ref="vp-dt-day"/>)
<olist>
<item><p>Add&nbsp; 86400&nbsp;&times;
(<var>yr</var>&nbsp;<termref def="dt-div"></termref>&nbsp;400&nbsp;&minus;
<var>yr</var>&nbsp;<termref def="dt-div"></termref>&nbsp;100&nbsp;+
<var>yr</var>&nbsp;<termref def="dt-div"></termref>&nbsp;4)&nbsp;
to <var>ToTl</var>.</p></item>
<item><p>Add &nbsp; 86400&nbsp;&times; (total number of days in months less than
<var>mo</var>, from table in <specref ref="dayYM"/>) to
<var>ToTl</var></p></item>
<item><p>Add &nbsp; 86400&nbsp;&times;&nbsp;<var>da</var>&nbsp;
to <var>ToTl</var>.</p></item>
</olist></p></item>
<item><p>(<pfref ref="vp-dt-hour"/>, <pfref ref="vp-dt-minute"/>, and <pfref ref="vp-dt-second"/>)
<olist>
<item><p>Add &nbsp; 3600&nbsp;&times;&nbsp;<var>hr</var>&nbsp;+
60&nbsp;&times;&nbsp;<var>mi</var>&nbsp;+ <var>se</var>&nbsp;
to <var>ToTl</var>.</p></item>
</olist></p></item>
<item><p>Return <var>ToTl</var>.</p></item>
</olist>
</algorithm>
</funcdef>
</defset>

</p>
 
 <defset id="defs-func-on-dt-frags"><head>Partial Date/time Lexical Mappings</head>

<funcdef><name id="f-dt-yrMap">yearFragValue</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>YR</var><limits>matches <nt def="nt-yrFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-yrFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>,
onto an &integer;, presumably the <pfref ref="vp-dt-year"/> property of a <dtref ref="dt-dt-7PropMod"/> value.</summary>
<algorithm>Return <pfref ref="f-noDecVal"/>(<var>YR</var>)</algorithm>
</funcdef>
 
<funcdef><name id="f-dt-moMap">monthFragValue</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>MO</var><limits>matches <nt def="nt-moFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-moFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>,
onto an &integer;, presumably the <pfref ref="vp-dt-month"/> property of a <dtref ref="dt-dt-7PropMod"/> value.</summary>
<algorithm>Return <pfref ref="f-unsNoDecVal"/>(<var>MO</var>)</algorithm>
</funcdef>
 
<funcdef><name id="f-dt-daMap">dayFragValue</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>DA</var><limits>matches <nt def="nt-daFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-daFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>,
onto an &integer;, presumably the <pfref ref="vp-dt-day"/> property of a <dtref ref="dt-dt-7PropMod"/> value.</summary>
<algorithm>Return <pfref ref="f-unsNoDecVal"/>(<var>DA</var>)</algorithm>
</funcdef>
 
<funcdef><name id="f-dt-hrMap">hourFragValue</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>HR</var><limits>matches <nt def="nt-hrFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-hrFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>,
onto an &integer;, presumably the <pfref ref="vp-dt-hour"/> property of a <dtref ref="dt-dt-7PropMod"/> value.</summary>
<algorithm>Return <pfref ref="f-unsNoDecVal"/>(<var>HR</var>)</algorithm>
</funcdef>
 
<funcdef><name id="f-dt-miMap">minuteFragValue</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>MI</var><limits>matches <nt def="nt-miFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-miFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>,
onto an &integer;, presumably the <pfref ref="vp-dt-minute"/> property of a <dtref ref="dt-dt-7PropMod"/> value.</summary>
<algorithm>Return <pfref ref="f-unsNoDecVal"/>(<var>MI</var>)</algorithm>
</funcdef>
 
<funcdef><name id="f-dt-seMap">secondFragValue</name>
&decimal;<limits>a &decimal;</limits>
<args><arg><var>SE</var><limits>matches <nt def="nt-seFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-seFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>,
onto a &decimal;, presumably the <pfref ref="vp-dt-second"/> property of a <dtref ref="dt-dt-7PropMod"/> value.</summary>
<algorithm>Return
 <ulist>
 <item><p><pfref ref="f-unsNoDecVal"/>(<var>SE</var>)&emsp; when no decimal point occurs in <var>SE</var>, and</p></item>
 <item><p><pfref ref="f-unsDecVal"/>(<var>SE</var>)&emsp; otherwise.</p></item></ulist></algorithm>
</funcdef>

<funcdef><name id="f-dt-tzMap">timezoneFragValue</name>
&integer;<limits>an &integer;</limits>
<args><arg><var>TZ</var><limits>matches <nt def="nt-tzFrag"/></limits></arg></args>
<summary>Maps a <nt def="nt-tzFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>,
onto an &integer;, presumably the <pfref ref="vp-dt-timezone"/> property of a <dtref ref="dt-dt-7PropMod"/> value.</summary>
<argsetup><var>TZ</var> necessarily consists of either just <string>Z</string>, or
 a sign (<string>+</string> or <string>-</string>) followed by an instance <var>H</var> of
 <nt def="nt-hrFrag"/>, a colon, and an instance <var>M</var> of <nt def="nt-miFrag"/>
</argsetup>
<algorithm>Return
 <ulist>
 <item><p>0&emsp; when <var>TZ</var> is <string>Z</string>,</p></item>
 <item><p>&minus;(<pfref ref="f-unsDecVal"/>(<var>H</var>)&nbsp;&times;&nbsp;60&nbsp;+ <pfref ref="f-unsDecVal"/>(<var>M</var>))&emsp;
 when the sign is <string>-</string>, and</p></item>
 <item><p><pfref ref="f-unsDecVal"/>(<var>H</var>)&nbsp;&times;&nbsp;60&nbsp;+ <pfref ref="f-unsDecVal"/>(<var>M</var>)&emsp;
 otherwise.</p></item>
</ulist></algorithm>
</funcdef>
</defset>

<defset id="defs-gDayLexmap"><head>Lexical Mapping</head>
<funcdef><name id="vp-gDayLexRep">gDayLexicalRep</name>
<dtref ref="gDay"/><limits>a complete <dtref ref="gDay"/> value</limits>
<args><arg><var>LEX</var><limits>matches <nt def="nt-gDayRep"/></limits></arg></args>
<summary>Maps a <nt def="nt-gDayRep"/> to a <dtref ref="gDay"/> value.</summary>
<argsetup><var>LEX</var> necessarily includes an instance <var>D</var> of <nt def="nt-daFrag"/>, optionally
followed by an instance <var>T</var> of <nt def="nt-tzFrag"/>.</argsetup>
<varsetup>
<var>gD</var> be a complete <dtref ref="gDay"/> value with all property values <pt>absent</pt>.
</varsetup>
<algorithm>
<olist>
<item><p>Set <var>gD</var>&apos;s <pfref ref="vp-dt-timezone"/> to <pfref ref="f-dt-tzMap"/>(<var>T</var>) when <var>T</var>
is present and <pt>absent</pt> otherwise.</p></item>
<item><p><pfref ref="p-setDTFromRaw"/>(<var>gD</var>, <pt>absent</pt>, <pt>absent</pt>, <pfref ref="f-dt-daMap"/>(<var>D</var>), <pt>absent</pt>, <pt>absent</pt>, <pt>absent</pt>)</p></item>
<item><p>Return <var>gD</var>.</p></item>
</olist>
</algorithm></funcdef>
</defset>

<defset role="aux"><head>Auxiliary Functions for Date/time Canonical Mappings</head>

<funcdef><name id="f-unsTwoDigCanFragMap">unsTwoDigitCanonicalFragmentMap</name>
<nt def="nt-unsNoDecNuml"/><limits>matches <nt def="nt-unsNoDecNuml"/></limits>
<args><arg><var>i</var><limits>a nonnegative &integer; less than 100</limits></arg></args>
<summary>Maps a nonnegative &integer; less than 100 onto an unsigned always-two-digit numeral.</summary>
<algorithm>Return <pfref ref="f-digit"/>(<var>i</var>&nbsp;<termref def="dt-div"></termref>&nbsp;10)&nbsp;&concat;
<pfref ref="f-digit"/>(<var>i</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;10)</algorithm>
</funcdef>

<!--funcdef><name id="f-twoDigCanFragMap">twoDigitCanonicalFragmentMap</name>
<limits>a &string;</limits>
<args><arg><var>i</var><limits>an &integer; whose absolute value is less than 100</limits></arg></args>
<summary>Maps an &integer; between -100 and 100 onto an always-two-digit numeral.</summary>
<algorithm>Return<ulist>
<item><p><string>-</string>&nbsp;&concat;&nbsp;<pfref ref="f-unsTwoDigCanFragMap"/>(&minus;<var>i</var>)&emsp; when
<var>i</var> is negative,</p></item>
<item><p><pfref ref="f-unsTwoDigCanFragMap"/>(<var>i</var>)&emsp; otherwise.</p></item>
</ulist></algorithm>
</funcdef-->

<funcdef><name id="f-fourDigCanFragMap">fourDigitCanonicalFragmentMap</name>
<nt def="nt-noDecNuml"/><limits>matches <nt def="nt-noDecNuml"/></limits>
<args><arg><var>i</var><limits>an &integer; whose absolute value is less than 10000</limits></arg></args>
<summary>Maps an &integer; between -10000 and 10000 onto an always-four-digit numeral.</summary>
<algorithm>Return<ulist>
<item><p><string>-</string>&nbsp;&concat;&nbsp;<pfref ref="f-unsTwoDigCanFragMap"/>(&minus;<var>i</var>&nbsp;<termref def="dt-div"></termref>&nbsp;100)&nbsp;&concat;
<pfref ref="f-unsTwoDigCanFragMap"/>(&minus;<var>i</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;100)&emsp; when
<var>i</var> is negative,</p></item>
<item><p><pfref ref="f-unsTwoDigCanFragMap"/>(<var>i</var>&nbsp;<termref def="dt-div"></termref>&nbsp;100)&nbsp;&concat;
<pfref ref="f-unsTwoDigCanFragMap"/>(<var>i</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;100)&emsp; otherwise.</p></item>
</ulist></algorithm>
</funcdef>
</defset>

<defset id="defs-func-to-dt-frags"><head>Partial Date/time Canonical Mappings</head>

<funcdef><name id="f-yrCanFragMap">yearCanonicalFragmentMap</name>
<nt def="nt-yrFrag"/><limits>matches <nt def="nt-yrFrag"/></limits>
<args><arg><var>y</var><limits>an &integer; </limits></arg></args>
<summary>Maps an &integer;, presumably the <pfref ref="vp-dt-year"/> property of a <dtref ref="dt-dt-7PropMod"/> value,
onto a <nt def="nt-yrFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>.</summary>
<algorithm>Return
<ulist>
<item><p><pfref ref="f-noDecCanMap"/>(<var>y</var>)&emsp; when&nbsp; |<var>y</var>|&nbsp;&gt;&nbsp;9999&nbsp;.</p></item>
<item><p><pfref ref="f-fourDigCanFragMap"/>(<var>y</var>)&emsp; otherwise.</p></item>
</ulist></algorithm>
</funcdef>

<funcdef><name id="f-moCanFragMap">monthCanonicalFragmentMap</name>
<nt def="nt-moFrag"/><limits>matches <nt def="nt-moFrag"/></limits>
<args><arg><var>m</var><limits>an &integer; between 1 and 12 inclusive</limits></arg></args>
<summary>Maps an &integer;, presumably the <pfref ref="vp-dt-month"/> property of a <dtref ref="dt-dt-7PropMod"/> value,
onto a <nt def="nt-moFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>.</summary>
<algorithm>Return <pfref ref="f-unsTwoDigCanFragMap"/>(<var>m</var>)</algorithm>
</funcdef>

<funcdef><name id="f-daCanFragMap">dayCanonicalFragmentMap</name>
<nt def="nt-daFrag"/><limits>matches <nt def="nt-daFrag"/></limits>
<args><arg><var>d</var><limits>an &integer; between 1 and 31 inclusive&nbsp;
(may be limited further depending on associated <pfref ref="vp-dt-year"/> and <pfref ref="vp-dt-month"/>)</limits></arg></args>
<summary>Maps an &integer;, presumably the <pfref ref="vp-dt-day"/> property of a <dtref ref="dt-dt-7PropMod"/> value,
onto a <nt def="nt-daFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>.</summary>
<algorithm>Return <pfref ref="f-unsTwoDigCanFragMap"/>(<var>d</var>)</algorithm>
</funcdef>

<funcdef><name id="f-hrCanFragMap">hourCanonicalFragmentMap</name>
<nt def="nt-hrFrag"/><limits>matches <nt def="nt-hrFrag"/></limits>
<args><arg><var>h</var><limits>an &integer; between 0 and 23 inclusive.</limits></arg></args>
<summary>Maps an &integer;, presumably the <pfref ref="vp-dt-hour"/> property of a <dtref ref="dt-dt-7PropMod"/> value,
onto a <nt def="nt-hrFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>.</summary>
<algorithm>Return <pfref ref="f-unsTwoDigCanFragMap"/>(<var>h</var>)</algorithm>
</funcdef>

<funcdef><name id="f-miCanFragMap">minuteCanonicalFragmentMap</name>
<nt def="nt-miFrag"/><limits>matches <nt def="nt-miFrag"/></limits>
<args><arg><var>m</var><limits>an &integer; between 0 and 59 inclusive.</limits></arg></args>
<summary>Maps an &integer;, presumably the <pfref ref="vp-dt-minute"/> property of a <dtref ref="dt-dt-7PropMod"/> value,
onto a <nt def="nt-miFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>.</summary>
<algorithm>Return <pfref ref="f-unsTwoDigCanFragMap"/>(<var>m</var>)</algorithm>
</funcdef>

<funcdef><name id="f-secCanFragMap">secondCanonicalFragmentMap</name>
<nt def="nt-seFrag"/><limits>matches <nt def="nt-seFrag"/></limits>
<args><arg><var>s</var><limits>a nonnegative &decimal; less than 70</limits></arg></args>
<summary>Maps a &decimal;, presumably the <pfref ref="vp-dt-second"/> property of a <dtref ref="dt-dt-7PropMod"/> value,
onto a <nt def="nt-seFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>.</summary>
<algorithm>Return
<ulist><item><p><pfref ref="f-unsTwoDigCanFragMap"/>(<var>s</var>)&emsp; 
when <var>s</var> is an integer, and</p></item>
<item><p><pfref ref="f-unsTwoDigCanFragMap"/>(<var>s</var><termref def="dt-div"></termref>1)&nbsp;&concat;
<string>.</string>&nbsp;&concat; <pfref ref="f-fracDigitsMap"/>(<var>s</var><termref def="dt-mod"></termref>1)&emsp; 
otherwise.</p></item>
</ulist></algorithm>
</funcdef>

<funcdef><name id="f-tzCanFragMap">timezoneCanonicalFragmentMap</name>
<nt def="nt-tzFrag"/><limits>matches <nt def="nt-tzFrag"/></limits>
<args><arg><var>t</var><limits>an &integer; between &minus;840 and 840 inclusive</limits></arg></args>
<summary>Maps an &integer;, presumably the <pfref ref="vp-dt-timezone"/> property of a <dtref ref="dt-dt-7PropMod"/> value,
onto a <nt def="nt-tzFrag"/>, part of a <dtref ref="dt-dt-7PropMod"/>&apos;s <termref def="dt-lexical-representation"></termref>.</summary>
<algorithm>Return<ulist>
<item><p><string>Z</string>&emsp; when <var>t</var> is zero,</p></item>
<item><p><string>-</string>&nbsp;&concat;&nbsp;<pfref ref="f-unsTwoDigCanFragMap"/>(&minus;<var>t</var>&nbsp;<termref def="dt-div"></termref>&nbsp;60)&nbsp;&concat;
<string>:</string>&nbsp;&concat;
<pfref ref="f-unsTwoDigCanFragMap"/>(&minus;<var>t</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;60)&emsp; when
<var>t</var> is negative, and</p></item>
<item><p><string>+</string>&nbsp;&concat;&nbsp;<pfref ref="f-unsTwoDigCanFragMap"/>(<var>t</var>&nbsp;<termref def="dt-div"></termref>&nbsp;60)&nbsp;&concat;
<string>:</string>&nbsp;&concat;
<pfref ref="f-unsTwoDigCanFragMap"/>(<var>t</var>&nbsp;<termref def="dt-mod"></termref>&nbsp;60)&emsp; otherwise.</p></item>
</ulist></algorithm>
</funcdef>
</defset>

<defset id="defs-gDayCanmap"><head>Canonical Mapping</head>
<funcdef><name id="vp-gDayCanRep">gDayCanonicalRep</name>
<nt def="nt-gDayRep"/><limits>matches <nt def="nt-gDayRep"/></limits>
<args><arg><var>gD</var><limits>a complete <dtref ref="gDay"/> value</limits></arg></args>
<summary>Maps a <dtref ref="gDay"/> value to a <nt def="nt-gDayRep"/>.</summary>
<algorithm>Return
<ulist>
<item><p><string>---</string>&nbsp;&concat; <pfref ref="f-daCanFragMap"/>(<pfref ref="vp-dt-day"/>)&emsp;
when <pfref ref="vp-dt-timezone"/> is <pt>absent</pt>, and</p></item>
<item><p><string>---</string>&nbsp;&concat; <pfref ref="f-daCanFragMap"/>(<pfref ref="vp-dt-rawDay"/>(<var>gD</var>))&nbsp;&concat;
<pfref ref="f-tzCanFragMap"/>(<pfref ref="vp-dt-timezone"/>)&emsp; otherwise.</p></item>
</ulist></algorithm></funcdef>
</defset>

</div2>
</div1>

<!-- ********************************** END NEW 1.1 MATERIAL (FUNCTIONS) ************************************* -->

<div1 role="1.0">
<head>Datatypes and Facets</head>
<div2 role="1.0" id="app-fundamental-facets">
<head>Fundamental Facets</head>
<p>
The following table shows the values of the fundamental facets
for each <termref def="dt-built-in"/> datatype.
</p>
<fundamental-facets/>
</div2>
</div1>
<div1 role="1.0" id="isoformats">
<head>ISO 8601 Date and Time Formats</head>

<ednote><edtext>It is likely that this Appendix will be deleted once all date/time datatype descriptions are
written to the new format using the seven-property model, as illustrated in <specref ref="gDay"/>.</edtext></ednote>

<div2 role="1.0" id="formatdetails">
<head>ISO 8601 Conventions</head>
<p>
The <termref def="dt-primitive"/> datatypes
<dtref ref="duration"/>, <dtref ref="dateTime"/>, <dtref ref="time"/>,
<dtref ref="date"/>, <dtref ref="gYearMonth"/>,  <dtref ref="gMonthDay"/>,
<dtref ref="gDay"/>, <dtref ref="gMonth"/> and <dtref ref="gYear"/>
use lexical formats inspired by
<bibref ref="ISO8601"/>.
Following <bibref ref="ISO8601"/>, the lexical forms of
these datatypes can include only the characters #20 through #7F.
This appendix provides more detail on the ISO
formats and discusses some deviations from them for the datatypes
defined in this specification.
</p>
<p>
<bibref ref="ISO8601"/> "specifies the representation of dates in the
proleptic Gregorian calendar and times and representations of periods of time".
The proleptic Gregorian calendar includes dates prior to 1582 (the year it came
into use as an ecclesiastical calendar).
It should be pointed out that the datatypes described in this
specification do not cover all the types of data covered by
<bibref ref="ISO8601"/>, nor do they support all the lexical
representations for those types of data.
</p>
<p>
<bibref ref="ISO8601"/> lexical formats are described using "pictures"
in which characters are used in place of decimal digits.
The allowed decimal digits are (#x30-#x39).
For the primitive datatypes
<dtref ref="dateTime"/>, <dtref ref="time"/>,
<dtref ref="date"/>, <dtref ref="gYearMonth"/>,  <dtref ref="gMonthDay"/>,
<dtref ref="gDay"/>, <dtref ref="gMonth"/> and <dtref ref="gYear"/>.
these characters have the following meanings:
</p>
<ulist>
<item>
<p>
C -- represents a digit used in the thousands and hundreds components,
the "century" component, of the time element "year". Legal values are
from 0 to 9.
</p>
</item>
<item>
<p>
Y -- represents a digit used in the tens and units components of the time
element "year".&nbsp; Legal values are from 0 to 9.
</p>
</item>
<item>
<p>
M -- represents a digit used in the time element "month".&nbsp; The two
digits in a MM format can have values from 1 to 12.
</p>
</item>
<item>
<p>
D -- represents a digit used in the time element "day". The two digits
in a DD format can have values from 1 to 28 if the month value equals 2,
1 to 29 if the month value equals 2 and the year is a leap year, 1 to 30
if the month value equals 4, 6, 9 or 11, and 1 to 31 if the month value
equals 1, 3, 5, 7, 8, 10 or 12.
</p>
</item>
<item>
<p>
h -- represents a digit used in the time element "hour". The two digits
in a hh format can have values from 0 to
24.

If the value of the hour element is 24 then the values of the minutes
element and the seconds element must be 00 and 00.

</p>
</item>
<item>
<p>
m -- represents a digit used in the time element "minute". The two digits
in a mm format can have values from 0 to 59.
</p>
</item>
<item>
<p>
s -- represents a digit used in the time element "second".&nbsp; The two
digits in a ss format can have values from 0 to 60.&nbsp; In the formats
described in this specification the whole number of seconds <termref def="dt-may"/>
be followed by decimal seconds to an arbitrary level of precision.
This is represented in the picture by "ss.sss".&nbsp; A value of 60 or more is
allowed only in the case of leap seconds.&nbsp; </p>
<p>Strictly speaking, a value of
60 or more is not sensible unless the month and day could
represent March 31, June 30, September 30, or December 31 <emph>in <termref def="dt-utc"></termref></emph>.
Because the leap second is added or subtracted as the last second of the day
in <termref def="dt-utc"></termref> time, the long (or short) minute could occur at other times in local
time.&nbsp; In cases where the leap second is used with an inappropriate month
and day it, and any fractional seconds, should considered as added or
subtracted from the following minute.
</p>
</item>
</ulist>
<p>
For all the information items indicated by the above characters, leading
zeros are required where indicated.
</p>
<p>
In addition to the above, certain characters are used as designators
and appear as themselves in lexical formats.
</p>
<ulist>
<item>
<p>
T -- is used as time designator to indicate the start of the
representation of the time of day in <dtref ref="dateTime"/>.
</p>
</item>
<item>
<p>
Z -- is used as time-zone designator, immediately (without a space)
following a data element expressing the time of day in Coordinated
Universal Time (<termref def="dt-utc"></termref>) in
<dtref ref="dateTime"/>, <dtref ref="time"/>,
<dtref ref="date"/>, <dtref ref="gYearMonth"/>,  <dtref ref="gMonthDay"/>,
<dtref ref="gDay"/>, <dtref ref="gMonth"/>, and <dtref ref="gYear"/>.
</p>
</item>
</ulist>
<p>In the lexical format for <dtref ref="duration"/> the following
characters are also used as designators and appear as themselves in
lexical formats:</p>
<ulist>
<item>
<p>P -- is used as the time duration designator, preceding a data element
representing a given duration of time.</p>
</item>
<item>
<p>Y -- follows the number of years in a time duration.</p></item>
<item><p>M -- follows the number of months or minutes in a time duration.</p></item>
<item><p>D -- follows the number of days in a time duration.</p></item>
<item><p>H -- follows the number of hours in a time duration.</p></item>
<item><p>S -- follows the number of seconds in a time duration.</p></item>
</ulist>
<p>
The values of the
Year, Month, Day, Hour and Minutes components are not restricted but
allow an arbitrary integer.&nbsp; Similarly, the value of the Seconds component
allows an arbitrary decimal.&nbsp; Thus, the lexical format for
<dtref ref="duration"/> and datatypes derived from it
does not follow the alternative
format of &sect; 5.5.3.2.1 of <bibref ref="ISO8601"/>.</p>
</div2>
<div2 role="1.0" id="truncatedformats">
<head>Truncated and Reduced Formats</head>
<p>
<bibref ref="ISO8601"/> supports a variety of "truncated" formats in
which some of the characters on the left of specific formats, for example,
the
century, can be omitted.
Truncated formats are, in
general, not permitted for the datatypes defined in this specification
with three exceptions.&nbsp; The <dtref ref="time"/> datatype uses
a truncated format for <dtref ref="dateTime"/>
which represents an instant of time that recurs every day.
Similarly, the <dtref ref="gMonthDay"/> and <dtref ref="gDay"/>
datatypes use left-truncated formats for <dtref ref="date"/>.
The datatype <dtref ref="gMonth"/> uses a right and left truncated format for
<dtref ref="date"/>.
</p>
<p>
<bibref ref="ISO8601"/> also supports a variety of "reduced" or right-truncated
formats in which some of the characters to the right of specific formats,
such as the
time specification, can be omitted.&nbsp; Right truncated formats are also, in
general,
not permitted for the datatypes defined in this specification
with the following exceptions:
right-truncated representations of <dtref ref="dateTime"/> are used as
lexical representations for <dtref ref="date"/>,  <dtref ref="gMonth"/>,
<dtref ref="gYear"/>.
</p>
</div2>
<div2 role="1.0" id="deviantformats">
<head>Deviations from ISO 8601 Formats</head>
<div3 role="1.0" id="signallowed">
<head>Sign Allowed</head>
<p>
An optional minus sign is allowed immediately preceding, without a space,
the lexical representations for <dtref ref="duration"/>, <dtref ref="dateTime"/>,
<dtref ref="date"/>, <dtref ref="gYearMonth"/>, <dtref ref="gYear"/>.
</p>
</div3>
<div3 role="1.0" id="noYearZero">
<head>No Year Zero</head>
<p>
The year "0000" is an illegal year value.
</p>
</div3>
<div3 role="1.0" id="morethan9999years">
<head>More Than 9999 Years</head>
<p>
To accommodate year values greater than 9999, more than four digits are
allowed in the year representations of <dtref ref="dateTime"/>,
<dtref ref="date"/>, <dtref ref="gYearMonth"/>, and <dtref ref="gYear"/>.
This follows
<bibref ref="ISO8601-2000"/>.
</p>
</div3>
<div3 role="1.0" id="timeZonePermited">
<head>Time zone permitted</head>
<p>
The lexical representations for the datatypes <dtref ref="date"/>,
<dtref ref="gYearMonth"/>, <dtref ref="gMonthDay"/>, <dtref ref="gDay"/>,
<dtref ref="gMonth"/> and <dtref ref="gYear"/> permit an optional
trailing time zone specificiation.
</p>
</div3>
</div2>
</div1>

<div1 role="1.0" id="adding-durations-to-dateTimes">
<head>Adding durations to dateTimes</head>

<ednote><edtext>It is expected that this Appendix will be replaced by a short function definition building
upon those already defined herein, which will be placed with the other function definitions in <specref ref="ap-funcDefs"/> and referenced
in <specref ref="duration"/>.</edtext></ednote>

<p>
Given a <dtref ref="dateTime"/> S and a <dtref ref="duration"/> D, this
appendix specifies how to compute a <dtref ref="dateTime"/> E where E is the
end of the time period with start S and duration D i.e. E = S + D.&nbsp; Such
computations are used, for example, to determine whether a <dtref ref="dateTime"/>
is within a specific time period. This appendix also addresses the addition of
<dtref ref="duration"/>s to the datatypes <dtref ref="date"/>,
<dtref ref="gYearMonth"/>, <dtref ref="gYear"/>, <dtref ref="gDay"/> and
<dtref ref="gMonth"/>, which can be viewed as a set of <dtref ref="dateTime"/>s.
In such cases, the addition is made to the first or starting
<dtref ref="dateTime"/> in the set.
</p>
<p>
<emph>This is a logical explanation of the process.
Actual implementations are free to optimize as long as they produce the same
results. </emph> The calculation uses the notation S[year] to represent the year
field of S, S[month] to represent the month field, and so on. It also depends on
the following functions:</p>
<ulist>
     <item><p>
     	fQuotient(a, b) = the greatest integer less than or equal to a/b
          <ulist>
          <item><p>fQuotient(-1,3) = -1</p> </item>
          <item><p>fQuotient(0,3)...fQuotient(2,3) = 0</p></item>
          <item><p>fQuotient(3,3) = 1</p></item>
          <item><p>fQuotient(3.123,3) = 1</p></item>
          </ulist>
     </p>
     </item>
     <item><p>
     	modulo(a, b) = a - fQuotient(a,b)*b
          <ulist>
          <item><p>modulo(-1,3) = 2</p></item>
          <item><p>modulo(0,3)...modulo(2,3) = 0...2</p></item>
          <item><p>modulo(3,3) = 0</p></item>
          <item><p>modulo(3.123,3) = 0.123</p></item>
          </ulist>
     </p>
     </item>
     <item><p>
     	fQuotient(a, low, high) = fQuotient(a - low, high - low)
          <ulist>
          <item><p>fQuotient(0, 1, 13) = -1</p></item>
          <item><p>fQuotient(1, 1, 13) ... fQuotient(12, 1, 13) = 0</p></item>
          <item><p>fQuotient(13, 1, 13) = 1</p></item>
          <item><p>fQuotient(13.123, 1, 13) = 1</p></item>
          </ulist>
     </p>
     </item>
     <item><p>
     	modulo(a, low, high) = modulo(a - low, high - low) + low
          <ulist>
          <item><p>modulo(0, 1, 13) = 12</p></item>
          <item><p>modulo(1, 1, 13) ...&nbsp; modulo(12, 1, 13) = 1...12 </p></item>
          <item><p>modulo(13, 1, 13) = 1</p></item>
          <item><p>modulo(13.123, 1, 13) = 1.123</p></item>
          </ulist>
     </p>
     </item>
     <item><p>
     	maximumDayInMonthFor(yearValue, monthValue) =
          <ulist>
          <item><p>M := modulo(monthValue, 1, 13)</p></item>
          <item><p>Y := yearValue + fQuotient(monthValue, 1, 13)</p></item>
          <item><p>Return a value based on M and Y:</p></item>
          </ulist>
     </p>
     </item>
</ulist>

<p></p>
    <table border="1">
	<tbody>
      <tr>
        <td style="background-color:#FFFF99"><strong>31</strong></td>
        <td colspan="2">M = January, March, May, July, August, October, or
          December</td>
      </tr>
      <tr>
        <td style="background-color:#FFFF99"><strong>30</strong></td>
        <td colspan="2">M = April, June, September, or November</td>
      </tr>
      <tr>
        <td style="background-color:#FFFF99"><strong>29</strong></td>
        <td>M = February AND (modulo(Y, 400) = 0 OR
          (modulo(Y, 100) != 0) AND modulo(Y, 4) = 0)</td>
      </tr>
      <tr>
        <td style="background-color:#FFFF99"><strong>28</strong></td>
        <td>Otherwise</td>
      </tr>
	</tbody>
    </table>
<p></p>
<div2 role="1.0">
<head>Algorithm</head>
<p>
Essentially, this calculation is equivalent to separating D into &lt;year,month&gt;
and &lt;day,hour,minute,second&gt; fields. The &lt;year,month&gt; is added to S.
If the day is out of range, it is <emph>pinned</emph> to be within range. Thus April
31 turns into April 30. Then the &lt;day,hour,minute,second&gt; is added. This
latter addition can cause the year and month to change.
</p>
<p>
Leap seconds are handled by the computation by treating them as overflows.
Essentially, a value of 60
seconds in S is treated as if it were a duration of 60 seconds added to S
(with a zero seconds field). All calculations
thereafter use 60 seconds per minute.
</p>
<p>
Thus the addition of either PT1M or PT60S to any dateTime will always
produce the same result. This is a special definition of addition which
is designed to match common practice, and -- most importantly -- be stable
over time.
</p>
<p>
A definition that attempted to take leap-seconds into account would need to
be constantly updated, and could not predict the results of future
implementation's additions. The decision to introduce a leap second in <termref def="dt-utc"></termref>
is the responsibility of the <bibref ref="IERS"/>. They make periodic
announcements as to when
leap seconds are to be added, but this is not known more than a year in
advance. For more information on leap seconds, see <bibref ref="USNavy"/>.
</p>
<p>
The following is the precise specification. These steps must be followed in
the same order. If a field in D is not specified, it is treated as if it were
zero. If a field in S is not specified, it is treated in the calculation as if
it were the minimum allowed value in that field, however, after the calculation
is concluded, the corresponding field in E is removed (set to unspecified).
</p>
<ulist>
  <item><p><emph>Months (may be modified additionally below)</emph>
    <ulist>
      <item><p>temp := S[month] + D[month]</p></item>
      <item><p>E[month] := modulo(temp, 1, 13)</p></item>
      <item><p>carry := fQuotient(temp, 1, 13)</p></item>
    </ulist>
  </p>
  </item>
  <item><p><emph>Years (may be modified additionally below)</emph>
    <ulist>
      <item><p>E[year] := S[year] + D[year] + carry</p></item>
    </ulist>
  </p>
  </item>
  <item><p><emph>Zone</emph>
    <ulist>
      <item><p>E[zone] := S[zone]</p></item>
    </ulist>
  </p>
  </item>
  <item><p><emph>Seconds</emph>
    <ulist>
      <item><p>temp := S[second] + D[second]</p></item>
      <item><p>E[second] := modulo(temp, 60)</p></item>
      <item><p>carry := fQuotient(temp, 60)</p></item>
    </ulist>
  </p>
  </item>
  <item><p><emph>Minutes</emph>
    <ulist>
      <item><p>temp := S[minute] + D[minute] + carry</p></item>
      <item><p>E[minute] := modulo(temp, 60)</p></item>
      <item><p>carry := fQuotient(temp, 60)</p></item>
    </ulist>
  </p>
  </item>
  <item><p><emph>Hours</emph>
    <ulist>
      <item><p>temp := S[hour] + D[hour] + carry</p></item>
      <item><p>E[hour] := modulo(temp, 24)</p></item>
      <item><p>carry := fQuotient(temp, 24)</p></item>
    </ulist>
  </p>
  </item>
  <item><p><emph>Days</emph>
    <ulist>
      <item><p>if S[day] &gt; maximumDayInMonthFor(E[year], E[month])
        <ulist>
          <item><p>tempDays := maximumDayInMonthFor(E[year], E[month])</p></item>
        </ulist>
      </p>
      </item>
      <item><p>else if S[day] &lt; 1
        <ulist>
          <item><p>tempDays := 1</p></item>
        </ulist>
	  </p>
      </item>
      <item><p>else
        <ulist>
          <item><p>tempDays := S[day]</p></item>
        </ulist>
      </p>
      </item>
      <item><p>E[day] := tempDays + D[day] + carry</p></item>
      <item><p><term>START LOOP</term>
        <ulist>
          <item><p><term>IF </term>E[day] &lt; 1
            <ulist>
              <item><p>E[day] := E[day] + maximumDayInMonthFor(E[year], E[month] - 1)</p></item>
              <item><p>carry := -1</p></item>
            </ulist>
          </p>
          </item>
          <item><p><term>ELSE IF </term>E[day] &gt; maximumDayInMonthFor(E[year], E[month])
            <ulist>
              <item><p>E[day] := E[day] - maximumDayInMonthFor(E[year], E[month])</p></item>
              <item><p>carry := 1</p></item>
            </ulist>
          </p>
          </item>
          <item><p><term>ELSE EXIT LOOP</term></p></item>
          <item><p>temp := E[month] + carry</p></item>
          <item><p>E[month] := modulo(temp, 1, 13)</p></item>
          <item><p>E[year] := E[year] + fQuotient(temp, 1, 13)</p></item>
          <item><p><term>GOTO START LOOP</term></p></item>
        </ulist>
      </p>
      </item>
    </ulist>
  </p>
  </item>
</ulist>
<p><emph>Examples:</emph></p>
    <table border="1" cellspacing="0" cellpadding="4">
	<tbody>
      <tr>
        <th align="center" style="background-color: #FFFF99">dateTime</th>
        <th align="center" style="background-color: #FFFF99">duration</th>
        <th align="center" style="background-color: #FFFF99">result</th>
      </tr>
      <tr>
        <td align="center">2000-01-12T12:13:14Z</td>
        <td align="center">P1Y3M5DT7H10M3.3S</td>
        <td align="center">2001-04-17T19:23:17.3Z</td>
      </tr>
      <tr>
        <td align="center">2000-01</td>
        <td align="center">-P3M</td>
        <td align="center">1999-10</td>
      </tr>
      <tr>
        <td align="center">2000-01-12</td>
        <td align="center">PT33H</td>
        <td align="center">2000-01-13</td>
      </tr>
	</tbody>
    </table>
  </div2>
<div2 role="1.0" id="adding-durations-to-instants-commutativity-associativity">
<head>Commutativity and Associativity</head>
<p>
Time durations are added by simply adding each of their fields, respectively,
without overflow.
</p>
<p>
The order of addition of durations to instants <emph>is</emph> significant.
For example, there are cases where:
</p>
<p>((dateTime + duration1) + duration2) != ((dateTime +
duration2) + duration1)</p>
<p><emph>Example:</emph></p>
<p>(2000-03-30 + P1D) + P1M = 2000-03-31 + P1M = 2000-<strong>04-30</strong></p>
<p>(2000-03-30 + P1M) + P1D = 2000-04-30 + P1D = 2000-<strong>05-01</strong></p>
</div2>
</div1>

<div1 role="1.0" id="regexs">
<head>Regular Expressions</head>
<p>
A <termref def="dt-regex"/>&nbsp;<emph>R</emph> is a sequence of
characters that denote a <strong>set of strings</strong>&nbsp; <emph>L(R)</emph>.
When used to constrain a <termref def="dt-lexical-space"/>, a
<term>regular expression</term>&nbsp; <emph>R</emph> asserts that only strings
in <emph>L(R)</emph> are valid literals for values of that type.
</p>
<note role="forceNote">
<p>
Unlike some popular regular expression languages (including those
    defined by Perl and standard Unix utilities), the regular
    expression language defined here implicitly anchors all regular
    expressions at the head and tail, as the most common use of
    regular expressions in <termref def="dt-pattern"/> is to match entire literals.
For example, a datatype <termref def="dt-derived"/> from <dtref ref="string"/> such
that all values must begin with the character <code>A</code> (#x41) and end with the character
<code>Z</code> (#x5a) would be defined as follows:
</p>
<eg xml:space="preserve">&lt;simpleType name='myString'>
 &lt;restriction base='string'>
  &lt;pattern value='A.*Z'/>
 &lt;/restriction>
&lt;/simpleType></eg>
<p>
In regular expression languages that are not implicitly anchored at the head and tail,
it is customary to write the equivalent regular expression as:
</p>
<p>
&nbsp;&nbsp;&nbsp;<code>^A.*Z$</code>
</p>
<p>
where "^" anchors the pattern at the head and "$" anchors at the tail.
</p>
 <p>In those rare cases where an unanchored match is desired, including
<code>.*</code> at the beginning and ending of the regular expression will
achieve the desired results. For example, a datatype <termref def="dt-derived"/> from string such that all values must contain at least 3 consecutive <code>A</code> (<code>#x41</code>) characters somewhere within the value could be defined as follows:</p>
 <eg xml:space="preserve">&lt;simpleType name='myString'>
 &lt;restriction base='string'>
  &lt;pattern value='.*AAA.*'/>
 &lt;/restriction>
&lt;/simpleType></eg>
</note>

<p>
<termdef id="dt-regex" term="regular expression">A
<term>regular expression</term> is composed from zero or more
<termref def="dt-branch"/>es, separated by <code>|</code> characters.
</termdef>
</p>
<scrap>
	<head>Regular Expression</head>
	<prod id="regex">
		<lhs id="nt-regExp">regExp</lhs>
		<rhs>
			<nt def="nt-branch"/>
			( '|' <nt def="nt-branch"/> )*
		</rhs>
	</prod>
</scrap>
<p/>
<table border="1">
<col width="50%"/>
<col width="50%"/>
<thead>
<tr>
<th>
For all <termref def="dt-branch"/>es <emph>S</emph>, and for all
<termref def="dt-regex"/>s <emph>T</emph>, valid
<termref def="dt-regex"/>s <emph>R</emph> are:
</th>
<th>
Denoting the set of strings <emph>L(R)</emph> containing:
</th>
</tr>
</thead>
<tbody>
<tr>
  <td align="center">(empty string)</td>
  <td align="center">the set containing just the empty string
</td>
</tr>
<tr>
  <td align="center"><emph>S</emph></td>
  <td align="center">all strings in <emph>L(S)</emph></td>
</tr>
<tr>
  <td align="center"><emph>S</emph>|<emph>T</emph></td>
  <td align="center">all strings in <emph>L(S)</emph> and
  all strings in <emph>L(T)</emph></td>
</tr>
</tbody>
</table>

<p>
<termdef id="dt-branch" term="branch" role="local">
A <term>branch</term> consists
of zero or more <termref def="dt-piece"/>s, concatenated together.
</termdef>
</p>
<scrap>
	<head>Branch</head>
	<prod id="branch">
		<lhs id="nt-branch">branch</lhs>
		<rhs><nt def="nt-piece"/>*</rhs>
	</prod>
</scrap>
<p/>
<table border="1">
<col width="50%"/>
<col width="50%"/>
<thead>
<tr>
<th>
For all <termref def="dt-piece"/>s <emph>S</emph>, and for all
<termref def="dt-branch"/>es <emph>T</emph>, valid
<termref def="dt-branch"/>es <emph>R</emph> are:
</th>
<th>
Denoting the set of strings <emph>L(R)</emph> containing:
</th>
</tr>
</thead>
<tbody>
<tr>
  <td align="center"><emph>S</emph></td>
  <td align="center">all strings in <emph>L(S)</emph></td>
</tr>
<tr>
  <td align="center"><emph>S</emph><emph>T</emph></td>
  <td align="center">all strings <emph>st</emph> with <emph>s</emph> in
  <emph>L(S)</emph> and <emph>t</emph> in <emph>L(T)</emph></td>
</tr>
</tbody>
</table>

<p>
<termdef id="dt-piece" term="piece" role="local">
A <term>piece</term> is an
<termref def="dt-atom"/>, possibly followed by a
<termref def="dt-quantifier"/>.
</termdef>
</p>

<scrap>
	<head>Piece</head>
	<prod id="piece">
		<lhs id="nt-piece">piece</lhs>
		<rhs><nt def="nt-atom"/>&nbsp;<nt def="nt-quantifier"/>?</rhs>
	</prod>
</scrap>
<p/>
<table border="1">
<col width="50%"/>
<col width="50%"/>
<thead>
<tr>
<th>
For all <termref def="dt-atom"/>s <emph>S</emph> and non-negative
integers <emph role="eq">n</emph>, <emph role="eq">m</emph> such that
<emph role="eq">n &lt;= m</emph>, valid <termref def="dt-piece"/>s
<emph>R</emph> are:
</th>
<th>
Denoting the set of strings <emph>L(R)</emph> containing:
</th>
</tr>
</thead>
<tbody>
<tr>
  <td align="center"><emph>S</emph></td>
  <td align="center">all strings in <emph>L(S)</emph></td>
</tr>
<tr>
  <td align="center"><emph>S</emph>?</td>
  <td align="center">the empty string, and all strings in
  <emph>L(S)</emph>.</td>
</tr>
<tr>
  <td align="center"><emph>S</emph>*</td>
  <td align="center">
  All strings in <emph>L(S?)</emph> and all strings <emph>st</emph>
  with <emph>s</emph> in <emph>L(S*)</emph>
  and <emph>t</emph> in <emph>L(S)</emph>. <emph>( all concatenations
  of zero or more strings from L(S) )</emph>
  </td>
</tr>
<tr>
  <td align="center"><emph>S</emph>+</td>
  <td align="center">
  All strings <emph>st</emph> with <emph>s</emph> in <emph>L(S)</emph>
  and <emph>t</emph> in <emph>L(S*)</emph>.&nbsp; <emph>( all concatenations
  of one or more strings from L(S) )</emph>
  </td>
</tr>
<tr>
  <td align="center"><emph>S</emph>{n,m}</td>
  <td align="center">
  All strings <emph>st</emph> with <emph>s</emph> in <emph>L(S)</emph>
  and <emph>t</emph> in <emph>L(S{n-1,m-1})</emph>.&nbsp; <emph>( All
sequences of at least n, and at most m, strings from L(S) )</emph>
  </td>
</tr>
<tr>
  <td align="center"><emph>S</emph>{n}</td>
  <td align="center">
  All strings in <emph>L(S{n,n})</emph>.&nbsp; <emph>( All
sequences of exactly n strings from L(S) )</emph>
  </td>
</tr>
<tr>
  <td align="center"><emph>S</emph>{n,}</td>
  <td align="center">
  All strings in L(S{n}S*)  <emph>( All
sequences of at least n, strings from L(S) )</emph>
  </td>
</tr>
<tr>
  <td align="center"><emph>S</emph>{0,m}</td>
  <td align="center">
  All strings <emph>st</emph> with <emph>s</emph> in <emph>L(S?)</emph>
  and <emph>t</emph> in <emph>L(S{0,m-1})</emph>.&nbsp; <emph>( All
sequences of at most m, strings from L(S) )</emph>
  </td>
</tr>
<tr>
  <td align="center"><emph>S</emph>{0,0}</td>
  <td align="center">
  The set containing only the empty string
  </td>
</tr>
</tbody>
</table>
<note>
<p>
The regular expression language in the Perl Programming Language
<bibref ref="Perl"/> does not include a quantifier of the form
<code>S{,m}</code>, since it is logically equivalent to <code>S{0,m}</code>.
We have, therefore, left this logical possibility out of the regular
expression language defined by this specification.

</p>
</note>
<p>
<termdef id="dt-quantifier" term="quantifier" role="local">
A <term>quantifier</term>
is one of <code>?</code>, <code>*</code>, <code>+</code>,
<code>{n,m}</code> or <code>{n,}</code>, which have the meanings
defined in the table above.
</termdef>
</p>
<scrap>
	<head>Quanitifer</head>
	<prod id="quant">
		<lhs id="nt-quantifier">quantifier</lhs>
		<rhs>[?*+] | ( '{' <nt def="nt-quantity"/> '}' )</rhs>
	</prod>
	<prod id="quantity">
		<lhs id="nt-quantity">quantity</lhs>
		<rhs><nt def="nt-quantRange"/> |
			<nt def="nt-quantMin"/> | <nt def="nt-QuantExact"/></rhs>
	</prod>
	<prod id="quantRange">
		<lhs id="nt-quantRange">quantRange</lhs>
		<rhs><nt def="nt-QuantExact"/> ',' <nt def="nt-QuantExact"/></rhs>
	</prod>
	<prod id="quantMin">
		<lhs id="nt-quantMin">quantMin</lhs>
		<rhs><nt def="nt-QuantExact"/> ','</rhs>
	</prod>
	<prod id="quantExact">
		<lhs id="nt-QuantExact">QuantExact</lhs>
		<rhs>[0-9]+</rhs>
	</prod>
</scrap>
<p>
<termdef id="dt-atom" term="atom" role="local">
An <term>atom</term> is either a
<termref def="dt-normalc"/>, a <termref def="dt-charclass"/>, or
a parenthesized <termref def="dt-regex"/>.</termdef>
</p>

<scrap>
	<head>Atom</head>
	<prod id="atom">
		<lhs id="nt-atom">atom</lhs>
		<rhs><nt def="nt-Char"/> |
			<nt def="nt-charClass"/> | ( '('
			<nt def="nt-regExp"/> ')' )</rhs>
	</prod>
</scrap>
<p/>
<table border="1">
<col width="50%"/>
<col width="50%"/>
<thead>
<tr>
<th>
For all <termref def="dt-normalc"/>s <emph>c</emph>,
<termref def="dt-charclass"/>es <emph>C</emph>, and
<termref def="dt-regex"/>s <emph>S</emph>, valid
<termref def="dt-atom"/>s <emph>R</emph> are:
</th>
<th>
Denoting the set of strings <emph>L(R)</emph> containing:
</th>
</tr>
</thead>
<tbody>
<tr>
  <td align="center"><emph>c</emph></td>
  <td align="center">the single string consisting only of <emph>c</emph></td>
</tr>
<tr>
  <td align="center"><emph>C</emph></td>
  <td align="center">all strings in <emph>L(C)</emph></td>
</tr>
<tr>
  <td align="center">(<emph>S</emph>)</td>
  <td align="center">all strings in <emph>L(S)</emph></td>
</tr>
</tbody>
</table>

<p>
<termdef id="dt-metac" term="metacharacter" role="local">
A <term>metacharacter</term>
is either <code>.</code>, <code>\</code>, <code>?</code>,
<code>*</code>, <code>+</code>, <code>{</code>, <code>}</code>
<code>(</code>, <code>)</code>, <code>[</code> or <code>]</code>.
These characters have special meanings in <termref def="dt-regex"/>s,
but can be escaped to form <termref def="dt-atom"/>s that denote the
sets of strings containing only themselves, i.e., an escaped
<termref def="dt-metac"/> behaves like a <termref def="dt-normalc"/>.
</termdef>
</p>

<p>
<termdef id="dt-normalc" term="normal character" role="local">
A
<term>normal character</term> is any XML character that is not a
metacharacter.&nbsp; In <termref def="dt-regex"/>s, a normal character is an
atom that denotes the singleton set of strings containing only itself.
</termdef>
</p>
<scrap>
	<head>Normal Character</head>
	<prod id="char">
		<lhs id="nt-Char">Char</lhs>
		<rhs>[^.\?*+()|#x5B#x5D]</rhs>
	</prod>
</scrap>

<p>
Note that a <termref def="dt-normalc"/> can be represented either as
itself, or with a <xspecref href="&xmlspec;#dt-charref">character
reference</xspecref>.
</p>
<div2 role="1.0" id="charcter-classes">
<head>Character Classes</head>
<p>
<termdef id="dt-charclass" term="character class" role="local">
A
<term>character class</term> is an <termref def="dt-atom"/>
&nbsp;<emph>R</emph> that identifies a <strong>set of characters</strong>
&nbsp;<emph>C(R)</emph>.&nbsp; The set of strings <emph>L(R)</emph> denoted by a
character class <emph>R</emph> contains one single-character string
"<emph>c</emph>" for each character <emph>c</emph> in <emph>C(R)</emph>.
</termdef>
</p>
<scrap>
	<head>Character Class</head>
	<prod id="charClass">
		<lhs id="nt-charClass">charClass</lhs>
		<rhs>
			<nt def="nt-charClassEsc"/> |
			<nt def="nt-charClassExpr"/> |
			<nt def="nt-WildcardEsc"/>
		</rhs>
	</prod>
</scrap>
<p>
A character class is either a <termref def="dt-cces"/> or a
<termref def="dt-charexpr"/>.
</p>

<p>
<termdef id="dt-charexpr" term="character class expression" role="local">
A
<term>character class expression</term> is a <termref def="dt-chargroup"/> surrounded
by <code>[</code> and <code>]</code> characters.&nbsp; For all character
groups <emph>G</emph>, [<emph>G</emph>] is a valid <term>character class
expression</term>, identifying the set of characters
<emph>C</emph>([<emph>G</emph>]) = <emph>C</emph>(<emph>G</emph>).
</termdef>
</p>
<scrap>
	<head>Character Class Expression</head>
	<prod id="charClassExpr">
		<lhs id="nt-charClassExpr">charClassExpr</lhs>
		<rhs>'[' <nt def="nt-charGroup"/> ']'</rhs>
	</prod>
</scrap>
<p>
<termdef id="dt-chargroup" term="character group" role="local">
A
<term>character group</term> is either a <termref def="dt-poschargroup"/>,
a <termref def="dt-negchargroup"/>, or a <termref def="dt-subchargroup"/>.
</termdef>
</p>

<scrap>
	<head>Character Group</head>
	<prod id="chargroup">
		<lhs id="nt-charGroup">charGroup</lhs>
		<rhs>
			<nt def="nt-posCharGroup"/> |
			<nt def="nt-negCharGroup"/> |
			<nt def="nt-charClassSub"/>
		</rhs>
	</prod>
</scrap>
<p>
<termdef id="dt-poschargroup" term="positive character group" role="local">
A <term>positive character group</term> consists of one or more
<termref def="dt-charrange"/>s or <termref def="dt-cces"/>s, concatenated
together.&nbsp; A <term>positive character group</term> identifies the set of
characters containing all of the characters in all of the sets identified
by its constituent ranges or escapes.
</termdef>
</p>

<scrap>
	<head>Positive Character Group</head>
	<prod id="poschargroup">
		<lhs id="nt-posCharGroup">posCharGroup</lhs>
		<rhs>
			(
			<nt def="nt-charRange"/> | <nt def="nt-charClassEsc"/>
			)+
		</rhs>
	</prod>
</scrap>
<p/>
<table border="1">
<col width="50%"/>
<col width="50%"/>
<thead>
<tr>
<th>
For all <termref def="dt-charrange"/>s <emph>R</emph>, all
<termref def="dt-cces"/>s <emph>E</emph>, and all
<termref def="dt-poschargroup"/>s <emph>P</emph>, valid
<termref def="dt-poschargroup"/>s <emph>G</emph> are:
</th>
<th>
Identifying the set of characters <emph>C(G)</emph> containing:
</th>
</tr>
</thead>
<tbody>
<tr>
  <td align="center"><emph>R</emph></td>
  <td align="center">all characters in <emph>C(R)</emph>.</td>
</tr>
<tr>
  <td align="center"><emph>E</emph></td>
  <td align="center">all characters in <emph>C(E)</emph>.</td>
</tr>
<tr>
  <td align="center"><emph>RP</emph></td>
  <td align="center">all characters in <emph>C(R)</emph> and all
  characters in <emph>C(P)</emph>.</td>
</tr>
<tr>
  <td align="center"><emph>EP</emph></td>
  <td align="center">all characters in <emph>C(E)</emph> and all
  characters in <emph>C(P)</emph>.</td>
</tr>
</tbody>
</table>

<p>
<termdef id="dt-negchargroup" term="negative character group" role="local">
A <term>negative character group</term> is a
<termref def="dt-poschargroup"/> preceded by the <code>^</code> character.
For all <termref def="dt-poschargroup"/>s <emph>P</emph>, ^<emph>P</emph>
is a valid <term>negative character group</term>, and <emph>C(^P)</emph>
contains all XML characters that are <emph>not</emph> in <emph>C(P)</emph>.
</termdef>
</p>

<scrap>
	<head>Negative Character Group</head>
	<prod id="negchargroup">
		<lhs id="nt-negCharGroup">negCharGroup</lhs>
		<rhs>'^' <nt def="nt-posCharGroup"/></rhs>
	</prod>
</scrap>
<p>
<termdef id="dt-subchargroup" term="character class subtraction" role="local">
A
<term>character class subtraction</term> is a <termref def="dt-charexpr"/>
subtracted from a <termref def="dt-poschargroup"/> or
<termref def="dt-negchargroup"/>, using the <code>-</code> character.
</termdef>
</p>
<scrap>
	<head>Character Class Subtraction</head>
	<prod id="charclasssub">
		<lhs id="nt-charClassSub">charClassSub</lhs>
		<rhs>
			( <nt def="nt-posCharGroup"/> |
				<nt def="nt-negCharGroup"/> ) '-'
			<nt def="nt-charClassExpr"/>
		</rhs>
	</prod>
</scrap>
<p>
For any <termref def="dt-poschargroup"/> or
<termref def="dt-negchargroup"/>&nbsp;<emph>G</emph>, and any
<termref def="dt-charexpr"/>&nbsp;<emph>C</emph>, <emph>G-C</emph> is a valid
<termref def="dt-subchargroup"/>, identifying the set of all characters in
<emph>C(G)</emph> that are not also in <emph>C(C)</emph>.
</p>

<p>
<termdef id="dt-charrange" term="character range" role="local">
A
<term>character range</term>&nbsp;<emph>R</emph> identifies a set of
characters <emph>C(R)</emph> containing all XML characters with UCS
code points in a specified range.
</termdef>
</p>
<scrap>
	<head>Character Range</head>
	<prod id="charrange">
		<lhs id="nt-charRange">charRange</lhs>
		<rhs>
<!-- pvb
	possible bug in xmlspec.xsl because the deletion marks
	at the end of <rhs> are not showing up in the rendered version

	as of 2003-02-21 I don't think the above comment still holds
  -->
			<nt def="nt-seRange"/> |
			<nt def="nt-XmlChar"/>
			
		</rhs>
	</prod>
	<prod id="serange">
		<lhs id="nt-seRange">seRange</lhs>
		<rhs><nt def="nt-charOrEsc"/> '-' <nt def="nt-charOrEsc"/></rhs>
	</prod>
	
	<prod id="charoresc">
		<lhs id="nt-charOrEsc">charOrEsc</lhs>
		<rhs><nt def="nt-XmlChar"/> | <nt def="nt-SingleCharEsc"/></rhs>
	</prod>
	<prod id="xmlchar">
		<lhs id="nt-XmlChar">XmlChar</lhs>
		<rhs>[^\#x2D#x5B#x5D]</rhs>
	</prod>
	
</scrap>
<p>
A single XML character is a <termref def="dt-charrange"/> that identifies
the set of characters containing only itself.&nbsp; All XML characters are valid
character ranges, except as follows:
</p>
<ulist>
<item>
<p>
The <code>[</code>, <code>]</code>, <code>-</code> and <code>\</code> characters are not
valid character ranges;
</p>
</item>
<item>
<p>
The <code>^</code> character is only valid at the beginning of a
<termref def="dt-poschargroup"/> if it is part of a
<termref def="dt-negchargroup"/>
</p>
</item>
<item>
<p>

</p>
</item>
</ulist>
<p>
A <termref def="dt-charrange"/>&nbsp;<termref def="dt-may"/> also be written
in the form <emph>s-e</emph>, identifying the set that contains all XML characters
with UCS code points greater than or equal to the code point
of <emph>s</emph>, but not greater than the code point of <emph>e</emph>.
</p>
<p>
<emph>s-e</emph> is a valid character range iff:
</p>
<ulist>
<item>
<p>
<emph>s</emph> is a <termref def="dt-cces1"/>, or an XML character;
</p>
</item>
<item>
<p>
<emph>s</emph> is not <code>\</code>
</p>
</item>
<item>
<p>
If s is the first character in a <termref def="dt-charexpr"/>, then
<emph>s</emph> is not <code>^</code>
</p>
</item>
<item>
<p>
<emph>e</emph> is a <termref def="dt-cces1"/>, or an XML character;
</p>
</item>
<item>
<p>
<emph>e</emph> is not <code>\</code> or <code>[</code>; and
</p>
</item>
<item>
<p>
The code point of <emph>e</emph> is greater than or equal to the code
point of <emph>s</emph>;
</p>
</item>
</ulist>
<note>
<p>
The code point of a <termref def="dt-cces1"/> is the code point of the
single character in the set of characters that it identifies.
</p>
</note>
<div3 role="1.0" id="cces">
<head>Character Class Escapes</head>
<p>
<termdef id="dt-cces" term="character class escape" role="local">
A <term>character class escape</term> is a short sequence of characters
that identifies predefined character class.&nbsp; The valid character
class escapes are the <termref def="dt-cces1"/>s, the
<termref def="dt-ccesN"/>s, and the <termref def="dt-ccescat"/>s (including
the <termref def="dt-ccesblock"/>s).
</termdef>
</p>
<scrap>
	<head>Character Class Escape</head>
	<prod id="charclassesc">
		<lhs id="nt-charClassEsc">charClassEsc</lhs>
		<rhs>
			(
			<nt def="nt-SingleCharEsc"/> |
			<nt def="nt-MultiCharEsc"/> |
			<nt def="nt-catEsc"/> |
			<nt def="nt-complEsc"/>
			)
		</rhs>
	</prod>
</scrap>
<p>
<termdef id="dt-cces1" term="single character escape" role="local">
A
<term>single character escape</term> identifies a set containing a only
one character -- usually because that character is difficult or
impossible to write directly into a <termref def="dt-regex"/>.
</termdef>
</p>

<scrap>
	<head>Single Character Escape</head>
	<prod id="singlecharesc">
		<lhs id="nt-SingleCharEsc">SingleCharEsc</lhs>
		<rhs>'\' [nrt\|.?*+(){}#x2D#x5B#x5D#x5E]</rhs>
	</prod>
</scrap>
<p/>
<table border="1">
<col width="50%"/>
<col width="50%"/>
<thead>
<tr>
<th>
The valid <termref def="dt-cces1"/>s are:
</th>
<th>
Identifying the set of characters <emph>C(R)</emph> containing:
</th>
</tr>
</thead>
<tbody>
<tr>
  <td align="center"><code>\n</code></td>
  <td align="center">the newline character (#xA)</td>
</tr>
<tr>
  <td align="center"><code>\r</code></td>
  <td align="center">the return character (#xD)</td>
</tr>
<tr>
  <td align="center"><code>\t</code></td>
  <td align="center">the tab character (#x9)</td>
</tr>
<tr>
  <td align="center"><code>\\</code></td>
  <td align="center">\</td>
</tr>
<tr>
  <td align="center"><code>\|</code></td>
  <td align="center">|</td>
</tr>
<tr>
  <td align="center"><code>\.</code></td>
  <td align="center">.</td>
</tr>
<tr>
  <td align="center"><code>\-</code></td>
  <td align="center">-</td>
</tr>
<tr>
  <td align="center"><code>\^</code></td>
  <td align="center">^</td>
</tr>
<tr>
  <td align="center"><code>\?</code></td>
  <td align="center">?</td>
</tr>
<tr>
  <td align="center"><code>\*</code></td>
  <td align="center">*</td>
</tr>
<tr>
  <td align="center"><code>\+</code></td>
  <td align="center">+</td>
</tr>
<tr>
  <td align="center"><code>\{</code></td>
  <td align="center">{</td>
</tr>
<tr>
  <td align="center"><code>\}</code></td>
  <td align="center">}</td>
</tr>
<tr>
  <td align="center"><code>\(</code></td>
  <td align="center">(</td>
</tr>
<tr>
  <td align="center"><code>\)</code></td>
  <td align="center">)</td>
</tr>
<tr>
  <td align="center"><code>\[</code></td>
  <td align="center">[</td>
</tr>
<tr>
  <td align="center"><code>\]</code></td>
  <td align="center">]</td>
</tr>
</tbody>
</table>
<p>
<termdef id="dt-ccescat" term="category escape" role="local">
<bibref ref="UnicodeDB"/> specifies a number of possible
values for the "General Category" property
and provides mappings from code points to specific character properties.
The set containing all characters that have property <code>X</code>,
can be identified with a <term>category escape</term> <code>\p{X}</code>.
The complement of this set is specified with the
<term>category escape</term> <code>\P{X}</code>.
(<code>[\P{X}]</code> = <code>[^\p{X}]</code>).
</termdef>
</p>
<scrap>
	<head>Category Escape</head>
	<prod id="catesc">
		<lhs id="nt-catEsc">catEsc</lhs>
		<rhs>'\p{' <nt def="nt-charProp"/> '}'</rhs>
	</prod>
	<prod id="complesc">
		<lhs id="nt-complEsc">complEsc</lhs>
		<rhs>'\P{' <nt def="nt-charProp"/> '}'</rhs>
	</prod>
	<prod id="charprop">
		<lhs id="nt-charProp">charProp</lhs>
		<rhs><nt def="nt-IsCategory"/> | <nt def="nt-IsBlock"/></rhs>
	</prod>
</scrap>
<note>
<p>
<bibref ref="UnicodeDB"/> is subject to future revision.&nbsp; For example, the
mapping from code points to character properties might be updated.
All <termref def="dt-minimally-conforming"/> processors <termref def="dt-must"/>
support the character properties defined in the version of <bibref ref="UnicodeDB"/>
that is current at the time this specification became a W3C
Recommendation.&nbsp; However, implementors are encouraged to support the
character properties defined in any future version.
</p>
</note>
<p>
The following table specifies the recognized values of the
"General Category" property.
</p>

<table border="1" align="center">
<tbody>
	<tr>
		<th>Category</th>
		<th>Property</th>
		<th>Meaning</th>
	</tr>
	<tr>
		<td rowspan="6">Letters</td>
		<td align="center">L</td>
		<td>All Letters</td>
	</tr>
	<tr>
		<td align="center">Lu</td>
		<td>uppercase</td>
	</tr>
	<tr>
		<td align="center">Ll</td>
		<td>lowercase</td>
	</tr>
	<tr>
		<td align="center">Lt</td>
		<td>titlecase</td>
	</tr>
	<tr>
		<td align="center">Lm</td>
		<td>modifier</td>
	</tr>
	<tr>
		<td align="center">Lo</td>
		<td>other</td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td rowspan="4">Marks</td>
		<td align="center">M</td>
		<td>All Marks</td>
	</tr>
	<tr>
		<td align="center">Mn</td>
		<td>nonspacing</td>
	</tr>
	<tr>
		<td align="center">Mc</td>
		<td>spacing combining</td>
	</tr>
	<tr>
		<td align="center">Me</td>
		<td>enclosing</td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td rowspan="4">Numbers</td>
		<td align="center">N</td>
		<td>All Numbers</td>
	</tr>
	<tr>
		<td align="center">Nd</td>
		<td>decimal digit</td>
	</tr>
	<tr>
		<td align="center">Nl</td>
		<td>letter</td>
	</tr>
	<tr>
		<td align="center">No</td>
		<td>other</td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td rowspan="8">Punctuation</td>
		<td align="center">P</td>
		<td>All Punctuation</td>
	</tr>
	<tr>
		<td align="center">Pc</td>
		<td>connector</td>
	</tr>
	<tr>
		<td align="center">Pd</td>
		<td>dash</td>
	</tr>
	<tr>
		<td align="center">Ps</td>
		<td>open</td>
	</tr>
	<tr>
		<td align="center">Pe</td>
		<td>close</td>
	</tr>
	<tr>
		<td align="center">Pi</td>
		<td>initial quote
			(may behave like Ps or Pe depending on usage)</td>
	</tr>
	<tr>
		<td align="center">Pf</td>
		<td>final quote
			(may behave like Ps or Pe depending on usage)</td>
	</tr>
	<tr>
		<td align="center">Po</td>
		<td>other</td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td rowspan="4">Separators</td>
		<td align="center">Z</td>
		<td>All Separators</td>
	</tr>
	<tr>
		<td align="center">Zs</td>
		<td>space</td>
	</tr>
	<tr>
		<td align="center">Zl</td>
		<td>line</td>
	</tr>
	<tr>
		<td align="center">Zp</td>
		<td>paragraph</td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td rowspan="5">Symbols</td>
		<td align="center">S</td>
		<td>All Symbols</td>
	</tr>
	<tr>
		<td align="center">Sm</td>
		<td>math</td>
	</tr>
	<tr>
		<td align="center">Sc</td>
		<td>currency</td>
	</tr>
	<tr>
		<td align="center">Sk</td>
		<td>modifier</td>
	</tr>
	<tr>
		<td align="center">So</td>
		<td>other</td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td rowspan="6">Other</td>
		<td align="center">C</td>
		<td>All Others</td>
	</tr>
	<tr>
		<td align="center">Cc</td>
		<td>control</td>
	</tr>
	<tr>
		<td align="center">Cf</td>
		<td>format</td>
	</tr>
	<!--
	<tr>
		<td align="center">Cs</td>
		<td>Surrogate</td>
	</tr>
	  -->
	<tr>
		<td align="center">Co</td>
		<td>private use</td>
	</tr>
	<tr>
		<td align="center">Cn</td>
		<td>not assigned</td>
	</tr>
</tbody>
</table>
<scrap>
	<head>Categories</head>
	<prod id="cats">
		<lhs id="nt-IsCategory">IsCategory</lhs>
		<rhs>
			<nt def="nt-Letters"/> |
			<nt def="nt-Marks"/> |
			<nt def="nt-Numbers"/> |
			<nt def="nt-Punctuation"/> |
			<nt def="nt-Separators"/> |
			<nt def="nt-Symbols"/> |
			<nt def="nt-Others"/>
		</rhs>
	</prod>
	<prod id="lets">
		<lhs id="nt-Letters">Letters</lhs>
		<rhs>'L' [ultmo]?</rhs>
	</prod>
	<prod id="marks">
		<lhs id="nt-Marks">Marks</lhs>
		<rhs>'M' [nce]?</rhs>
	</prod>
	<prod id="nums">
		<lhs id="nt-Numbers">Numbers</lhs>
		<rhs>'N' [dlo]?</rhs>
	</prod>
	<prod id="punc">
		<lhs id="nt-Punctuation">Punctuation</lhs>
		<rhs>'P' [cdseifo]?</rhs>
	</prod>
	<prod id="seps">
		<lhs id="nt-Separators">Separators</lhs>
		<rhs>'Z' [slp]?</rhs>
	</prod>
	<prod id="syms">
		<lhs id="nt-Symbols">Symbols</lhs>
		<rhs>'S' [mcko]?</rhs>
	</prod>
	<prod id="others">
		<lhs id="nt-Others">Others</lhs>
		<rhs>'C' [cfon]?</rhs>
	</prod>
</scrap>
<note>
<p>
The properties mentioned above exclude the <code>Cs</code> property.
The <code>Cs</code> property identifies "surrogate" characters, which do not
occur at the level of the "character abstraction" that XML instance documents
operate on.
</p>
</note>
<p>
<termdef id="dt-ccesblock" term="block escape" role="local">
<bibref ref="UnicodeDB"/> groups code points into a number of blocks
such as Basic Latin (i.e., ASCII), Latin-1 Supplement, Hangul Jamo,
CJK Compatibility, etc.
The set containing all characters that have block name <code>X</code>
(with all white space stripped out),
can be identified with a <term>block escape</term> <code>\p{IsX}</code>.
The complement of this set is specified with the
<term>block escape</term> <code>\P{IsX}</code>.
(<code>[\P{IsX}]</code> = <code>[^\p{IsX}]</code>).
</termdef>
</p>
<scrap>
	<head>Block Escape</head>
	<prod id="blockesc">
		<lhs id="nt-IsBlock">IsBlock</lhs>
		<rhs>'Is' [a-zA-Z0-9#x2D]+</rhs>
	</prod>
</scrap>
<p>
The following table specifies the recognized block names (for more
information, see the "Blocks.txt" file in <bibref ref="UnicodeDB"/>).
</p>

<table border="1" align="center" cellpadding="5">
	<tbody>
		<tr>
			<th>Start Code</th>
			<th>End Code</th>
			<th>Block Name</th>
			<th>&nbsp;</th>
			<th>Start Code</th>
			<th>End Code</th>
			<th>Block Name</th>
		</tr>
		<tr>
			<td>#x0000</td>
			<td>#x007F</td>
			<td>BasicLatin</td>
			<td>&nbsp;</td>
			<td>#x0080</td>
			<td>#x00FF</td>
			<td>Latin-1Supplement</td>
		</tr>
		<tr>
			<td>#x0100</td>
			<td>#x017F</td>
			<td>LatinExtended-A</td>
			<td>&nbsp;</td>
			<td>#x0180</td>
			<td>#x024F</td>
			<td>LatinExtended-B</td>
		</tr>
		<tr>
			<td>#x0250</td>
			<td>#x02AF</td>
			<td>IPAExtensions</td>
			<td>&nbsp;</td>
			<td>#x02B0</td>
			<td>#x02FF</td>
			<td>SpacingModifierLetters</td>
		</tr>
		<tr>
			<td>#x0300</td>
			<td>#x036F</td>
			<td>CombiningDiacriticalMarks</td>
			<td>&nbsp;</td>
			<td>#x0370</td>
			<td>#x03FF</td>
			<td>Greek</td>
		</tr>
		<tr>
			<td>#x0400</td>
			<td>#x04FF</td>
			<td>Cyrillic</td>
			<td>&nbsp;</td>
			<td>#x0530</td>
			<td>#x058F</td>
			<td>Armenian</td>
		</tr>
		<tr>
			<td>#x0590</td>
			<td>#x05FF</td>
			<td>Hebrew</td>
			<td>&nbsp;</td>
			<td>#x0600</td>
			<td>#x06FF</td>
			<td>Arabic</td>
		</tr>
		<tr>
			<td>#x0700</td>
			<td>#x074F</td>
			<td>Syriac</td>
			<td>&nbsp;</td>
			<td>#x0780</td>
			<td>#x07BF</td>
			<td>Thaana</td>
		</tr>
		<tr>
			<td>#x0900</td>
			<td>#x097F</td>
			<td>Devanagari</td>
			<td>&nbsp;</td>
			<td>#x0980</td>
			<td>#x09FF</td>
			<td>Bengali</td>
		</tr>
		<tr>
			<td>#x0A00</td>
			<td>#x0A7F</td>
			<td>Gurmukhi</td>
			<td>&nbsp;</td>
			<td>#x0A80</td>
			<td>#x0AFF</td>
			<td>Gujarati</td>
		</tr>
		<tr>
			<td>#x0B00</td>
			<td>#x0B7F</td>
			<td>Oriya</td>
			<td>&nbsp;</td>
			<td>#x0B80</td>
			<td>#x0BFF</td>
			<td>Tamil</td>
		</tr>
		<tr>
			<td>#x0C00</td>
			<td>#x0C7F</td>
			<td>Telugu</td>
			<td>&nbsp;</td>
			<td>#x0C80</td>
			<td>#x0CFF</td>
			<td>Kannada</td>
		</tr>
		<tr>
			<td>#x0D00</td>
			<td>#x0D7F</td>
			<td>Malayalam</td>
			<td>&nbsp;</td>
			<td>#x0D80</td>
			<td>#x0DFF</td>
			<td>Sinhala</td>
		</tr>
		<tr>
			<td>#x0E00</td>
			<td>#x0E7F</td>
			<td>Thai</td>
			<td>&nbsp;</td>
			<td>#x0E80</td>
			<td>#x0EFF</td>
			<td>Lao</td>
		</tr>
		<tr>
			<td>#x0F00</td>
			<td>#x0FFF</td>
			<td>Tibetan</td>
			<td>&nbsp;</td>
			<td>#x1000</td>
			<td>#x109F</td>
			<td>Myanmar</td>
		</tr>
		<tr>
			<td>#x10A0</td>
			<td>#x10FF</td>
			<td>Georgian</td>
			<td>&nbsp;</td>
			<td>#x1100</td>
			<td>#x11FF</td>
			<td>HangulJamo</td>
		</tr>
		<tr>
			<td>#x1200</td>
			<td>#x137F</td>
			<td>Ethiopic</td>
			<td>&nbsp;</td>
			<td>#x13A0</td>
			<td>#x13FF</td>
			<td>Cherokee</td>
		</tr>
		<tr>
			<td>#x1400</td>
			<td>#x167F</td>
			<td>UnifiedCanadianAboriginalSyllabics</td>
			<td>&nbsp;</td>
			<td>#x1680</td>
			<td>#x169F</td>
			<td>Ogham</td>
		</tr>
		<tr>
			<td>#x16A0</td>
			<td>#x16FF</td>
			<td>Runic</td>
			<td>&nbsp;</td>
			<td>#x1780</td>
			<td>#x17FF</td>
			<td>Khmer</td>
		</tr>
		<tr>
			<td>#x1800</td>
			<td>#x18AF</td>
			<td>Mongolian</td>
			<td>&nbsp;</td>
			<td>#x1E00</td>
			<td>#x1EFF</td>
			<td>LatinExtendedAdditional</td>
		</tr>
		<tr>
			<td>#x1F00</td>
			<td>#x1FFF</td>
			<td>GreekExtended</td>
			<td>&nbsp;</td>
			<td>#x2000</td>
			<td>#x206F</td>
			<td>GeneralPunctuation</td>
		</tr>
		<tr>
			<td>#x2070</td>
			<td>#x209F</td>
			<td>SuperscriptsandSubscripts</td>
			<td>&nbsp;</td>
			<td>#x20A0</td>
			<td>#x20CF</td>
			<td>CurrencySymbols</td>
		</tr>
		<tr>
			<td>#x20D0</td>
			<td>#x20FF</td>
			<td>CombiningMarksforSymbols</td>
			<td>&nbsp;</td>
			<td>#x2100</td>
			<td>#x214F</td>
			<td>LetterlikeSymbols</td>
		</tr>
		<tr>
			<td>#x2150</td>
			<td>#x218F</td>
			<td>NumberForms</td>
			<td>&nbsp;</td>
			<td>#x2190</td>
			<td>#x21FF</td>
			<td>Arrows</td>
		</tr>
		<tr>
			<td>#x2200</td>
			<td>#x22FF</td>
			<td>MathematicalOperators</td>
			<td>&nbsp;</td>
			<td>#x2300</td>
			<td>#x23FF</td>
			<td>MiscellaneousTechnical</td>
		</tr>
		<tr>
			<td>#x2400</td>
			<td>#x243F</td>
			<td>ControlPictures</td>
			<td>&nbsp;</td>
			<td>#x2440</td>
			<td>#x245F</td>
			<td>OpticalCharacterRecognition</td>
		</tr>
		<tr>
			<td>#x2460</td>
			<td>#x24FF</td>
			<td>EnclosedAlphanumerics</td>
			<td>&nbsp;</td>
			<td>#x2500</td>
			<td>#x257F</td>
			<td>BoxDrawing</td>
		</tr>
		<tr>
			<td>#x2580</td>
			<td>#x259F</td>
			<td>BlockElements</td>
			<td>&nbsp;</td>
			<td>#x25A0</td>
			<td>#x25FF</td>
			<td>GeometricShapes</td>
		</tr>
		<tr>
			<td>#x2600</td>
			<td>#x26FF</td>
			<td>MiscellaneousSymbols</td>
			<td>&nbsp;</td>
			<td>#x2700</td>
			<td>#x27BF</td>
			<td>Dingbats</td>
		</tr>
		<tr>
			<td>#x2800</td>
			<td>#x28FF</td>
			<td>BraillePatterns</td>
			<td>&nbsp;</td>
			<td>#x2E80</td>
			<td>#x2EFF</td>
			<td>CJKRadicalsSupplement</td>
		</tr>
		<tr>
			<td>#x2F00</td>
			<td>#x2FDF</td>
			<td>KangxiRadicals</td>
			<td>&nbsp;</td>
			<td>#x2FF0</td>
			<td>#x2FFF</td>
			<td>IdeographicDescriptionCharacters</td>
		</tr>
		<tr>
			<td>#x3000</td>
			<td>#x303F</td>
			<td>CJKSymbolsandPunctuation</td>
			<td>&nbsp;</td>
			<td>#x3040</td>
			<td>#x309F</td>
			<td>Hiragana</td>
		</tr>
		<tr>
			<td>#x30A0</td>
			<td>#x30FF</td>
			<td>Katakana</td>
			<td>&nbsp;</td>
			<td>#x3100</td>
			<td>#x312F</td>
			<td>Bopomofo</td>
		</tr>
		<tr>
			<td>#x3130</td>
			<td>#x318F</td>
			<td>HangulCompatibilityJamo</td>
			<td>&nbsp;</td>
			<td>#x3190</td>
			<td>#x319F</td>
			<td>Kanbun</td>
		</tr>
		<tr>
			<td>#x31A0</td>
			<td>#x31BF</td>
			<td>BopomofoExtended</td>
			<td>&nbsp;</td>
			<td>#x3200</td>
			<td>#x32FF</td>
			<td>EnclosedCJKLettersandMonths</td>
		</tr>
		<tr>
			<td>#x3300</td>
			<td>#x33FF</td>
			<td>CJKCompatibility</td>
			<td>&nbsp;</td>
			<td>#x3400</td>
			<td>#x4DB5</td>
			<td>CJKUnifiedIdeographsExtensionA</td>
		</tr>
		<tr>
			<td>#x4E00</td>
			<td>#x9FFF</td>
			<td>CJKUnifiedIdeographs</td>
			<td>&nbsp;</td>
			<td>#xA000</td>
			<td>#xA48F</td>
			<td>YiSyllables</td>
		</tr>
		<tr>
			<td>#xA490</td>
			<td>#xA4CF</td>
			<td>YiRadicals</td>
			<td>&nbsp;</td>
			<td>#xAC00</td>
			<td>#xD7A3</td>
			<td>HangulSyllables</td>
		</tr>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td>&nbsp;</td>
			<td></td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td>&nbsp;</td>
			<td>#xE000</td>
			<td>#xF8FF</td>
			<td>PrivateUse</td>
		</tr>
		<tr>
			<td>#xF900</td>
			<td>#xFAFF</td>
			<td>CJKCompatibilityIdeographs</td>
			<td>&nbsp;</td>
			<td>#xFB00</td>
			<td>#xFB4F</td>
			<td>AlphabeticPresentationForms</td>
		</tr>
		<tr>
			<td>#xFB50</td>
			<td>#xFDFF</td>
			<td>ArabicPresentationForms-A</td>
			<td>&nbsp;</td>
			<td>#xFE20</td>
			<td>#xFE2F</td>
			<td>CombiningHalfMarks</td>
		</tr>
		<tr>
			<td>#xFE30</td>
			<td>#xFE4F</td>
			<td>CJKCompatibilityForms</td>
			<td>&nbsp;</td>
			<td>#xFE50</td>
			<td>#xFE6F</td>
			<td>SmallFormVariants</td>
		</tr>
		<tr>
			<td>#xFE70</td>
			<td>#xFEFE</td>
			<td>ArabicPresentationForms-B</td>
			<td>&nbsp;</td>
			<td>#xFEFF</td>
			<td>#xFEFF</td>
			<td>Specials</td>
		</tr>
		<tr>
			<td>#xFF00</td>
			<td>#xFFEF</td>
			<td>HalfwidthandFullwidthForms</td>
			<td>&nbsp;</td>
			<td>#xFFF0</td>
			<td>#xFFFD</td>
			<td>Specials</td>
		</tr>
	</tbody>
</table>
<note>
<p>

The blocks mentioned above exclude the <code>HighSurrogates</code>,
<code>LowSurrogates</code> and <code>HighPrivateUseSurrogates</code> blocks.
These blocks identify "surrogate" characters, which do not
occur at the level of the "character abstraction" that XML instance documents
operate on.

</p>
</note>

<note>
<p>
<bibref ref="UnicodeDB"/> is subject to future revision.
For example, the
grouping of code points into blocks might be updated.
All <termref def="dt-minimally-conforming"/> processors <termref def="dt-must"/>
support the blocks defined in the version of <bibref ref="UnicodeDB"/>
that is current at the time this specification became a W3C
Recommendation.&nbsp; However, implementors are encouraged to support the
blocks defined in any future version of the Unicode Standard.
</p>
</note>
<p>
For example, the <termref def="dt-ccesblock"/> for identifying the
ASCII characters is <code>\p{IsBasicLatin}</code>.
</p>
<p>
<termdef id="dt-ccesN" term="multi-character escape" role="local">
A
<term>multi-character escape</term> provides a simple way to identify
a commonly used set of characters:
</termdef>
</p>
<scrap>
	<head>Multi-Character Escape</head>
	<prod id="multicharesc">
		<lhs id="nt-MultiCharEsc">MultiCharEsc</lhs>
		<rhs>'\' [sSiIcCdDwW]</rhs>
	</prod>
	<prod id="wildcardesc">
		<lhs id="nt-WildcardEsc">WildcardEsc</lhs>
		<rhs>'.'</rhs>
	</prod>
</scrap>
<p/>
<table border="1" align="center" cellpadding="5">
<col width="33%"/>
<col width="33%"/>
<col width="33%"/>
<thead><tr>
<th>Character sequence</th>
<!--<th>Name</th>-->
<th>Equivalent <termref def="dt-charclass"/></th>
</tr>
</thead>
<tbody>
	<tr>
		<td align="center">.</td>
<!--		<td>&nbsp;</td>-->
		<td align="center">[^\n\r]</td>
	</tr>
	<tr>
		<td align="center">\s</td>
<!--		<td>white space</td>-->
		<td align="center">[#x20\t\n\r]</td>
	</tr>
	<tr>
		<td align="center">\S</td>
<!--		<td>&nbsp;</td>-->
		<td align="center">[^\s]</td>
	</tr>
	<tr>
		<td align="center">\i</td>
<!--		<td>XML initial Name character</td>-->
		<td align="center">
		<!--[\p{Ll}\p{Lu}\p{Lo}\p{Lt}\p{Nl}_:]
		<br/>
		(i.e.,
		-->the set of initial name characters, those
		<termref def="dt-match"/>ed by
		<xspecref href="&xmlspec;#NT-Letter">Letter</xspecref> | '_' | ':'</td>
	</tr>
	<tr>
		<td align="center">\I</td>
<!--		<td>&nbsp;</td>-->
		<td align="center">[^\i]</td>
	</tr>
	<tr>
		<td align="center">\c</td>
<!--		<td>XML Name character</td>-->
		<td align="center">
<!--
		[\i\p{Nd}\p{Mc}\p{Me}\p{Mn}\p{Lm}.#x00B7#x0387-]
		<br/>
		(i.e.,
		-->
		the set of name characters, those
		<termref def="dt-match"/>ed by
		<xspecref href="&xmlspec;#NT-NameChar">NameChar</xspecref></td>
	</tr>
	<tr>
		<td align="center">\C</td>
<!--		<td>&nbsp;</td>-->
		<td align="center">[^\c]</td>
	</tr>
	<tr>
		<td align="center">\d</td>
<!--		<td>digit (includes digits outside of the 0-9)</td>-->
		<td align="center">\p{Nd}</td>
	</tr>
	<tr>
		<td align="center">\D</td>
<!--		<td>&nbsp;</td>-->
		<td align="center">[^\d]</td>
	</tr>
	<tr>
		<td align="center">\w</td>
<!--		<td>a "word" character</td>-->
		<td align="center">
			[#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}]
			(<emph>all characters except the set of "punctuation",
				"separator" and "other" characters</emph>)
		</td>
	</tr>
	<tr>
		<td align="center">\W</td>
<!--		<td>&nbsp;</td>-->
		<td align="center">[^\w]</td>
	</tr>
</tbody>
</table>
<note>
<p>
The <termref def="dt-regex"/> language defined here does not
attempt to provide a general solution to "regular expressions" over
UCS character sequences.&nbsp; In particular, it does not easily provide
for matching sequences of base characters and combining marks.
The language is targeted at support of "Level 1" features as defined in
<bibref ref="unicodeRegEx"/>.&nbsp; It is hoped that future versions of this
specification will provide support for "Level 2" features.
</p>
</note>
</div3>
</div2>
</div1>

<div1 id="changes"><head>Changes since version 1.0</head>

<div2 id="done"><head>Changes Already Made</head>

<p>A number of proposals for final wording satisfying various approved requirements for Schema 1.1 are included in the prose
of this document.&nbsp; Only one has been formally
accepted by the WG:&nbsp; the rewrite of <dtref ref="duration"/> (including the new derived datatypes
<dtref ref="yearMonthDuration"/> and <dtref ref="dayTimeDuration"/>), in <specref ref="duration"/>,
<specref ref="yearMonthDuration"/> and <specref ref="dayTimeDuration"/>; even that new approved text has
a few improvements proffered.&nbsp; The new writeups of <specref ref="typesystem"/>, <specref ref="precisionDecimal"/>,
<specref ref="theSevenPropertyModel"/>, and <specref ref="gDay"/> are included herein but have not yet received
final approval by the WG.  In versions of this draft that show add/del markup, the unapproved new material
is marked as revision text.&nbsp; (Approved changes are not marked as revisions.)</p>

<div3><head>Datatypes, Facets and Related Rewrites</head>

<p>The model of an abstract datatype is being made more precise and explicit.&nbsp; <specref ref="typesystem"/> has mostly been rewritten, but there
is still discussion within the WG as to the final form; this text has not been <unusual>formally blessed</unusual> by the WG.&nbsp; In versions
of this specification that show adds and dels, this material shaws as a proposed change.  Driving this new text is not only a desire on the
part of the WG to make it <quote>more precise and explicit</quote> but also a specific formal requirement to redo the handling of facets
(<loc href="&reqs;#fundamentals" target="reqs">RQ-24 (systematic facets)</loc>).&nbsp; The primary intent of this requirement was to move
the description of equality, identity, and order to <specref ref="value-space"/>.</p>

<p><loc href="&reqs;#fundamentals" target="reqs">RQ-24 (systematic facets: separate identity and equality)</loc> directed that
we provide for equality that in some cases was different from identity.&nbsp; Most datatypes still use identity as their equality, but
the new precisionDecimal and the redesigned date/time datatypes will not.&nbsp; It is also intended that <dtref ref="float"/> and
<dtref ref="double"/> will use this capability to separate minus zero from plus zero; they will be non-identical but equal
(see <loc href="#RQ-140i">RQ-140</loc>).</p>

<p>The <propref ref="bounded-value"/> of the <compref ref="dc-bounded"/> component for <pt>list</pt> datatypes is now always
<pt>false</pt>, reflecting the fact that <termref def="dt-list"></termref> datatypes are not ordered (except by the trivial order),
and hence cannot reasonably be bounded.</p>

<p>Units of length have been selected for all datatypes that are permitted the length &cfacet;
(<loc href="&reqs;#unit-of-length" target="reqs">RQ-6 (length for [almost] all primitive types)</loc>).</p>

</div3>

<div3><head>Numerical Datatypes</head>

<p>The <dtref ref="precisionDecimal"/> datatype has been added.&nbsp; It differs from <dtref ref="decimal"/> in that
values corry not ony <unusual>numerical value</unusual> but also <unusual>precision</unusual>&nbsp; Precision is
explained in <specref ref="sec-precision"/>.&nbsp; The writeup in <specref ref="precisionDecimal"/> has not yet been
approved by the WG.&nbsp; In versions
of this specification that show adds and dels, this material shows as a proposed change.</p>

</div3>

<div3><head>Date/time Datatypes</head>

<p><loc href="&reqs;#canonical-duration" target="reqs">RQ-2 (canonical rep of duration)</loc> resulted in the adoption
of a new two-property model for <dtref ref="duration"/> and the rewriting of <specref ref="duration"/>.&nbsp; A few additional
changes have been proposed, and in versions of this specification that show adds and dels these changes are so
marked.&nbsp; In addition, two new derived datatypes (<dtref ref="yearMonthDuration"/> and <dtref ref="dayTimeDuration"/>)
have been added in satisfaction of <loc href="&reqs;#ordered-duration" target="reqs">RQ-20 (ordered duration types)</loc>.</p>

<p><loc href="&reqs;#dateTime-values" target="reqs">RQ-122 (define dateTime value space)</loc> has resulted in a revision of the
value space for all date/time datatypes (except <dtref ref="duration"/>, which was changed as a result of another requirement).&nbsp;
The most visible effect of this change was to cause the values to retain knowledge of their timezone, which is explained in the
new material.&nbsp; The new version specifies a seven-property model used uniformly for values in all of these datatypes, described in
<specref ref="theSevenPropertyModel"/>.&nbsp; Only <specref ref="gDay"/> has been rewritten to match this new generic approach;
the other date/time datatype descriptions will be rewritten in a future draft.&nbsp; These rewrites
and the new <specref ref="d-t-values"/> have not yet been approved by the WG; in versions
of this specification that show adds and dels, this material shows as a proposed change.&nbsp; In addition to the normative
material, the nonnormative <specref ref="dTReal"/> was added to explain in more detail the model of dates and times behind the
seven-property model, so that there will be no confusion about the handling of such things as <unusual>leap-seconds</unusual>.</p>

<p>The seven property model rewrite of date/time datatype descriptions includes a carefully crafted definition of order
that insures that for repeating datatypes (time, gDay, etc.), timezoned values will be compared as though they are on
the same "calendar day" ("raw" property values) so that in any given timezone, the days start at "raw" 00:00:00 and
end not quite including "raw" 24:00:00.&nbsp; Days are not 00:00:00Z to 24:00:00Z in timezones other than Z.&nbsp; This covers
the requirements of <loc href="&reqs;#time" target="reqs">RQ-13 (time zone crosses date line)</loc>.&nbsp; In addition,
in satisfaction of <loc href="&reqs;#year-zero" target="reqs">RQ-123 (year 0000 in date/time datatypes)</loc>, the lexical
representation <string>0000</string> for years is made legal and the mapping of values with negative years onto the timeline
has been changed to match.&nbsp; E.g., the year 0000 is 1 B.C.E., the year &minus;0001 is 2 B.C.E., etc.&nbsp; (This is a
change from version 1.0 of this specification.)</p>

</div3>
</div2>

<div2 id="issues"><head>Specific Outstanding Issues</head>

<p>In addition to the changes already made, the Working Group has decided on
a number of further changes which have not yet been reflected in this draft. 
These are indicated throughout the text as issues, including more or less
detail on the intended resolution.  The ones remaining in this draft are
summarized below, linked to their occurrence in the text above, where more
detail can be found, including links to the original requirement or other
point of origin.</p>

<issue role="tabulate" id="hack"><p/></issue>

</div2>
</div1>

<div1 role="1.0" id="normative-glossary">
<head>Glossary (non-normative)</head>
<p>The listing below is for the benefit of readers of a printed version of this
document:  it collects together all the definitions which appear in the
document above.</p>
<ednote role="glossary">
<edtext>An XSL macro is used to
collect definitions from throughout the spec and gather them here for easy
reference.</edtext>
</ednote>

</div1>
<div1 role="1.0" id="biblio">
<head>References</head>
<!--
   bibls can be in any order and the stylesheet will sort them
   by the value of their key attribute
  -->
<div2 role="1.0" id="normative-biblio">
<head>Normative</head>
<blist>
<bibl id="XBase" key="XML Base">
<!-- pvb: bug in xmlspec.xsl...diff marking not implemented for bibl -->
<!-- pvb: this wasn't added when we did the errata, but it should have been -->
World Wide Web Consortium.&nbsp; XML Base.
Available at: <loc href="http://www.w3.org/TR/2001/REC-xmlbase-20010627/">
http://www.w3.org/TR/2001/REC-xmlbase-20010627/</loc>
</bibl>
<bibl id="ieee754" key="IEEE 754-1985">
IEEE. <emph>IEEE Standard for Binary Floating-Point Arithmetic.</emph>
See <loc href="http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html">
http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html</loc>
</bibl>
<bibl id="XLink" key="XML Linking Language">
World Wide Web Consortium.&nbsp; XML Linking Language (XLink).
Available at: <loc href="&xlink;">&xlink;.</loc>
Note: only the URI reference escaping procedure defined in
Section 5.4 is normatively referenced.
</bibl>
<bibl id="XML" key="XML"> <emph>Extensible
Markup Language (XML) 1.0, <phrase diff="del">Second Edition</phrase><phrase diff="add">Third Edition</phrase></emph>, Tim Bray et al., eds., W3C,
<phrase diff="del">6 October 2000</phrase><phrase diff="add">4 February 2004</phrase>. See
<loc href="http://www.w3.org/TR/2000/REC-xml-20001006" diff="del">http://www.w3.org/TR/2000/REC-xml-20001006</loc><loc href="http://www.w3.org/TR/2004/REC-xml-20040204/" diff="add">http://www.w3.org/TR/2004/REC-xml-20040204/</loc>
</bibl>
<bibl id="structural-schemas" key="XML Schema Part 1: Structures">
XML Schema<phrase diff="add"> Version 1.1</phrase> Part 1:
Structures. Available at: <loc href="http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/" diff="del">http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/</loc><loc diff="add" href="&xsdl;">
&xsdl;</loc>
</bibl>
<bibl id="ref-xsreqOld" key="XML Schema Requirements"><phrase diff="del">
<emph>XML Schema Requirements </emph>, Ashok Malhotra and Murray Maloney, eds.,
W3C, 15 February 1999. See <loc href="http://www.w3.org/TR/1999/NOTE-xml-schema-req-19990215">http://www.w3.org/TR/1999/NOTE-xml-schema-req-19990215</loc></phrase> </bibl>
<bibl id="XMLNS" key="Namespaces in XML">
World Wide Web Consortium.&nbsp; <emph>Namespaces in XML</emph>. Available at:
<loc href="&xmlnsspec;">&xmlnsspec;</loc>
</bibl>
<bibl id="RFC2396" key="RFC 2396">
Tim Berners-Lee, et. al. <emph>RFC 2396: Uniform Resource Identifiers (URI):
Generic Syntax.</emph>. 1998.&nbsp; Available at:
<loc href="http://www.ietf.org/rfc/rfc2396.txt">
http://www.ietf.org/rfc/rfc2396.txt</loc>
</bibl>
<!--
<bibl id="RFC2732" href="http://www.ietf.org/rfc/rfc2732.txt" key="RFC 2732">
-->
<bibl id="RFC2732" key="RFC 2732">
<emph>RFC
2732: Format for Literal IPv6 Addresses in URL's</emph>. 1999.
Available at:
<loc href="http://www.ietf.org/rfc/rfc2732.txt">
http://www.ietf.org/rfc/rfc2732.txt</loc>
</bibl>
<bibl id="RFC2045" key="RFC 2045">
N. Freed and N. Borenstein. <emph>RFC 2045: Multipurpose Internet Mail Extensions
(MIME) Part One: Format of Internet Message Bodies</emph>. 1996.&nbsp; Available at:
<loc href="http://www.ietf.org/rfc/rfc2045.txt">
http://www.ietf.org/rfc/rfc2045.txt</loc>
</bibl>

<bibl id="RFC3066" key="RFC 3066">
H. Alvestrand, ed. <emph>RFC 3066: Tags for the Identification of Languages</emph>
1995. Available at: <loc href="http://www.ietf.org/rfc/rfc3066.txt">
http://www.ietf.org/rfc/rfc3066.txt</loc>
</bibl>
<bibl id="clinger1990" key="Clinger, WD (1990)">
William D Clinger. <emph>How to Read Floating Point Numbers Accurately.</emph>
In <emph>Proceedings of Conference on Programming Language Design and
Implementation</emph>, pages 92-101.
Available at: <loc href="ftp://ftp.ccs.neu.edu/pub/people/will/howtoread.ps">
ftp://ftp.ccs.neu.edu/pub/people/will/howtoread.ps</loc>
</bibl>
<bibl id="UnicodeDB" key="Unicode Database">
The Unicode Consortium. <emph>The Unicode Character Database</emph>.
Available at: <loc href="http://www.unicode.org/Public/3.1-Update/UnicodeCharacterDatabase-3.1.0.html">
http://www.unicode.org/Public/3.1-Update/UnicodeCharacterDatabase-3.1.0.html</loc>
</bibl>
</blist>
</div2>
<div2 role="1.0" id="non-normative-biblio">
<head>Non-normative</head>
<blist>
<bibl id="schema-requirements" key="XML Schema Requirements"><phrase diff="add">
<emph>XML Schema Requirements </emph>, Ashok Malhotra and Murray Maloney, eds.,
W3C, 15 February 1999. See <loc href="http://www.w3.org/TR/1999/NOTE-xml-schema-req-19990215">http://www.w3.org/TR/1999/NOTE-xml-schema-req-19990215</loc></phrase> </bibl>
<bibl id="draft-masinter-url-i18n-07" key="IETF INTERNET-DRAFT: IRIs">
M. D&#xfc;rst and M. Suignard
.
<emph>Internationalized Resource Identifiers</emph>
2002. Available at:
<loc href="http://www.w3.org/International/iri-edit/draft-duerst-iri-08.txt">
http://www.w3.org/International/iri-edit/draft-duerst-iri-08.txt</loc>
</bibl>

<bibl id="ruby" key="Ruby">
World Wide Web Consortium.&nbsp; Ruby Annotation.&nbsp; Available at:
<loc href="http://www.w3.org/TR/2001/REC-ruby-20010531">
http://www.w3.org/TR/2001/REC-ruby-20010531</loc>
</bibl>

<bibl id="html4" key="HTML 4.01">
World Wide Web Consortium.&nbsp; Hypertext Markup Language, version 4.01.&nbsp; Available at:
<loc href="&html4;">
&html4;</loc>
</bibl>

<bibl id="schema-primer" key="XML Schema Language: Part 0 Primer">
World Wide Web Consortium.&nbsp; XML Schema Language: Part 0 Primer.&nbsp; Available at:
<loc href="&primer;">
&primer;</loc>
</bibl>
<bibl id="unicodeRegEx" key="Unicode Regular Expression Guidelines">
Mark Davis.&nbsp; <emph>Unicode Regular Expression Guidelines</emph>, 1988.
Available at: <loc href="http://www.unicode.org/unicode/reports/tr18/">
http://www.unicode.org/unicode/reports/tr18/</loc>
</bibl>
<bibl id="Perl" key="Perl">
The Perl Programming Language.&nbsp; See <loc href="http://www.perl.com/pub/language/info/software.html">
http://www.perl.com/pub/language/info/software.html</loc>
</bibl>
<bibl id="SQL" key="SQL">
ISO (International Organization for Standardization).&nbsp; <emph>ISO/IEC
9075-2:1999, Information technology --- Database languages ---
SQL --- Part 2: Foundation (SQL/Foundation)</emph>.
[Geneva]: International Organization for Standardization, 1999.
See <loc href="http://www.iso.ch/cate/d26197.html">
http://www.iso.ch/cate/d26197.html</loc>
</bibl>
<bibl id="IERS" key="International Earth Rotation Service (IERS)">
International  Earth Rotation Service (IERS).
See <loc href="http://maia.usno.navy.mil">http://maia.usno.navy.mil</loc>
</bibl>
<bibl id="ISO8601" key="ISO 8601">
ISO (International Organization for Standardization).
<emph>Representations of dates and times, 1988-06-15.</emph>

</bibl>
<bibl id="ISO8601-1998" key="ISO 8601:1998 Draft Revision">
ISO (International Organization for Standardization).
<emph>Representations of dates and times, draft revision, 1998.</emph>
</bibl>
<bibl id="ISO8601-2000" key="ISO 8601:2000 Second Edition">
ISO (International Organization for Standardization).
<emph>Representations of dates and times, second edition, 2000-12-15.</emph>
</bibl>
<bibl id="ISO11404" key="ISO 11404">
ISO (International Organization for Standardization).
<emph>Language-independent Datatypes.</emph>  See
<loc href="http://www.iso.ch/cate/d19346.html">
 http://www.iso.ch/cate/d19346.html</loc>
</bibl>
<bibl id="RDFSchema" key="RDF Schema">
World Wide Web Consortium. <emph>RDF Schema Specification.</emph>
Available at:
<loc href="http://www.w3.org/TR/2000/CR-rdf-schema-20000327/">
http://www.w3.org/TR/2000/CR-rdf-schema-20000327/</loc>
</bibl>
<bibl id="USNavy" key="U.S. Naval Observatory Time Service Department">
<emph>Information about Leap Seconds</emph>
Available at:
<loc href="http://tycho.usno.navy.mil/leapsec.990505.html">http://tycho.usno.navy.mil/leapsec.990505.html</loc>
</bibl>
<bibl id="XSL" key="XSL">
World Wide Web Consortium.&nbsp;
<emph>Extensible Stylesheet Language (XSL).</emph>&nbsp;
Available at:&nbsp; <loc href