<?xml version='1.0'?>
<!-- Id: datatypes.xml,v 1.7.2.141 2005/02/22 07:13:38 cmsmcq Exp  -->
<?xml-stylesheet type='text/xsl' href='xmlschema_nodiffs.xsl'?>
<?xml-stylesheet type='text/xsl' href='xmlschema_nodiffs.xsl'?>
<!DOCTYPE spec SYSTEM "local.dtd" [
<!ENTITY suffix "">
<!ENTITY hellip "&#x2026;" ><!--=ellipsis (horizontal)-->
<!ENTITY isin   "&#x2208;" ><!--/in R: =set membership-->
<!ENTITY owners.Diff '<phrase diff="del" dg="wdd">parent&apos;s</phrase><phrase diff="add" dg="wdd">owner&apos;s</phrase>'>
]>
<spec w3c-doctype="wd" status="final">
<header>
<title>XML Schema 1.1 Part 2: Datatypes</title>
<w3c-designation>wd-20050224</w3c-designation>
<w3c-doctype>W3C Working Draft</w3c-doctype>
<pubdate>
<day>24</day>
<month>February</month>
<year>2005<!--* Id: datatypes.xml,v 1.7.2.141 2005/02/22 07:13:38 cmsmcq Exp  *--></year>
</pubdate>
<publoc> 
<loc href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/">http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/</loc> 
</publoc>
<altlocs>
<loc href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.xml">XML</loc>
<!--* 
<loc href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html">XHTML with changes since version 1.0 marked</loc>
<loc href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-wd.html">XHTML with changes since previous Working Draft marked</loc>
*-->
<loc href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-1.0.html">XHTML with changes since version 1.0 marked</loc>
<loc href="http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/datatypes.diff-wd.html">XHTML with changes since previous Working Draft marked</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>
<loc href="http://www.w3.org/2003/03/Translations/byTechnology?technology=xmlschema">List of translations</loc>
</altlocs>
<latestloc>
<loc 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/WD-xmlschema11-2-20040716/">http://www.w3.org/TR/2004/WD-xmlschema11-2-20040716/</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 role="1.0">
<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>Oracle Corporation</affiliation>
<email href="mailto:ashokmalhotra@alum.mit.edu">ashokmalhotra@alum.mit.edu</email>
</author>
<author diff="add">
<name>C. M. Sperberg-McQueen</name>
<affiliation>World Wide Web Consortium</affiliation>
<email href="mailto:cmsmcq@w3.org">cmsmcq@w3.org</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>This is a 
Public Working Draft 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 and our progress in
achieving them.  It attempts to be complete in indicating
<emph>what</emph> will change from version 1.0, but does
<emph>not</emph> specify in all cases <emph>how</emph> things will
change.</p>
<p>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.  Accompanying versions of this document display in color
all changes to normative text since version 1.0 and since the
previous Working Draft.</p>
<p>This draft was published on 24&#x20;February&#x20;2005.
The major changes are:</p>
<ulist>
<item>
<p>A new primitive decimal type has been defined, which retains
information about the precision of the value.  This type is
aligned with the floating-point decimal types which will be
part of the next edition of IEEE 754.</p>
</item>
<item>
<p>In order to align this specification with those being prepared
by the XSL and XML Query Working Groups, a new datatype named
<dtref ref="anyAtomicType"/> has been introduced.</p>
</item>
<item>
<p>The conceptual model of the date- and time-related types has
been defined more formally.</p>
</item>
<item>
<p>Two subtypes of <dtref ref="duration"/> 
(<dtref ref="yearMonthDuration"/> and
<dtref ref="dayTimeDuration"/>) have been introduced, each of which is
totally ordered.</p>
</item>
<item>
<p>A more formal treatment of the fundamental facets of the primitive
datatypes has been adopted.</p>
</item>
<item>
<p>More formal definitions of the lexical space of most types have
been provided, with detailed descriptions of the mappings from lexical
representation to value and from value to canonical representation.</p>
</item>
<!--* 
<item>
<p>Canonical representations have been defined for the <dtref
ref="float"/> and <dtref ref="double"/> types.</p>
</item>
<item>
<p>The units of length have been specified for all primitive
datatypes.</p>
</item>
*-->
</ulist>

<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>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>In accordance with 
<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/2003/03/Translations/byTechnology?technology=xmlschema"
>http://www.w3.org/2003/03/Translations/byTechnology?technology=xmlschema</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 id="junk">diff group junk:&nbsp; a few homeless targets; should probably ALWAYS BE SHOW unless nothing is, or it is empty</sitem>
<sitem id="fa1">diff group fa1:&nbsp; RQ-24 facets proposal, changes made BEFORE
the publication of the first public working draft.  APPROVED SOME TELECON 2004-10</sitem>
<sitem id="fa1.z">diff group fa1:&nbsp; RQ-24 facets proposal, changes made AFTER the publication
of the first public working draft. APPROVED SOME TELECON 2004-10</sitem>
<sitem id="cvs1">diff group cvs1:&nbsp; Constructed Values Appendix (div1)</sitem>
<sitem id="cvs1_pwd">diff group cvs1_pwd:  Constructed Values Appendix as a whole (to
avoid nested like-named diffs)</sitem>
<sitem id="num1">diff group num1:&nbsp; Numerical Values Appendix (div2); requires cvs1</sitem>
<sitem id="numap1">diff group numap1:&nbsp; in-text productions, etc., first cut; requires funbase, nu1, num1</sitem>
<sitem id="funbase">diff group funbase:&nbsp; The functions appendix in its entirety.  ALWAYS ACCEPT OR SHOW</sitem>
<sitem id="nu1">diff group nu1:&nbsp; basic numerical functions; requires funbase, num1, cvs1</sitem>
<sitem id="du0">diff group du0:&nbsp; first Ph 2 for duration; requires numap, nu1, num1, funbase. NOT YET MARKED;  APPROVED pre-FPWD</sitem>
<sitem id="du1">diff group du1:&nbsp; second set of revs for duration (compare du2)</sitem>
<sitem id="du2">diff group du2:&nbsp; second set of revs for dayTimeDuration and yearMonthDuration (compare du1)</sitem>
<sitem id="dt1">diff group dt1:&nbsp; RQ-13 date/time rewrite, first part Ph 2 (d/t app and gDay); requires funbase, nu1, num1; APPROVED 2004-08-27 FTF</sitem>
<sitem id="dt2">diff group dt2:&nbsp; RQ-13 date/time rewrite, second part Ph 2 (time and others); requires dt1, funbase, nu1, num1</sitem>
<sitem id="dtr">diff group dtr:&nbsp; date/time nonnormative description (INCLUDES 2 NORMATIVE TABLES); requires dt1</sitem>
<sitem id="dt3">diff group dt3:&nbsp; RQ-13 date/time rewrite, third part Ph 2 (time and others); requires dt1, dt2, funbase, nu1, num1</sitem>
<sitem id="dt2-3">diff group dt2-3:&nbsp; RQ-13 date/time rewrite, third part Ph 2 (time and others); marks an item added indt2 and then delled in dt3 as del. Accept ("post"), except reject ("pre") if dt2 is accept and dt3 is reject, and show ("colour") if dt2 is accept and dt3 is show.</sitem>
<sitem id="dt4">diff group dt4:&nbsp; RQ-13 date/time rewrite, fourth part Ph 2 (time and others); requires dt1, dt2, dt3, funbase, nu1, num1</sitem>
<sitem id="pd1">diff group pd1:&nbsp; RQ-31 precisionDecimal first cut for approval; co-requires pre, pd2, pd3; requires pdf</sitem>
<sitem id="pdo">diff group pdo:&nbsp; RQ-31 precisionDecimal first cut, 
deletion of old decimal; co-requires pre, pd1 ,pd3; requires pdf.
2005-01-20: WG chooses two-primitive approach, rejects this change.
2005-01-26: MSM removes this diff group to reduce cruft in the document.
</sitem>
<sitem id="pd2">diff group pd2:&nbsp; RQ-31 precisionDecimal first cut, 
addition of new aPDedimal; co-requires pre, pd1, pd2; requires pdf.
2005-01-20: WG chooses two-primitive approach, rejects this change.
2005-01-26: MSM removes this diff group to reduce cruft in the document.
</sitem>
<sitem id="pre">diff group pre:&nbsp; Precision Appendix; co-requires pd1, 
requires num1 and cvs1.
Final wording approved (with changes) 2005-02-04.</sitem>
<sitem id="pdf">diff group pdf:&nbsp; numerical functions just for 
precisionDecimal (RQ-31); requires num1 (??).
Final wording approved (with changes) 2005-02-04.</sitem>
<sitem id="pdf_m">diff group pdf:&nbsp; numerical functions for 
precisionDecimal (RQ-31) in two-primitive form.
Final wording approved (with changes) 2005-02-04.</sitem>
<sitem id="pdf_u">diff group pdf:&nbsp; numerical functions for precisionDecimal (RQ-31) 
in single-primitive form.  Removed 2005-01-26 after WG chose two-primitive form.</sitem>
<sitem id="aat">diff group aat:&nbsp; anyAtomicType (RQ-???); may require fa1 ??    
APPROVED with changes FTF 2004-11-10.
Changes decided by WG entered (as aatf), 2005-01-25.
Draft final wording approved (with changes) 2005-02-04.
</sitem>
<sitem id="aat1">diff group aat1:&nbsp; anyAtomicType (RQ-???); requires aat</sitem>
<sitem id="trm1">diff group trm1:&nbsp; terminological cleanup begun with tightening meaning of derived (RQ-120); </sitem>
<sitem id="rq31facets">diff group rq31facets: with MSM's proposed changes related to facets of
precision decimal.  This takes a single-primitive ('unitarian') view of
precision decimal and legacy decimal (here under the name aPdecimal).
Compatible with both rq31m and rq31u.</sitem>
<sitem id="rq31u">diff group rq31u: with changes for a one-primitive ('unitarian')
version of precision decimal.  Incompatible with: 
rq31m, which takes the manichean view,
Assumes: pd1, pd2, pre, pdf, num1, pdo(which deletes old decimal),
pd2 (which inserts new aPDecimal).
The WG chose the Manichean decimal proposal over the Unitarian one,
2005-01-20.  Diffs for group rq31u were removed 2005-01-26.
</sitem>
<sitem id="rq31m">diff group rq31m: with changes for a two-primitive ('manichean')
version of precision decimal.  Incompatible with: 
rq31u, which takes the unitarian view,
pdo, which deletes old decimal,
pd2, which inserts new aPDecimal.
Assumes: pd1, pre, pdf, num1.
Final wording approved (with changes) 2005-02-04.
</sitem>
<sitem id="fa1-fix">diff group fa1-fix: MSM's proposed changes for fixing
problems (missing term definitions, in particular) caused by the fact
that fa1 was incomplete and left the document in an unstable
state.</sitem>
<sitem id="iff">diff group iff: with an editorial proposal (2005-01-01) for
being more consistent about the use of conditionals and
biconditionals.  When terms are being defined (whether or not marked
as termdefs) or necessary and sufficient conditions for some state are
being given (e.g. in constraint notes, which define terms like 'facet
valid with respect to X'), this diff group proposes to use 'if' only
for conditions which are sufficient but not necessary; if the
conditions are both sufficient and necessary, then use 'if and only
if'.</sitem>
<sitem id="pdf_tweak">diff group pdf_tweak: for proposed improvements to diff
group pdf (all gone away now, and then come back again).
Final wording approved (with changes) 2005-02-04. </sitem>
<sitem id="review">diff group review: for marking stuff that is really intended
only for editorial review (usually to be used on ednotes).</sitem>
<sitem id="wdd">diff group wdd: for working-draft deviations:  changes
between the publication of the first public WD in July and the
advent of thorough and permanent change markup.  (Diff group wdd
begun 9 January 2005, but diff not completed.  It was looking like
another three hours work.)  I.e. wdd should mark all and only those
differences between TR/2004/WD-xmlschema11-2-20040716/datatypes.xml
and xse/datatypes/datatypes.xml which are not already marked.  When
we run the result through the dg.xsl filter with wdd set to reject,
the result should be (modulo whitespace and other non-significant
differences) substantively the same as the public WD.
</sitem>
<sitem id="dpno">diff group dpno: change proposals transferred
into this file from the experimental fork datatypes.newOrg.xml.
At the moment, the quasi-systematic changes of ID have not been
reproduced.</sitem>
<sitem id="fpwd-rescinded-add">diff group fpwd-rescinded-add: marks some paragraphs added in the first public working draft but
since deleted again.</sitem>
<sitem id="fpwd-rescinded-del">diff group fpwd-rescinded-del:
marks some paragraphs marked as deleted in the first public working draft but
since restored.</sitem>
<sitem id="aatf">diff group aatf: anyAtomicType (RQ-141).  Changes decided on
by WG at Redwood Shores ftf 2004-11-10.
Draft final wording approved (with changes) 2005-02-04.</sitem>
<sitem id="aatj">diff group aatj: anyAtomicType (RQ-141).  Proposal for change,
submitted to WG at Brisbane, January 2005 (hence the 'j').
Final wording approved (with changes) 2005-02-04.</sitem>
<sitem id="aatg">diff group aatg: anyAtomicType (RQ-141).  Changes to
correct errors found in review of aatf, including changes agreed
by WG in telcon of 2005-02-04 when the RQ-141 proposal was 
approved.</sitem>
<sitem id="vrd">diff group vrd: make validation rules declarative.  
Not yet complete.  Stems from rq31m edits:  first cut at editing
the upper and lower bounds facets included reformulation of the
validation rules to talk about numeric value.  When the order
relation for numeric values and pDecimal values was defined, however,
it became clear that the validation rules didn't need that change,
and the remaining change (making them declarative) didn't really
have anything to do with anyAtomicType.</sitem>
<sitem id="fpwd">diff group fpwd: used to mark things that changed
between 1.0 2E and the first public working draft of July 2004.
(N.B. issues elements and editorial notes are not consistently
marked as added.  They may consistently be unmarked.)</sitem>
<sitem id="rq001">diff group rq001: marks a phase-2 proposal to resolve
requirement RQ-001, adopted by the WG on 2 March 2004.</sitem>
<sitem id="rq31fix">diff group rq31fix: marks some wording changes
intended to address problems identified by Dave Peterson,
Sandy Gao, and Noah Mendelsohn after the draft final wording 
for RQ-31 went to the WG.</sitem>
<sitem id="ep01">Micro-component-related changes</sitem>
<sitem id="wd2hax">Last-minute hacks to make the Working Draft
of February 2005 be valid and produce valid clean HTML.</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" dg="fpwd">
   <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 <phrase diff="add" dg="iff">and only if</phrase> 
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>

<div1 id="typesystem">
<head><phrase diff="del" dg="fa1">Type</phrase><phrase diff="add" dg="fa1">Datatype</phrase> System</head>

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

<p>This section describes the conceptual framework behind the 
<phrase diff="add" dg="fa1">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" dg="fa1">computer
representations of</phrase><phrase diff="add" dg="fa1">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" dg="fa1">thoroughly </phrase>define these abstract concepts; many other publications
provide excellent definitions.<phrase diff="add" dg="fa1">  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" dg="fa1">
<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>
<!--* !!! newOrg assigns the id 'datatypes' to the section that contains
    * the following paragraphs.  At the moment, I have not followed that 
    * change.  -msm
    *-->
<p diff="del" dg="fa1">
<termdef id="del-dt-datatype" 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="del-dt-facet"/>s
that characterize properties of the <termref def="dt-value-space"/>,
individual values or lexical items.
</termdef>
</p>



<p diff="add" dg="fa1"><termdef term="datatype" id="dt-datatype">In this specification, 
a <term>datatype</term> <phrase diff="del" dg="wdd">is a thing with four</phrase><phrase diff="add" dg="wdd">has three</phrase> properties</termdef>:

<ulist><item>
<p>A <termref def="dt-value-space"></termref>, which is 
<phrase diff="del" dg="wdd">simply </phrase>a set<phrase diff="add" dg="wdd"> of values</phrase>.
<phrase diff="del" dg="wdd">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.</phrase></p>
</item>
<item>
<p>A <termref def="dt-lexical-space"></termref>, which is <phrase diff="del" dg="wdd">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></phrase><phrase diff="add" dg="wdd">a set of &string;s used to denote the values</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>
</item>
<item diff="del" dg="wdd">
<!--* 2005-02-21, MSM changes the remaining two occurrences of 
    * <compref ref="dc-defn"/> to <compref ref="std"/>
    * so that the diffed display against 1.0 will work properly.
    * The target of the link, of course, is slightly different.
    *-->
<p>A <compref ref="std"/>, which serves to define and/or identify the datatype.</p>
</item>
</ulist>
</p>

<!--* !!! N.B. in the WD, the following note was in the penultimate list item, 
    * not after the list. We don't have good transposition markup, so I am 
    * leaving the movement unmarked.  -MSM *-->
<!--* <ednote diff="add" dg="wdd"><edtext>Do we want to delete the following Note?</edtext></ednote> *-->

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

<p>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" dg="fa1"><termdef id="del-dt-value-space" 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" dg="fa1"><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" dg="fa1">The value spaces of datatypes are abstractions,
and are defined in <specref ref="built-in-datatypes"/> 
<!--* n.b. newOrg deletes 'built-in-datatypes' and inserts a
    * section with ID builtinSTDs, changing some but not all
    * pointers to built-in-datatypes to the new ID.
    * For the moment, I've left all of them at 'built-in-datatypes'. -msm
    *-->
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" dg="fa1">
<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" dg="fa1">given </phrase>datatype can
be defined in one of the following ways:
<ulist>
<item><p>defined<phrase diff="add" dg="fa1"> elsewhere</phrase> axiomatically from fundamental notions
(intensional definition)
[see <termref def="dt-primitive"/>]</p>
</item>
<item><p>enumerated outright<phrase diff="add" dg="fa1"> 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" dg="fa1">
<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="del-fundamental-facets"/>.
</p>

<p diff="add" dg="fa1">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" dg="fa1" id="identity">
<head> Identity</head>

<!--* <ednote diff="add" dg="wdd"><edtext>IIRC, someone in the WG pointed out a third situation where identity is used, but I can't find any reference.</edtext></ednote> *-->
<p>The identity relation is always defined. Every value space inherently has an 
identity relation. Two things are 
<emph>identical</emph> 
if <phrase diff="add" dg="iff">and only if</phrase> 
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
identity constraints.&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" dg="fa1" 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 <phrase diff="del" dg="dt2">timezone
Z</phrase><phrase diff="add" dg="dt2"><termref def="dt-utc"></termref></phrase>;
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 a<phrase diff="del" dg="wdd">n</phrase> 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" dg="fa1" 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 <termref def="dt-incomparable"></termref>. 
<termdef term="incomparable" id="dt-incomparable" diff="add" dg="wdd">Two
values that are neither equal, less-than, nor greater-than are 
<term>incomparable</term>.
<phrase diff="add" dg="fa1-fix">Two
values that are not <termref def="dt-incomparable"/> are 
<term>comparable</term>.</phrase></termdef>
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 

<termref def="dt-incomparable"></termref> relation by <mention>&lt;&gt;</mention>, each used as a<phrase diff="del" dg="wdd">n</phrase> 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 <termref def="dt-incomparable"></termref> 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 <termref def="dt-incomparable"></termref>.&nbsp; For example,
the numbers two and three are values in both the <phrase diff="del" dg="wdd">decimal</phrase><phrase diff="add" dg="wdd">&pD;</phrase> 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 <termref def="dt-incomparable"></termref> 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" dg="fa1"><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="del-dt-lexical-space">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="del-canonical-lexical-representation">
<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="del-dt-canonical-representation">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" dg="fa1"><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="f-p"/> 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="del.facets" diff="del" dg="fa1.z">
<!--* !!! this section was not deleted in the first public working draft.  I think
    * this means fa1 should be split into pre-WD and post-WD bits.  This is a post-WD
    * bit of fa1. -msm *-->
<head>Facets</head>

<issue id="del-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>
<termdef id="del-dt-facet" 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" dg="fpwd-rescinded-del"><!--* !!! This para marked as 
   deleted in first public WD. -msm *-->
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" dg="fpwd-rescinded-del"><!--* !!! This para marked 
   as deleted in first public WD. -msm *-->
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>

<!--* !!! the following paragraph was marked 'add' in the first public WD
    * and subsequently (re-)deleted.
    * We'd need stronger diff markup than we currently have to make
    * that history clear.  So for the moment I content myself with giving
    * it a unique dg identifier. -->
<p diff="add" dg="fpwd-rescinded-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>
				
<!--* !!! the following paragraph was marked 'add' in the first public WD
    * and subsequently (re-)deleted. *-->
<p diff="add" dg="fpwd-rescinded-add">
Facets are of two kinds:&nbsp;
<termdef term="information facet" id="dt-fundamental-facet_rescinded"><term>information facets</term> provide the
application with some information about the datatype</termdef>, and 
<termdef term="&cfacet;" id="dt-constraining-facet_rescinded"><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-->

<!--* !!! the following note was marked 'add' in the first public WD
    * and subsequently (re-)deleted. *-->
<note diff="add" dg="fpwd-rescinded-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="del-fundamental-facets" diff="del" dg="fa1">
<head>Fundamental facets</head>
<p>
<termdef id="del-dt-fundamental-facet" 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="del-non-fundamental" diff="del" dg="fa1">
<head>Constraining or Non-fundamental facets</head>
<p>
<termdef id="del-dt-constraining-facet" 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" dg="trm1" diff="del">
<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.<phrase diff="add" dg="aat">&nbsp; <term>Atomic</term> 
datatypes are <!--* <phrase diff="del" dg="aatj">those derived 
from <dtref ref="anyAtomicType"/></phrase> *-->
<dtref ref="anyAtomicType"/> and all
datatypes derived from it.</phrase></termdef></p></item>
<item>
<p><termdef id="del-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.
<phrase dg="aat1" diff="add">&nbsp; <term>List</term> datatypes are those which are explicitly constructed as lists, or are derived from another <term>list</term> datatype.</phrase>
</termdef>
</p>
</item>
<item>
<p>
<termdef id="del-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.<phrase dg="aat1" diff="add">&nbsp; <term>Union</term> datatypes are those which are explicitly constructed as lists, or are derived from another <term>union</term> datatype.</phrase>
</termdef>
</p>
</item>
</ulist>
<p>
For example, a single token which <termref def="dt-match">matches</termref>
<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>
<phrase diff="del" dg="aatf">
<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; 
</phrase>
<phrase diff="add" dg="aatf">An <termref def="dt-atomic"/> datatype
has a <termref def="dt-value-space"/> consisting of a set of
<unusual>atomic</unusual> values which for purposes of this specification
are not further decomposable.&nbsp;</phrase> 
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.
<phrase diff="add" dg="aatf">There is one <unusual>special</unusual>
atomic type (<dtref ref="anyAtomicType"/>) and a number of
<termref def="dt-primitive"/> atomic types, which have
<dtref ref="anyAtomicType"/> as their base type.
All other atomic types are derived by restriction either from 
one of the primitive atomic types or from another ordinary atomic 
type.  No user-defined type may have <dtref ref="anyAtomicType"/> 
as its base type.</phrase>
</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 
<!--* WG suppresses this 'ordinary', 2005-02-04 *-->
<!--* <phrase diff="add" dg="aatf">ordinary </phrase> *-->
<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 <phrase diff="add" dg="aatf">ordinary </phrase><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 comp="std" prop="member type definitions"/>'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'&gt;
this is not list item 1
this is not list item 2
this is not list item 3
&lt;/someElement&gt;
</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 <phrase diff="add" dg="aatf">ordinary
</phrase><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&gt; children of the &lt;union&gt;
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&gt; 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 <unusual>atomic</unusual> 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>
<!--* !!! this was not marked as deleted in WD of July 2004.
    * When fa1 is split, this is post-wd
    *-->
<div3 role="1.0" id="primitive-vs-derived">
<head>Primitive vs. <phrase diff="del" dg="fa1.z">derived datatypes</phrase><phrase diff="add" dg="fa1.z">Constructed Datatypes</phrase></head>
<p>
Next, we distinguish between <termref def="dt-primitive"/><phrase diff="add" dg="fa1.z">, 
<termref def="dt-constructed"/>,</phrase> 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 diff="del" dg="fa1.z">
<termdef id="quondam-dt-derived" term="derived"><term>Derived</term>
datatypes are those that are defined in terms of other datatypes.
</termdef>
</p>
<p diff="add" dg="fa1.z"><termdef id="dt-constructed" term="constructed"><term>Constructed</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="diff-RQ-141i" role="1.1" diff="del" dg="aat">
<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 <term>special</term> datatype will be introduced as a child
of anySimpleType and the base type of all primitive atomic datatypes.</p>
</issue>
<p>
<termdef id="dt-anySimpleType" term="anySimpleType" role="local">
The <phrase diff="del" dg="aatf">simple ur-type definition</phrase><phrase diff="add" dg="aatf">definition of <dtref ref="anySimpleType"/></phrase>
is a special restriction of 
<phrase diff="del" dg="aatf">the <xtermref href="&xsdl;#key-urType">ur-type definition</xtermref>
whose name is <term>anySimpleType</term> in the XML Schema namespace</phrase><phrase diff="add" dg="aatf"><dtref ref="anyType"/></phrase>.
<phrase diff="del" dg="aatg"><term>anySimpleType</term> can be
considered as the <termref def="dt-basetype"/> of all <termref def="dt-primitive"/>
datatypes.</phrase>
<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 <termref def="dt-restriction"/>
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>

<div2 id="dtAndSch" diff="add" dg="trm1">
<head>Datatypes and Schemas</head>

<p>Datatypes as defined above exist, in the abstract, independently of
whether they have any relation to schemas as defined in this
specification.&nbsp; Datatypes are tied to schemas either by explicit
description in this specification, or by user mechanisms prescribed in
this specdification for use in user-created schemas.</p>
<p>The user-usable mechanism prescribed by this specification is the
ability to add additional <compref ref="std"/>s to schemas.&nbsp;
<compref ref="std"/>s and their use within schemas are described in
<specref ref="dc-defn"/>.&nbsp; A <compref ref="std"/> selects a
particular datatype and gives it a name and a place in the
schema&apos;s <phrase role="UNSURE">datatype hierarchy</phrase>, which
is a structuring of all the datatypes associated with a schema.</p>

<div3 id="dtDerivHier">
<head>The Datatype Derivation Hierarchy</head>

<p>Datatypes associated with a schema are organized in a hierarchy
that exactly parallels the datatypes&apos; defining (or selecting)
<compref ref="std"/>s in the  schema&apos;s corresponding <phrase role="UNSURE">schema type hierarchy</phrase>, as described in <specref ref="dc-defn"/>.&nbsp; <termdef id="dt-immediately-derived" term="immediately derived">A datatype is <term>immediately
derived</term> from another 
if <phrase diff="add" dg="iff">and only if</phrase> 
it is immediately below the other
(i.e., away from the root) in the derivation
hierarchy.</termdef>&nbsp; <termdef id="dt-base-type" term="base
type">A datatype is the <term>base type</term> of another 
if <phrase diff="add" dg="iff">and only if</phrase> 
the other
is immediately derived from it.</termdef>&nbsp; <termdef id="add_trm1-dt-derived" term="derived">A datatype is <term>derived</term> from
another 
if <phrase diff="add" dg="iff">and only if</phrase> 
there is a chain of <termref def="dt-immediately-derived"></termref> datatypes beginning with it
and ending with the other.</termdef>&nbsp; It is often easiest to
determine a datatype&apos;s location in the hierarchy by examining the
corresponding <compref ref="std"/> in the <phrase role="UNSURE">schema
type hierarchy</phrase>.</p><p>At the root of the hierarchy are two
special datatypes, <dtref ref="anySimpleType"/> and <dtref ref="anyAtomicType"/>.&nbsp; <dtref ref="anySimpleType"/> is the real
root; <dtref ref="anyAtomicType"/> is <termref def="dt-immediately-derived"></termref> from <dtref ref="anySimpleType"/>.</p><p>All other (<unusual>ordinary</unusual>)
datatypes are <termref def="dt-derived"></termref> from these two
special datatypes.&nbsp; The most important class of datatypes
<termref def="dt-immediately-derived"></termref> from these two are
the primitive datatypes, all of which are described in <specref ref="built-in-primitive-datatypes"/>.&nbsp; Starting with the
primitive datatypes, all other schema-usable datatypes are either
<phrase role="UNSURE">facet-derived</phrase>, <phrase role="UNSURE">constructed as lists</phrase>, or <phrase role="UNSURE">constructed as unions</phrase>.</p>

</div3>

<div3>
<head>Atomic, List, and Union Datatypes</head>

<p>Ordinary datatypes may be characterized as <emph>atomic</emph>,
<emph>list</emph>, or <emph>union</emph> datatypes.</p>
<p><termdef id="add_trm1_dt-atomic" term="atomic">An <term>atomic</term>
datatype is one which is <termref def="dt-derived"></termref> from
<dtref ref="anyAtomicType"/>.</termdef>&nbsp; Since only (and all)
primitive datatypes are <termref def="dt-immediately-derived"></termref> from <dtref ref="anyAtomicType"/>, all other atomic datatypes are <termref def="dt-derived"></termref> from primitives.</p>
<p><termdef id="dt-list" term="list">A <term>list</term>
datatype is one that is constructed to have lists of values from some
other datatype, or any datatype subsequently <termref def="dt-derived"></termref> from a <term>list</term> datatype
</termdef>&nbsp; <termdef id="dt-item-type" term="item type">The other
datatype from which a list datatype is constructed is the list
datatype&apos;s <term>item type</term>.</termdef>&nbsp; Datatypes that
are <phrase role="UNSURE">constructed as lists</phrase> are
<emph><termref def="dt-immediately-derived"></termref></emph>  from
<dtref ref="anySimpleType"/>, so all list datatypes are <emph><termref def="dt-derived"></termref></emph> from <dtref ref="anySimpleType"/>.</p>
<p>&nbsp; <termdef id="dt-union" term="union">A <term>union</term>
datatype is one that is constructed to have the of values from some
other datatypes, or any datatype subsequently <termref def="dt-derived"></termref> from a <term>union</term> datatype
</termdef>&nbsp; <termdef id="dt-union-type" term="union type">The
other datatypes from which a union datatype is constructed are the
union datatype&apos;s <term>member types</term>.</termdef>&nbsp;
Datatypes that are <phrase role="UNSURE">constructed as
unions</phrase> are <emph><termref def="dt-immediately-derived"></termref></emph>  from <dtref ref="anySimpleType"/>, so all union datatypes are <emph><termref def="dt-derived"></termref></emph> from <dtref ref="anySimpleType"/>.&nbsp; </p>
<p>All datatypes in the  <phrase role="UNSURE">datatype
hierarchy</phrase> of a schema that are not <emph><termref def="dt-immediately-derived"></termref></emph>  from <dtref ref="anySimpleType"/> or <dtref ref="anyAtomicType"/> are <phrase role="UNSURE">facet-derived</phrase> from their <termref def="dt-base-type">base types</termref>.&nbsp; The mechanisms of
construction and <phrase role="UNSURE">facet-derivation</phrase> are
described in <specref ref="dc-defn"/>.</p>

</div3><div3>
<head>Placing a Datatype in the Hierarchy</head>

<p>Special and primitive datatypes are placed in the hierarchy by explicit rules in this specification.&nbsp; As mentioned above, <dtref ref="anySimpleType"/> is at the root of the hierarchy, <dtref ref="anyAtomicType"/> is <termref def="dt-immediately-derived"></termref> from <dtref ref="anySimpleType"/>, and all primitive datatypes&mdash;and only primitive datatypes&mdash;are <termref def="dt-immediately-derived"></termref> from <dtref ref="anyAtomicType"/>.</p><p>A constructed datatype (<termref def="dt-list"></termref> or <termref def="dt-union"></termref>) is always <termref def="dt-immediately-derived"></termref> from <dtref ref="anySimpleType"/>.&nbsp; A <phrase role="UNSURE">facet-derived</phrase> datatype is always <termref def="dt-immediately-derived"></termref> from its <termref def="dt-base-type"></termref>.&nbsp; These are the only ways a datatype not special or primitive can be placed in a schema&apos;s <phrase role="UNSURE">datatype hierarchy</phrase>.</p><note><p>The special, primitive, and other ordinary datatypes described in this specification are present in every schema&apos;s <phrase role="UNSURE">datatype hierarchy</phrase>.&nbsp; Any others depend on the schema.</p></note>

</div3>

<div3>
<head>YYY</head>

<p><?xm-replace_text {p}?></p>

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

<div1 role="1.0" id="built-in-datatypes">
<!--* !!! n.b. newOrg gives this section the id builtinSTDs.
    * For now, I have left this ID unchanged. -msm
    *-->
<head><phrase diff="del" dg="dpno">Built-in datatypes</phrase><phrase diff="add" dg="dpno">Built-in <compref ref="std"/>s and their Datatypes</phrase></head>

<!--* <ednote diff="add" dg="wdd"><edtext>The graphic will be redrawn to show anyAtomicType and any other appropriate changes.</edtext></ednote> *-->

<!--* !!! temporary / experimental change from type-hierarchy.gif to 
    * type-hierarchy.png.  Revert when appropriate.
    *-->
<!--* 
<graphic source="type-hierarchy.gif" alt="Diagram of built-in type hierarchy" map="typeImage"/> 
*-->
<graphic map="built-in-datatype-hierarchy-image-map" id="type-hierarchy-diagram" source="type-hierarchy.png" alt="Diagram of built-in type hierarchy"/>
<!--
	thanx to Asir S Vedamuthu for creating this image map
  -->
<!--*
  <imagemap source="image-map.html" id="typeImage"/>
  <imagemap source="image-map_fullsize.html" id="typeImage"/>
*-->
<imagemap source="built-in-datatype-hierarchy.html" id="built-in-datatype-hierarchy-image-map"/>

<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 id="special-datatypes" dg="aat1" diff="add">
<!--* !!! n.b. newOrg gives this section the ID 'specialSTDs'.
    * Since 'STD' has strong and irrelevant connotations for me,
    * stemming from my youth, I have for now left the old ID here
    * and elsewhere.  -msm
    *-->
<head>Special <phrase diff="del" dg="dpno">Datatypes</phrase><phrase diff="add" dg="dpno">Simple Type Definitions</phrase></head>

<p diff="del" dg="dpno">Special datatypes</p> 

<p diff="add" dg="dpno">There are two <emph>special</emph> <compref ref="std"/>s.&nbsp; (All others are <emph>ordinary</emph>.)&nbsp; The
special <compref ref="std"/>s are, unlike the ordinary ones, more
important as <compref ref="std"/>s than as datatypes.</p>

<div3 id="anySimpleType">
<head>anySimpleType</head>
<p>xxx</p>

</div3>

<div3 id="anyAtomicType">
<head>anyAtomicType</head>
<p>xxx</p>

</div3>

</div2>

<div2 role="1.0" id="built-in-primitive-datatypes">
<!--* !!! N.B. newOrg uses the id 'primStdsAndDts'.  For the 
    * moment, I'll stick with the old ID. -msm 2005-01-09 
    *-->
<head>Primitive <phrase diff="add" dg="dpno"><compref ref="std"/>s 
and D</phrase><phrase diff="del" dg="dpno">d</phrase>atatypes</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">
<!--* !!! newOrg replaces 'string' in the following head with a dtref.
    * Similarly the 'term' in the termdef (which it deletes).
    * I'm leaving it alone for now; a single change where
    * this change is applied to all datatypes is better than a
    * piecemeal change.
    *-->
<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="ff-o"/>, the fact that this specification does
not specify an 
<phrase diff="del" dg="dpno"><phrase diff="del" dg="fa1-fix"><termref def="dt-order-relation"/></phrase><phrase diff="add" dg="fa1-fix">order relation</phrase> for 
<termref def="dt-string"/></phrase><phrase diff="add" dg="dpno">order for <dtref ref="string"/></phrase>
does not preclude other applications from treating 
<phrase diff="del" dg="dpno">strings</phrase><phrase diff="add" dg="dpno"><dtref ref="string"/></phrase> as being ordered.
</p>
</note>

<div4 role="1.0" id="string-facets">
<head>Constraining <phrase diff="del" dg="dpno">f</phrase><phrase diff="add" dg="dpno">F</phrase>acets</head>
<facets/>
</div4>

<div4 role="1.0" id="string-derived-types">
<head><phrase diff="del" dg="dpno">Derived datatypes</phrase><phrase diff="add" dg="dpno">Constructed and <termref def="dt-immediately-derived">Immediately Derived</termref> <compref ref="std"/>s</phrase></head>
<!--* Blecch!  Is there some reason this heading has to be unreadable?
    * Why not 'Related types'? *-->
<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>&Odec;</head>

<issue id="RQ-150i" role="1.1">
<p><loc href="&reqs;#composition" target="reqs">RQ-150 (minimum number of digits for decimal)</loc></p>
<p>The minimum number of digits implementations are required to support
will be lowered to 16 digits; a health warning will be added to note 
that implementations of derived datatypes may support more digits of
precision than the base decimal type does, but that they are not required
to do so.</p>
</issue>

<p>
<termdef id="dt-decimal" term="&odec_;" role="local"><term>&odec;</term>
represents a subset of the real numbers, which can be represented by decimal numerals.
<!--* ah, how about "the subset of the real numbers which can
be represented by finite-length decimal numerals" ? *-->
The <termref def="dt-value-space"/> of <term>&odec;</term>
is the set of numbers that can be obtained by 
<phrase diff="del" dg="rq31m">multiplying</phrase><phrase diff="add" dg="rq31m">dividing</phrase> 
an integer by a non-<phrase diff="del" dg="rq31m">positive</phrase><phrase diff="add" dg="rq31m">negative</phrase>
power of ten, i.e., expressible as 
<phrase diff="del" dg="rq31m"><emph role="eq">i &times; 10^-n</emph></phrase><phrase diff="add" dg="rq31m"><var>i</var>&nbsp;/&nbsp;10<sup><var>n</var></sup></phrase>
where <var>i</var> and <var>n</var> are integers
and 
<phrase diff="del" dg="rq31m"><emph role="eq">n &gt;= 0</emph></phrase><phrase diff="add" dg="rq31m"><var>n</var>&nbsp;&ge;&nbsp;0</phrase>.
Precision is not reflected in this value space;
the number 2.0 is not distinct from the number 2.00.
<phrase diff="add" dg="rq31m">(The datatype <dtref ref="&pD;"/> may be used
for values in which precision is significant.)</phrase>
The <phrase diff="del" dg="fa1-fix"><termref def="dt-order-relation"/></phrase><phrase diff="add" dg="fa1-fix">order relation</phrase> on <term>&odec;</term>
is the order relation on real numbers, restricted
to this subset.
</termdef>
</p>
<note><p>All <termref def="dt-minimally-conforming"/> processors
<termref def="dt-must"/> support &odec; numbers with a minimum of
<phrase diff="del" dg="rq31m">18</phrase><phrase diff="add" dg="rq31m">16</phrase> decimal digits 
(i.e., <phrase diff="del" dg="rq31m">with a 
<termref def="dt-totalDigits"/></phrase> of 18<phrase diff="add" dg="rq31m">they must support all values which would be
allowed by a simple type definition which set
<compref ref="f-td"/> to 16</phrase>).&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>&odec;</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>
<p diff="add" dg="rq31m"><defset>
<head>The <dtref ref="&odec;"/> Lexical Representation</head>
<prod id="nt-&odec;Rep"><lhs>&odec;LexicalRep</lhs>
<rhs><nt def="nt-decNuml"/>&nbsp;| <nt def="nt-noDecNuml"/></rhs></prod>
</defset></p>

<p diff="add" dg="rq31m">The lexical space of &odec; is the set of
lexical representations which match the grammar given above, or
(equivalently) the regular expression
<string>-?(([0-9]+(.[0-9]*)?)|(.[0-9]+))</string>.
</p>

<p diff="add" dg="rq31m">
The mapping from lexical representations to values is the usual
one for decimal numerals; it is given formally in:
<defsetsum ref="defs-&odec;Lexmap"/>
</p>
</div4>

<div4 role="1.0" id="decimal-canonical-representation">
<head>Canonical representation</head>
<p>
The canonical representation for <term>&odec;</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>
<p diff="add" dg="rq31m">
The mapping from values to canonical representations 
is given formally in:
<defsetsum ref="defs-&odec;Canmap"/>
</p>
</div4>

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

<div4 role="1.0" id="decimal-derived-types">
<head><phrase diff="del" dg="rq31m">Derived datatypes</phrase><phrase diff="add" dg="rq31m">Datatypes based on &odec;</phrase></head>
<subtypes/>
</div4>
</div3>

<div3 id="&pD;" diff="add" dg="pd1"><head>&pD;</head>

<!--* <ednote diff="del" dg="rq31fix">
<edtext>For technical reasons rooted in the editorial
production system, the old primitive decimal type and the two new
decimal types must all have distinct names.  In the current form of
this proposal, the old decimal type is called &ldquo;decimal&rdquo;
(or in some places &ldquo;&odec_;&rdquo;), the new decimal type which
carries information about precision is called &ldquo;&pD;&rdquo;, and
the new decimal type which corresponds most closely to &odec_; is
called &ldquo;&dec;&rdquo;.  
Eventually the editorial system will be changed to allow more than
one of these types to have the same name, but that is not likely for
the foreseeable future.  So the reader should bear in mind that the
names of the types given here are not the final names.
</edtext></ednote> *-->

<!-- satisfied issues disappear -->
<!--* <issue id="RQ-31i" role="1.1" dg="rq31fix" diff="del">
<p><loc href="&reqs;#trailing-zeroes" target="reqs">RQ-31
(precisionDecimal)</loc></p>
<p>This draft describes a new type named (for now) 
&ldquo;precisionDecimal&rdquo;,
which is intended to satisfy requirement RQ-31.&nbsp; It is possible that
this new type will replace the old decimal type.</p>
</issue> *-->

<!--* <issue id="RQ-30i" role="1.1" dg="rq31fix" diff="del">
<p><loc href="&reqs;#negative-scale" target="reqs">RQ-30
(negative fractionDigits for decimal)</loc></p>
<p>The <dtref ref="&pD;"/> type allows negative values for the fractionDigits
facet.</p>
</issue> *-->

<!--* <issue id="RQ-28i" role="1.1" dg="rq31fix" diff="del">
<p><loc href="&reqs;#scientific-notn" target="reqs">RQ-28 (scientific notation for decimal)</loc></p>
<p>The <dtref ref="&pD;"/> type allows exponential notation.</p>
</issue> *-->

<p><termdef id="dt-precisionDecimal" term="&pD;">The <term>&pD;</term>
datatype represents <phrase diff="del" dg="rq31fix">decimal numbers, together 
with their (arithmetic) precision</phrase><phrase diff="add" dg="rq31fix">the
numeric value and (arithmetic) precision of decimal numbers which retain
precision</phrase>; it also 
includes special values for positive and negative infinity and 
<unusual>not a number</unusual>, and it differentiates
between <unusual>positive zero</unusual> and <unusual>negative
zero</unusual>.</termdef>&nbsp; The special values are
introduced to make the datatype correspond closely to 
<phrase diff="del" dg="rq31fix"><phrase role="UNSURE">decimal datatypes 
whose definition is planned for the
next revision of IEEE/ANSI 754</phrase></phrase><phrase diff="add" dg="rq31fix">the
floating-point decimal datatypes described by the forthcoming
revision of IEEE/ANSI 754</phrase>.</p>

<p>Precision is sometimes given in absolute, sometimes in relative
terms.  <termdef id="dt-arithmetic-precision" term="arithmetic
precision">The <term>arithmetic precision</term> of a value is
expressed in absolute quantitative terms,
<phrase diff="add" dg="rq31fix">by </phrase>indicating
how many digits to the right of the decimal point are significant.</termdef>
<quote>5</quote> has an arithmetic precision of 0, and 
<quote>5.01</quote> an arithmetic precision of 2.
</p>

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

<defset><head alt="Properties of &pD; Values">Properties of
<dtref ref="&pD;"/> 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">arithmeticPrecision</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.<phrase diff="del" dg="rq31fix">&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.</phrase></p></note>

<note><p>As explained below, the lexical
representation of the <dtref ref="&pD;"/> 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>.
The latter two together are called
<quote>the infinities</quote>.</p></note>

<p>Equality and order for <dtref ref="&pD;"/> are defined as follows:
<ulist>
<item>
<p>Two numerical <dtref ref="&pD;"/> values
are ordered (or equal) as their
<pfref ref="vp-pd-numVal"/> values are ordered (or equal).&nbsp; 
(This means 
<phrase diff="del" dg="rq31fix">the</phrase><phrase diff="add" dg="rq31fix">that</phrase> 
two zeros with <phrase diff="del" dg="rq31fix">a given 
<pfref ref="vp-pd-precision"/> but</phrase> 
different <pfref ref="vp-pd-sign"/><phrase diff="add" dg="rq31fix">s</phrase> 
are <emph>equal</emph>;
negative zeros are <emph>not</emph> ordered less than positive zeros.)</p></item>
<item diff="del" dg="rq31fix">
<p>A numerical value <var>n</var>
is less than, equal to, or greater than
and a <dtref ref="&pD;"/> value <var>v</var> other than INF, -INF, or NaN
as <var>n</var> is less than, equal to, or greater than
the <pfref ref="vp-pd-numVal"/> of <var>v</var>.
(This comparison is necessary when comparing <dtref ref="&pD;"/>
values to upper and lower bounds.)</p></item>
<item>
<p>INF is equal only to itself, and is greater than
&minus;INF and all numerical <dtref ref="&pD;"/> values.</p></item>
<item>
<p>&minus;INF is equal only to itself, and is less than
INF and all numerical <dtref ref="&pD;"/> 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>

<p><dtref ref="&pD;"/>'s lexical space is the set of all 
decimal numerals with or without a decimal
point, numerals in scientific (exponential) notation, and
the character strings <string>INF</string>,
<string>+INF</string>, <string>-INF</string>,
and <string>NaN</string>.&nbsp; 
The <compref ref="f-lm"/> 
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="f-p"/> 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>
<prod id="nt-precDecRep">
<lhs>p<phrase diff="del" dg="rq31fix">recision</phrase>DecimalRep</lhs>
<rhs><nt def="nt-noDecNuml"/>&nbsp;| <nt def="nt-decNuml"/>&nbsp;|
<nt def="nt-sciNuml"/>&nbsp;| <nt def="nt-numSpecReps"/></rhs>
</prod>
</defset>
</p>

<p diff="add" dg="rq31fix">The lexical mapping and canonical mapping 
for <dtref ref="&pD;"/> are the following functions:

<defsetsum ref="defs-precDecLexmap"/>
<defsetsum ref="defs-precDecCanmap"/>
</p>
</div4>

<div4>
<head>Simple Type Definition for &pD;</head>
<p>The <compref ref="std"/> of <dtref ref="&pD;"/> is present in every
schema.&nbsp; It has the following properties:</p>

<schemaComp id="pD-def">
<head alt="Simple Type Definition of &pD;"><compref ref="std"/> of 
<dtref ref="duration"/></head>

<pvlist>
<pvpair comp="std" prop="name"><string>&pD;</string></pvpair>
<pvpair comp="std" prop="target namespace"><string>http://www.w3.org/2001/XMLSchema</string></pvpair>
<pvpair comp="std" prop="base type definition">The
<dtref ref="anyAtomicType" role="def"/></pvpair>
<pvpair comp="std" prop="final">The empty set</pvpair>
<pvpair comp="std" prop="variety"><pt>atomic</pt></pvpair>
<pvpair comp="std" prop="primitive type definition"><dtref ref="&pD;"/></pvpair>
<pvpair comp="std" prop="facets">{<ulist>
<item><p>a <compref ref="f-w"/> facet with 
<propref comp="f-w" prop="value"/> = <pt>collapse</pt> and
<propref comp="f-w" prop="fixed"/> = <pt>true</pt>
</p>
</item>
<item>
<p>a <compref ref="f-lm"/> facet with the value 
<pt>{nodecimal, decimal, scientific}</pt></p>
</item>
</ulist>}
</pvpair>
<pvpair comp="std" prop="fundamental facets"><p>{<ulist>
<item><p>an <compref ref="ff-o"/> facet
with <propref comp="ff-o" prop="value"/> = <pt>total</pt></p></item>
<item><p>a <compref ref="ff-b"/> facet
with <propref comp="ff-b" prop="value"/> = <pt>false</pt></p></item>
<item><p>a <compref ref="ff-c"/> facet
with <propref comp="ff-c" prop="value"/> = <pt>countable</pt></p></item>
<item><p>a <compref ref="ff-n"/> facet
with <propref comp="ff-n" prop="value"/> = <pt>true</pt></p></item>
</ulist>}</p>
</pvpair>
<pvpair comp="std" prop="scope"><pt>global</pt></pvpair>
<pvpair comp="std" prop="item type definition"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="member type definitions"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="annotations">The empty sequence</pvpair>
</pvlist>
</schemaComp>
</div4>

<div4>
<head>&CFacet;s</head>
<facets/>
</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 <phrase diff="del" dg="fa1-fix"><termref def="dt-order-relation"/></phrase><phrase diff="add" dg="fa1-fix">order relation</phrase> 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-incomparable">comparable</termref> 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
<string>E</string> or <string>e</string>, 
followed by an exponent.&nbsp; The exponent <termref def="dt-must"/>
be an <dtref ref="integer"/>.&nbsp; The mantissa must be a 
<dtref ref="decimal"/> number.&nbsp; The representations
for exponent and mantissa must follow the lexical rules for
<dtref ref="integer"/> and <dtref ref="decimal"/>.&nbsp; If the 
<string>E</string> or <string>e</string> 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 diff="del" dg="rq001">
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>

<!--* 2005-02-03 MSM sighs at the use of "mantissa" in the following
paragraph, which he believes is not quite right. The dictionary of
mathematics at mathworld.wolfram.com says

    For a real number x, the mantissa is defined as the positive
    fractional part x-\left\lfloor{x}\right\rfloor ={\tt frac(x)}, 
    where \left\lfloor{x}\right\rfloor denotes the floor function. 

But it's what the WG approved.  If an editorial proposal is made
to change it, change the other occurrences, too (e.g. in double).
*-->
<p diff="add" dg="rq001">
NaN has the canonical form <string>NaN</string>.&nbsp; Infinity and
negative infinity have the canonical forms <string>INF</string> and
<string>-INF</string> respectively.&nbsp; Besides these special
values, the general form of the canonical form for float
is a mantissa, which is a decimal, followed by <string>E</string>
followed by an exponent which is an integer.&nbsp; Leading zeroes and
the preceding optional <string>+</string> sign are prohibited in the
exponent.&nbsp; If the exponent is zero it must be indicated by
<string>E0</string>.&nbsp; For the mantissa, the preceding optional
<string>+</string> sign is prohibited and the decimal point is
required.&nbsp; 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 form of
positive zero is 0.0E0.&nbsp; The canonical form for negative zero
is -0.0E0.&nbsp; Beyond the one required digit after the decimal point
in the mantissa, there must be as many, but only as many, additional
digits as are needed to uniquely distinguish the value from all other
values for the datatype after rounding.
</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 <phrase diff="del" dg="fa1-fix"><termref def="dt-order-relation"/></phrase><phrase diff="add" dg="fa1-fix">order relation</phrase> 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-incomparable">comparable</termref> 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 <dtref ref="decimal"/> number.&nbsp; The representations
for exponent and mantissa must follow the lexical rules for
<dtref ref="integer"/> and 
<dtref ref="decimal"/>.&nbsp; If the <string>E</string> or <string>e</string> 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 diff="del" dg="rq001">
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>
<p diff="add" dg="rq001">
NaN has the canonical form <string>NaN</string>.&nbsp; Infinity and
negative infinity have the canonical forms <string>INF</string> and
<string>-INF</string> respectively.&nbsp; Besides these special
values, the general form of the canonical form for double  
is a mantissa, which is a decimal, followed by <string>E</string>
followed by an exponent which is an integer.&nbsp; Leading zeroes and
the preceding optional <string>+</string> sign are prohibited in the
exponent.&nbsp; If the exponent is zero it must be indicated by
<string>E0</string>.&nbsp; For the mantissa, the preceding optional
<string>+</string> sign is prohibited and the decimal point is
required.&nbsp; 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 form of
positive zero is 0.0E0.&nbsp; The canonical form for negative zero
is -0.0E0.&nbsp; Beyond the one required digit after the decimal point
in the mantissa, there must be as many, but only as many, additional
digits as are needed to uniquely distinguish the value from all other
values for the datatype after rounding.
</p>
</div4>

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

<p diff="del" dg="du0">
<termdef id="del-dt-duration" term="duration" role="local">
<term>duration</term> represents a duration of time.  The <termref
def="dt-value-space"/> of <term>duration</term> is a six-dimensional
space where the coordinates designate the Gregorian year, month, day,
hour, minute, and second components defined in &sect; 5.5.3.2 of
<bibref ref="ISO8601"/>, respectively.  These components are ordered
in their significance by their order of appearance i.e. as year,
month, day, hour, minute, and second.  </termdef></p>

<note id="del-year-sec-conformance" diff="del" dg="du0">
<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>
<!--* n.b. newOrg removes the termdef here and retags the term
    * as a dtref.  As with string, I have foreborne to follow
    * suit, just yet. -msm 2005-01-09
    *-->

<p diff="add" dg="du0"><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 <quote><string>P15D</string></quote>) 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.&nbsp; <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"/> <phrase diff="del" dg="dpno">is</phrase><phrase
diff="add" dg="dpno">are</phrase> required for XML Schema processing
and <phrase diff="del" dg="dpno">is</phrase><phrase diff="add"
dg="dpno">are</phrase> defined in <specref
ref="adding-durations-to-dateTimes"/>.</p>

<!--* !!! n.b. newOrg suppresses the specref above, substituting TBD.
    * I've left it as is for now.  -msm 2005-01-09 *-->

<div4 diff="add" dg="dpno"><head>The <dtref ref="duration"/> <compref ref="std"/></head>

<p>The <compref ref="std"/> of <dtref ref="duration"/> is present in every
schema.&nbsp; It has the following properties:</p>

<schemaComp id="duration-def">
<head alt="Simple Type Definition of duration"><compref ref="std"/> of 
<dtref ref="duration"/></head>

<pvlist>
<pvpair comp="std" prop="name"><string>duration</string></pvpair>
<pvpair comp="std" prop="target namespace"><string>http://www.w3.org/2001/XMLSchema</string></pvpair>
<pvpair comp="std" prop="base type definition">The <dtref ref="anyAtomicType" role="def"/></pvpair>
<pvpair comp="std" prop="final">The empty set</pvpair>
<pvpair comp="std" prop="variety"><pt>atomic</pt></pvpair>
<pvpair comp="std" prop="primitive type definition"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="facets">{a <compref ref="f-w"/> facet}</pvpair>
<pvpair comp="std" prop="fundamental facets"><phrase role="UNSURE">TBD</phrase></pvpair>
<pvpair comp="std" prop="scope"><phrase role="UNSURE">TBD</phrase></pvpair>
<pvpair comp="std" prop="item type definition"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="member type definitions"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="annotations">The empty sequence</pvpair>
</pvlist>
</schemaComp>

<p>The <compref ref="f-w"/> facet in the 
<dtref ref="duration" role="def"/>&apos;s <propref comp="std" prop="facets"/>
has the following properties:

<schemaComp id="duration-whiteSpace-def">
<head><compref ref="f-w"/> Facet of the
<dtref ref="duration" role="def"/></head>

<pvlist>
<!--* 2005-01-09 : MSM : change 'rf-w' to 'f-w' in these 3 lines. *-->
<pvpair comp="f-w" prop="value"><pt>collapse</pt></pvpair>
<pvpair comp="f-w" prop="fixed"><pt>false</pt></pvpair>
<pvpair comp="f-w" prop="annotations">The empty sequence</pvpair>
</pvlist>
</schemaComp>

</p>
</div4>

<div4 diff="add" dg="du0"><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="&pD;"/>
<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>

<!--* !!! n.b. newOrg moves the following paragraph to another location. *-->
<note id="two_totally_ordered_subtypes">
<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>

<!--* !!! n.b. newOrg moves the note 'two_totally_ordered_subtypes' from another
    * location to this point.  I'm leaving it alone for now. *-->

</div4>

<div4 id="duration-lexical-repr" diff="del" dg="du0">
<head>Lexical representation</head>
<p>
The lexical representation for <term>duration</term> is the
<bibref ref="ISO8601"/> extended format P<emph>n</emph>Y<emph>n</emph>
M<emph>n</emph>DT<emph>n</emph>H <emph>n</emph>M<emph>n</emph>S, where
<emph>n</emph>Y represents the number of years, <emph>n</emph>M the
number of months, <emph>n</emph>D the number of days, 'T' is the
date/time separator, <emph>n</emph>H the number of hours,
<emph>n</emph>M the number of minutes and <emph>n</emph>S the
number of seconds.  The number of seconds can include decimal digits
to arbitrary precision.</p>
<p>
The values of the
Year, Month, Day, Hour and Minutes components are not restricted but
allow an arbitrary
<phrase diff="add">unsigned</phrase> integer<phrase diff="add">, i.e., an integer that
conforms to the pattern <code>[0-9]+</code>.</phrase>.
Similarly, the value of the Seconds component
allows an arbitrary <phrase diff="add">unsigned</phrase> decimal.
<phrase diff="add">Following <bibref ref="ISO8601"/>, at least one digit must
follow the decimal point if it appears.  That is, the value of the Seconds component
must conform to the pattern <code>[0-9]+(\.[0-9]+)?</code>.</phrase>
Thus, the lexical representation of
<term>duration</term> does not follow the alternative
format of &sect; 5.5.3.2.1 of <bibref ref="ISO8601"/>.</p>
<p>
An optional preceding minus sign ('-') is
allowed, to indicate a negative duration.  If the sign is omitted a
positive duration is indicated. See also <specref ref="isoformats"/>.
</p>
<p>
For example, to indicate a duration of 1 year, 2 months, 3 days, 10
hours, and 30 minutes, one would write: <code>P1Y2M3DT10H30M</code>.
One could also indicate a duration of minus 120 days as:
<code>-P120D</code>.
</p>
<p>
Reduced precision and truncated representations of this format are allowed
provided they conform to the following:
</p>
<ulist>
<item>
<p>
If the number of years, months, days, hours, minutes, or seconds in any
expression equals zero, the number and its corresponding designator <termref def="dt-may"/>
be omitted.  However, at least one number and its designator <termref def="dt-must"/>
be present.
</p>
</item>
<item>
<p>
The seconds part <termref def="dt-may"/> have a decimal fraction.
</p>
</item>
<!-- INTERIOR FIELDS DISALLOWED FOR TIME INSTANT NOT DURATION
<item>If a field is omitted either all fields to its left or to its right
must be omitted i.e. interior fields cannot be omitted.</item>  -->
<item>
<p>
The designator 'T' <phrase diff="add">must</phrase><phrase diff="del">shall</phrase>
be absent if <phrase diff="add">and only if</phrase> all of the time items are absent.
The designator 'P' must always be present.
</p>
</item>
</ulist>
<p>
For example, P1347Y, P1347M and P1Y2MT2H are all allowed;
P0Y1347M and P0Y1347M0D are allowed. P-1347M is not allowed although
-P1347M is allowed.  P1Y2MT is not allowed.
</p>

</div4>

<div4 id="duration-lexical-space" diff="add" dg="du0"><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>
<!--* newOrg removes the 'prodgroup' tags here.  I don't know why, so
    * I'm not touching it for now. -msm 2005-01-09 *-->
<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" dg="du1"/><nt def="nt-unsFullDecNuml" diff="add" dg="du1"/>)&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>
<!--* newOrg removes the 'prodgroup' tags here.  I don't know why, so
    * I'm not touching it for now. -msm 2005-01-09 *-->
<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" dg="du1">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 parentheses are shown as
<unusual><ghost>ghosts</ghost></unusual>; some find them helpful in reading the expression.)
</p>

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

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

<note diff="add" dg="du1">
<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 diff="add" dg="du1"><termref role="the" def="dt-canonical-mapping">The canonical
mapping</termref> for
<dtref ref="duration"/><phrase diff="add" dg="du1"> is</phrase> called
<quote><pfref ref="f-durationCanMap"/></quote> herein<phrase diff="del" dg="du1">, is defined as  follows:</phrase>.

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



<div4 id="duration-order" diff="del" dg="du0">
<head>Order relation on duration</head>
<p>
In general, the <termref def="dt-order-relation"/> on <term>duration</term>
is a partial order since there is no determinate relationship between certain
durations such as one month (P1M) and 30 days (P30D).
The <termref def="dt-order-relation"/>
of two <term>duration</term> values <emph role="eq">x</emph> and
<emph role="eq">y</emph> is <emph role="eq">x &lt; y iff s+x &lt; s+y</emph>
for each qualified <dtref ref="dateTime"/> <emph role="eq"> s</emph>
in the list below.  These values for <emph>s</emph> cause the greatest deviations in the addition of
dateTimes and durations.  Addition of durations to time instants is defined
in <specref ref="adding-durations-to-dateTimes"/>.
<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>
</p>
<p>
The following table shows the strongest relationship that can be determined
between example durations. The symbol &lt;&gt; means that the order relation is
indeterminate.  Note that because of leap-seconds, a seconds field can vary
from 59 to 60. However, because of the way that addition is defined in
<specref ref="adding-durations-to-dateTimes"/>, they are still totally ordered.
</p>
 <table border="1" cellspacing="0" cellpadding="4">
	<tbody>
    <tr>
      <th>&nbsp;</th>
      <th colspan="7" style="background-color:#FFFF99">Relation</th>
    </tr>
    <tr>
      <td style="background-color:#FFFF99">P<strong>1Y</strong></td>
      <td>&gt; P<strong>364D</strong></td>
      <td>&lt;&gt; P<strong>365D</strong></td>
      <td colspan="3">&nbsp;</td>
      <td>&lt;&gt; P<strong>366D</strong></td>
      <td>&lt; P<strong>367D</strong></td>
    </tr>
    <tr>
      <td style="background-color:#FFFF99">P<strong>1M</strong></td>
      <td>&gt; P<strong>27D</strong></td>
      <td>&lt;&gt; P<strong>28D</strong></td>
      <td colspan="2">&lt;&gt; P<strong>29D</strong></td>
      <td>&lt;&gt; P<strong>30D</strong></td>
      <td>&lt;&gt; P<strong>31D</strong></td>
      <td>&lt; P<strong>32D</strong></td>
    </tr>
    <tr>
      <td style="background-color:#FFFF99">P<strong>5M</strong></td>
      <td>&gt; P<strong>149D</strong></td>
      <td>&lt;&gt; P<strong>150D</strong></td>
      <td>&lt;&gt; P<strong>151D</strong></td>
      <td colspan="2">&lt;&gt; P<strong>152D</strong></td>
      <td>&lt;&gt; P<strong>153D</strong></td>
      <td>&lt; P<strong>154D</strong></td>
    </tr>
    </tbody>
  </table>
<p>
Implementations are free to optimize the computation of the ordering relationship. For example, the following table can be used to
compare durations of a small number of months against days.
</p>
  <table border="1" cellspacing="0" cellpadding="2">
  	<tbody>
    <tr>
      <th align="center">&nbsp;</th>
      <th align="center" style="background-color: #FFFF99">Months</th>
      <th align="center" style="background-color: #FFFF99">1</th>
      <th align="center" style="background-color: #FFFF99">2</th>
      <th align="center" style="background-color: #FFFF99">3</th>
      <th align="center" style="background-color: #FFFF99">4</th>
      <th align="center" style="background-color: #FFFF99">5</th>
      <th align="center" style="background-color: #FFFF99">6</th>
      <th align="center" style="background-color: #FFFF99">7</th>
      <th align="center" style="background-color: #FFFF99">8</th>
      <th align="center" style="background-color: #FFFF99">9</th>
      <th align="center" style="background-color: #FFFF99">10</th>
      <th align="center" style="background-color: #FFFF99">11</th>
      <th align="center" style="background-color: #FFFF99">12</th>
      <th align="center" style="background-color: #FFFF99">13</th>
      <th align="center" style="background-color: #FFFF99">...</th>
    </tr>
    <tr>
      <th align="center" rowspan="2" style="background-color: #FFFF99">Days</th>
      <th align="center" style="background-color: #FFFF99">Minimum</th>
      <td align="center">28</td>
      <td align="center">59</td>
      <td align="center">89</td>
      <td align="center">120</td>
      <td align="center">150</td>
      <td align="center">181</td>
      <td align="center">212</td>
      <td align="center">242</td>
      <td align="center">273</td>
      <td align="center">303</td>
      <td align="center">334</td>
      <td align="center">365</td>
      <td align="center">393</td>
      <td align="center">...</td>
    </tr>
    <tr>
      <th align="center" style="background-color: #FFFF99">Maximum</th>
      <td align="center">31</td>
      <td align="center">62</td>
      <td align="center">92</td>
      <td align="center">123</td>
      <td align="center">153</td>
      <td align="center">184</td>
      <td align="center">215</td>
      <td align="center">245</td>
      <td align="center">276</td>
      <td align="center">306</td>
      <td align="center">337</td>
      <td align="center">366</td>
      <td align="center">397</td>
      <td align="center">...</td>
    </tr>
	</tbody>
  </table>
</div4>

<div4 id="facet-comparison-for-durations" diff="del" dg="du0">
<head>Facet Comparison for durations</head>
<p>In comparing <term>duration</term>
values with <compref ref="dc-minInclusive"/>,  <compref ref="dc-minExclusive"/>,
<compref ref="dc-maxInclusive"/> and <compref ref="dc-maxExclusive"/> facet values
indeterminate comparisons should be considered as "false".
</p>
</div4>

<div4 id="total-order-durations">
<head>Totally ordered durations</head>
<p>
Certain derived datatypes of durations can be guaranteed have a total order. For
this, they must have fields from only one row in the list below and the time zone
must either be required or prohibited.
</p>
<ulist>
<item><p>year, month</p></item>
<item><p>day, hour, minute, second</p></item>
</ulist>
<p>
For example, a datatype could be defined to correspond to the
<bibref ref="SQL"/> datatype Year-Month interval that required a four digit
year field and a two digit month field but required all other fields to be unspecified.  This datatype could be defined as below and would have a total order.
</p>
<eg><![CDATA[<simpleType name='SQL-Year-Month-Interval'>
    <restriction base='duration'>
      <pattern value='P\p{Nd}{4}Y\p{Nd}{2}M'/>
    </restriction>
</simpleType>]]></eg>
</div4>

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

<div3 id="dateTime">
<head>dateTime</head>
<p dg="dt2" diff="del">
<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="&pD;"/>,
with integers given units of seconds.
</termdef></p>

<p dg="dt2" diff="add"><dtref ref="dateTime"/> represents
instants of time, optionally marked
with a particular timezone.&nbsp; Values representing
the same instant but having
different timezones are equal but not identical.</p>
<!--* MSM could almost persuade himself to keep the parens
    * around the second sentence above, but on balance thinks
    * they do more harm than good.
    *-->

<p diff="del" dg="dt2">
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 diff="del" dg="dt2">
All timezoned times are Coordinated Universal Time 
(<termref def="dt-utc"></termref>, sometimes called
"Greenwich Mean Time"). 
<phrase diff="add" dg="fa1-fix"><termdef term="UTC" id="del1-dt-utc"><term>Universal 
Coordinated Time</term>
(<term>UTC</term>) is an adaptation of International Atomic Time (TAI) 
which closely approximates observed astronomical time by adding 
<termref def="dt-leapsec">leap-seconds</termref> to
selected <termref def="dt-utc"></termref> days.</termdef>
<termdef id="del-dt-leapsec" term="leap-second">A
<term>leap-second</term> is an additional second added
to the last day of December, June, October, or March,
when such an adjustment is deemed necessary by the 
International Earth Rotation and Reference Systems Service
in order to keep <termref def="dt-utc"/> within 0.9 seconds
of observed astronomical time.  When leap seconds are
introduced, the last minute in the day has more than
sixty seconds.
In theory leap seconds can also be removed from a
day, but this has not yet occurred.
</termdef>
</phrase>
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" diff="del" dg="dt2">
 <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 diff="del" dg="dt2">
 <p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to this datatype as well.</p>
</note>

<div4 id="dateTime-value-space" diff="add" dg="dt2">
<head>Value Space</head>

<p><dtref ref="dateTime"/> uses the
<dtref ref="dt-dt-7PropMod"/>, with no properties 
except <pfref ref="vp-dt-timezone"/>
permitted 
to be <pt>absent</pt>.  The <pfref ref="vp-dt-timezone"/> property remains
<termref def="dt-optional"></termref>.</p>

<constraintnote id="con-dateTime-dayValue" type="value">
<head>Day-of-month Values</head>
<p>The <pfref ref="vp-dt-day"/> value <!--* is limited to *-->
&must; be
no more than 30 if <pfref ref="vp-dt-month"/>
is one of 4, 6, 9, or 11; <!--* , to *-->
no more than 28
if <pfref ref="vp-dt-month"/> is 2 and
<pfref ref="vp-dt-year"/> is not divisible 4,
or is divisible by 100 but not by 400;
and no more than 29 if <pfref ref="vp-dt-month"/>
is 2 and <pfref ref="vp-dt-year"/>
is divisible by 400, or by 4 but not by 100.</p>
</constraintnote>

<constraintnote id="con-dateTime-leapSecondValue" type="value">
<head>Leap-second Values</head>
<p>The <pfref ref="vp-dt-second"/> value <!--* is limited to *-->
&must; be
less than 60 if <pfref ref="vp-dt-timezone"/>
is <pt>absent</pt> or if the remaining values
do not correspond to a dateTime <!--* allowing a real leap-second
at that hour and minute on that day; *-->at which a leap-second was introduced into <termref def="dt-utc"/>
by the responsible authorities;
if the
hour and minute <emph>in the specified timezone</emph>
allow a real leap-second then the value 
&must; be less than <phrase diff="del" dg="dt3">or equal to </phrase>60 plus the number of
leap-seconds introduced on that date.&nbsp; (At
the time of publication of this specification, no
more than one leap-second has ever been introduced at
a time<phrase diff="add" dg="dt3">and it appears unlikely that 
this will ever happen</phrase>.&nbsp; 
No negative leap-seconds have been
introduced, but if any should be introduced in future,
<unusual>adding</unusual> that negative number will result
in a value limit of 59 or lower.)</p>
</constraintnote>

<note>
<p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the <pfref ref="vp-dt-year"/> and <pfref ref="vp-dt-second"/>
values of this datatype.</p>
</note>

<p>Equality and order are as prescribed
in <specref ref="theSevenPropertyModel"/>.&nbsp;
<dtref ref="dateTime"/> values are ordered
by their <pfref ref="vp-dt-timeOnTimeline"/> value.</p>

<note>
<p>Since the order of a <dtref ref="dateTime"/>
value having a <pfref ref="vp-dt-timezone"/>
with another value whose
<pfref ref="vp-dt-timezone"/> is <pt>absent</pt> is determined
by imputing timezones of both +14:00
and &minus;14:00 to the untimezoned value, many such
combinations will be
<termref def="dt-incomparable"></termref> because the two imputed
timezones yield different orders.</p>

<!-- moved up from MSM's experiment in the later delled subsection -->
<p>Although <dtref ref="dateTime"/> and other
types related to dates and times have only a partial order, it
is possible for datatypes derived from <dtref ref="dateTime"/> to have
total orders, if they are restricted (e.g. using the
<compref ref="f-p"/> facet) to the subset of values with, or
the subset of values without, timezones.  Similar restrictions
on other date- and time-related types will similarly produce
totally ordered subtypes.  Note, however, that
such restrictions do not affect the value shown, for a given 
<compref ref="std"/>, in the <compref ref="ff-o"/> facet.</p>
</note>

<note>
<p>Order and equality are essentially the same for
<dtref ref="dateTime"/> in this version of this specification as
they were in version 1.0.&nbsp; However, since values
now distinguish timezones, equal
values with different <pfref ref="vp-dt-timezone"/>s
are not <emph>identical</emph>, and values with extreme
<pfref ref="vp-dt-timezone"/>s may no longer be equal
to any value with a smaller <pfref ref="vp-dt-timezone"/>.</p>
</note>

</div4>

<div4 role="1.0" id="dateTime-lexical-representation" diff="del" dg="dt2">
<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"/>.
</p>
</div4>

<div4 role="1.0" id="dateTime-canonical-representation" diff="del" dg="dt2">
<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 id="dateTime-lexical-mapping" diff="add" dg="dt2">
<head>Lexical Mappings</head>

<p>The lexical representations for <dtref ref="dateTime"/> are as follows:

<defset><head>Lexical Space</head>
<prod id="nt-dateTimeRep"><lhs>dateTimeLexicalRep</lhs>
<rhs><nt def="nt-yrFrag"/>&nbsp;<string>-</string>&nbsp;<nt def="nt-moFrag"/>&nbsp;<string>-</string>&nbsp;<nt def="nt-daFrag"/>&nbsp;<string>T</string>&nbsp;((<nt def="nt-hrFrag"/>&nbsp;<string>:</string>&nbsp;<nt def="nt-miFrag"/>&nbsp;<string>:</string>&nbsp;<nt def="nt-seFrag"/>)&nbsp;|
<nt def="nt-eodFrag"/>) <nt def="nt-tzFrag"/>?</rhs>
<constraint def="con-dateTime-day"/><constraint def="con-dateTime-leapSec"/>
</prod></defset>

<constraintnote id="con-dateTime-day" type="lexical">
<head>Day-of-month Representations</head>
<p>Within a <nt def="nt-dateTimeRep"/>, a <nt def="nt-daFrag"/> &mustnot;
begin with the digit <string>3</string> or be <string>29</string>
unless the value to
which it would map would satisfy the value constraint on
<pfref ref="vp-dt-day"/> values
<!-- The 2 <quote>s following should be a ref of some sort.  I don't know
how to link to <constraintnote>s. -->
(<quote>Constraint: Day-of-month Values</quote>) given above.</p>
</constraintnote>

<constraintnote id="con-dateTime-leapSec" type="lexical">
<head>Leap-second Representations</head>
<p>Within a <nt def="nt-dateTimeRep"/>, a <nt def="nt-seFrag"/> &mustnot;
begin with the digit <string>6</string> unless the value to
which it would map, in conjunction with the rest of the values,  
would satisfy the value constraint on leap-second values
(<quote>Constraint: Leap-second Values</quote>) given
above.&nbsp; Should a negative leap-second be declared, the
<nt def="nt-seFrag"/> is further limited to those which would
satisfy the even-tighter value constraint on <pfref ref="vp-dt-second"/>.</p>
</constraintnote>

The <nt def="nt-dateTimeRep"/> <phrase diff="add" dg="dt3">production
</phrase>is equivalent to this regular expression
once whitespace is removed<phrase diff="del" dg="dt3">, except 
that the constraints above are not enforced</phrase>.
<display role="shrink"><code>\-?([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9])\-(0[1-9])|(1[0-2])\-(0[1-9])([12][0-9])|(3[01])<br/>&nbsp;T(([01][0-9])|(2[0-3]):[0-5][0-9]:<phrase diff="add" dg="dt3">((</phrase>[0-<phrase diff="del" dg="dt3">6</phrase><phrase diff="add" dg="dt3">5</phrase>][0-9]<phrase diff="add" dg="dt3">)|(60))(.[0-9]+)?)</phrase>|(24:00:00<phrase diff="add" dg="dt3">(.[0-9]+)?</phrase>)<br/>&nbsp;&nbsp;&nbsp;([+\-](0[0-9])|(1[0-4]):[0-5][0-9])?</code></display>
Note that neither the <phrase diff="del" dg="dt3">production
</phrase><nt def="nt-dateTimeRep"/> <phrase diff="add" dg="dt3">production
</phrase>nor this regular
expression alone enforce the constraints <phrase diff="add" dg="dt3">on <nt def="nt-dateTimeRep"/> </phrase>given above.</p>

<p>The lexical mapping and canonical mapping 
for <dtref ref="dateTime"/> are the following functions:

<defsetsum ref="defs-dateTimeLexmap"/>
<defsetsum ref="defs-dateTimeCanmap"/>
</p>
</div4>

<div4 role="1.0" id="dateTime-timezones" diff="del" dg="dt2">
<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>

<div4 role="1.0" id="dateTime-order" diff="del" dg="dt2">
<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
<phrase diff="del" dg="fa1-fix"><termref def="dt-order-relation"/></phrase><phrase diff="add" dg="fa1-fix">order
relation</phrase> 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 &gt; Q if P &gt; (Q with time zone -14:00)</p></item>
      <item><p>P &lt;&gt; 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;&gt; 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" diff="del" dg="dt2">
<!--* 2005-02-07 : MSM experiments with restoring this section.
    * I won't lie down in the road for it, though. *-->
<!-- Let' just make the new para a note in the value space subsection -DP -->
<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 id="dateTime-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<div3 id="time">
<head>time</head>
<p dg="dt2" diff="del">
<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 diff="add" dg="wdd"><dtref ref="time"/>
represents instants of time that recur at the same point in each
calendar day<phrase diff="add" dg="dt2">, or that occur in some arbitrary calendar day.</phrase></p>

<p diff="del" dg="dt2">
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 diff="del" dg="dt2">
 <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 id="time-value-space" diff="add" dg="dt2">
<head>Value Space</head>

<p><dtref ref="time"/> uses the <dtref ref="dt-dt-7PropMod"/>, with
<pfref ref="vp-dt-year"/>, <pfref ref="vp-dt-month"/>,
and <pfref ref="vp-dt-day"/> required 
to be <pt>absent</pt>.&nbsp; <pfref ref="vp-dt-timezone"/> remains
<termref def="dt-optional"></termref>.</p>

<constraintnote id="con-time-leapSecondValue" type="value">
<head>Leap-second Values</head>
<p>The <pfref ref="vp-dt-second"/> value 
&must; be 
less than 60 if <pfref ref="vp-dt-timezone"/>
is <pt>absent</pt> or if the remaining
values do not correspond to a time 
<!--* allowing a real leap-second at that hour 
and minute on some day; *-->
at which, on some day, a leap-second has been introduced
into <termref def="dt-utc"/> by the responsible
authorities;
if
the hour and minute <emph>in the specified timezone</emph>
allow a real leap-second then the value
&must; be less than 60 plus the largest number of
leap-seconds introduced on any date.&nbsp; (At
the time of publication of this specification, <phrase diff="del" dg="dt3">the
largest number of leap-seconds ever introduced at one time
is 1, so the largest legal <pfref ref="vp-dt-second"/>
value is 60.&nbsp; Historically, all leap-seconds have been introduced
in the last minute of December and June in <termref def="dt-utc"></termref></phrase><phrase diff="add" dg="dt3">no
more than one leap-second has ever been introduced at
a time and it appears unlikely that this will ever occur.&nbsp; No negative leap-seconds have been
introduced, but if any should be introduced in future,
<unusual>adding</unusual> that negative number will result
in a value limit of 59 or lower</phrase>.)</p>
</constraintnote>

<note>
 <p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the <pfref ref="vp-dt-second"/> value of this datatype.</p>
</note>

<issue id="RQ-13i-time-copy" role="1.1" diff="del" dg="dt2-3">
<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 <unusual>calendar day</unusual> 
(<unusual>local</unusual> property values) so that in any given timezone, 
the days start at <unusual>local</unusual> 
00:00:00 and end immediately before <unusual>local</unusual> 24:00:00.  
Days in timezones other than Z do not run from 00:00:00Z to 24:00:00Z.</p>
</issue>

<p>Equality and order are as prescribed in
<specref ref="theSevenPropertyModel"/>.&nbsp; <dtref ref="time"/> values
(points in time in an <unusual>arbitrary</unusual> day) are ordered
taking into account their <pfref ref="vp-dt-timezone"/>.<!--* &nbsp;
This was not true of the
<dtref ref="time"/> datatype as defined in the 1.0 version of this
specification, where <dtref ref="time"/> values were not
<unusual>timezone aware</unusual>. *--></p>

<p>A calendar ( or <unusual>local time</unusual>) day with an early
timezone begins earlier than the same calendar day with a later
timezone.&nbsp; Since the timezones allowed spread over 28 hours,
there are timezone pairs for which a given calendar day in the two
timezones are totally disjoint&mdash;the earlier day ends before the
same day starts in the later timezone.&nbsp; The moments in time
represented by a single calendar day are spread over a 52-hour
interval, from the beginning of the day in the +14:00 timezone to the
end of that day in the &minus;14:00 timezone.</p>

<note>
<p>Since the order of a <dtref ref="time"/> value
having a <pfref ref="vp-dt-timezone"/>
with another value whose <pfref ref="vp-dt-timezone"/>
is <pt>absent</pt> is determined
by imputing timezones of both +14:00 and &minus;14:00
to the untimezoned value, many such combinations will be
<termref def="dt-incomparable"></termref> because the two imputed
timezones yield different orders.&nbsp; However,
for a given untimezoned value, there will
always be timezoned values at one or both
ends of the 52-hour interval that are
<termref def="dt-incomparable">comparable</termref>
(because the interval of
<termref def="dt-incomparable">incomparability</termref>
is only 24 hours wide).</p>

<p>Examples that show the difference from version 1.0 of this specification (see 
<specref ref="time-lexical-mapping"/> for the notations):
<ulist>
<item>
<p>A day is a calendar (or <unusual>local
time</unusual>) day in each timezone.<!--
Yes it's true.  Note that we're talking about a "day" as is
involved in the time datatype; we used to run times from
00:00:00Z up to 24:00:00Z no matter what the timezone. -DP -->
<!--* is this next sentence true?  I don't think so. 
So I'm suppressing it.
(in version 1.0, by contrast, a day was
always <termref def="dt-utc"></termref>): *--></p>
<p>08:00:00+10:00&nbsp;&lt; 17:00:00+10:00&nbsp;
(just as 08:00:00Z has always been less than
17:00:00Z, but in version 1.0&nbsp;
08:00:00+10:00&nbsp;&gt; 17:00:00+10:00&nbsp;)</p></item>
<item>
<p>A <dtref ref="time"/> value in a calendar day with an early timezone 
may precede <emph>every</emph> value in a later calendar day:</p>
<p>00:00:00+01:00 is less than <emph>every</emph> value with 
<pfref ref="vp-dt-timezone"/> Z</p></item>
<item>
<p>A calendar day with a very early timezone may be completely
disjoint from a calendar day with a very late timezone:</p>
<p>Each value with <pfref ref="vp-dt-timezone"/>
+13:00 is less than <emph>every</emph>
value with <pfref ref="vp-dt-timezone"/> &minus;13:00</p></item>
<item>
<p><dtref ref="time"/> values do not always
convert to <termref def="dt-utc"></termref> 
in the same way as in 1.0, since a time 
in a timezone may convert to 
a <termref def="dt-utc"></termref> time on
a <emph>different day</emph> (whereas time 
conversions in version 1.0 <unusual>wrapped around</unusual>
by ignoring the day during conversion):</p>
<p>
22:00:00Z&nbsp;&gt; 03:00:00+05:00
(since 1971-12-31T03:00:00+05 is 1979-12-30T22:00:00Z,
not 1979-12-31T22:00:00Z); in the previous
version of this specification&nbsp; 22:00:00Z&nbsp;=
03:00:00+05:00&nbsp;)</p>
</item>
</ulist>
</p>
</note>

</div4>

<div4 role="1.0" id="time-lexical-repr" dg="dt2" diff="del">
<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" dg="dt2" diff="del">
<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 id="time-lexical-mapping" diff="add" dg="dt2">
<head>Lexical Mappings</head>

<p>The lexical representations for <dtref ref="time"/>
are <unusual>projections</unusual> of 
those of <dtref ref="dateTime"/>, as follows:

<defset><head>Lexical Space</head>
<prod id="nt-timeRep"><lhs>timeLexicalRep</lhs>
<rhs>((<nt def="nt-hrFrag"/>&nbsp;<string>:</string>&nbsp;<nt def="nt-miFrag"/>&nbsp;<string>:</string>&nbsp;<nt def="nt-seFrag"/>)&nbsp;|
<nt def="nt-eodFrag"/>) <nt def="nt-tzFrag"/>?</rhs>
<constraint def="con-time-leapSec"/>
</prod></defset>

<constraintnote id="con-time-leapSec" type="lexical">
<head>Leap-second Representations</head>
<p>An <nt def="nt-seFrag"/> &mustnot; begin with the
digit <string>6</string> unless the value to
which it would map would satisfy the value
constraint on leap-second values given above.</p>
</constraintnote>

The <nt def="nt-timeRep"/> <phrase diff="add" dg="dt3">production
</phrase>is equivalent to this
regular expression, once whitespace is
removed<phrase diff="del" dg="dt3">, except
that the regular expression does not
enforce the constraint just given)</phrase>:
<display role="shrink"><code>(([01][0-9])|(2[0-3]):[0-5][0-9]:[0-6][0-9])|(24:00:00)<br/>(([01][0-9])|(2[0-3]):[0-5][0-9]:<phrase diff="add" dg="dt3">((</phrase>[0-<phrase diff="del" dg="dt3">6</phrase><phrase diff="add" dg="dt3">5</phrase>][0-9]<phrase diff="add" dg="dt3">)|(60))(.[0-9]+)?)</phrase>|(24:00:00<phrase diff="add" dg="dt3">(.[0-9]+)?</phrase>)<br/>&nbsp;&nbsp;&nbsp;([+\-](0[0-9])|(1[0-4]):[0-5][0-9])?</code></display>
<phrase diff="add" dg="dt3">Note that neither
the <nt def="nt-timeRep"/> production
nor this regular
expression alone enforce the constraint
on <nt def="nt-timeRep"/> given above.</phrase>
</p>

<p>The lexical mapping and canonical mapping
for <dtref ref="time"/> are the following functions:

<defsetsum ref="defs-timeLexmap"/>
<defsetsum ref="defs-timeCanmap"/>
</p>
</div4>

<div4 id="time-facets">
<head>Constraining facets</head>
<facets/>
</div4>
</div3>

<div3 id="date">
<head>date</head>
<p><termdef id="dt-date" term="date" role="local">
<phrase dg="dt2" diff="del">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'</phrase><phrase dg="dt2" diff="add"><term>date</term>
represents 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), up to but not including the beginning
moment</phrase> 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 dg="dt2" diff="del">
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 dg="dt2" diff="del">
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 dg="dt2" diff="del">
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 dg="dt2" diff="del">
<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>

<div4 id="date-value-space" diff="add" dg="dt2">
<head>Value Space</head>

<p><dtref ref="date"/> uses the <dtref ref="dt-dt-7PropMod"/>, with
<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>.</p>

<constraintnote id="con-date-dayValue" type="value">
<head>Day-of-month Values</head>
<p>The <pfref ref="vp-dt-day"/> value &must; be
no more than 30 if <pfref ref="vp-dt-month"/>
is one of 4, 6, 9, or 11, no more than 28
if <pfref ref="vp-dt-month"/> is 2 and
<pfref ref="vp-dt-year"/> is not divisble 4,
or is divisible by 100 but not by 400,
and no more than 29 if <pfref ref="vp-dt-month"/>
is 2 and <pfref ref="vp-dt-year"/>
is divisible by 400, or by 4 but not by 100.</p>
</constraintnote>

<note>
<p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the <phrase diff="del" dg="wdd">year
part</phrase><phrase diff="add" dg="wdd"><pfref ref="vp-dt-year"/>
value</phrase> of this datatype<phrase diff="del" dg="wdd">
as well</phrase>.</p>
</note>

<p>Equality and order are as prescribed in
<specref ref="theSevenPropertyModel"/>.</p>

<note>
<p>In version 1.0 of this specification, <dtref ref="date"/> values 
did not retain a timezone explicitly, but for timezones not too far from 
<termref def="dt-utc"></termref> their timezone could be recovered based on
their value&apos;s first moment on the timeline.&nbsp; The
<dtref ref="dt-dt-7PropMod"/> retains all timezones.</p>

<p>Examples that show the difference from version 1.0 (see 
<specref ref="date-lexical-mapping"/> for the notations):
<ulist>
<item>
<p>A day is a calendar (or <unusual>local
time</unusual>) day in each timezone,
including the timezones outside of +12:00 through -11:59 inclusive:</p>

<p>2000-12-12+13:00&nbsp;&lt; 2000-12-12+11:00&nbsp;
(just as 2000-12-12+12:00 has always been less than
2000-12-12+11:00, but in version 1.0&nbsp;
2000-12-12+13:00&nbsp;&gt; 2000-12-12+11:00&nbsp;,
since 2000-12-12+13:00&apos;s <unusual>recoverable
timezone</unusual> was &minus;11:00)</p></item>
<item>
<p>Similarly:</p>
<p>2000-12-12+13:00&nbsp;= 2000-12-13&minus;11:00&nbsp;
(whereas under 1.0, as just
stated,&nbsp; 2000-12-12+13:00&nbsp;= 2000-12-12&minus;11:00)</p></item>
</ulist>
</p>

</note>
</div4>

<div4 role="1.0" id="date-lexical-representation" diff="del" dg="dt2">
<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" dg="dt2" diff="del">
<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>

<div4 id="date-lexical-mapping" diff="add" dg="dt2">
<head>Lexical Mappings</head>

<p>The lexical representations for <dtref ref="date"/>
are <unusual>projections</unusual> of 
those of <dtref ref="dateTime"/>, as follows:

<defset><head>Lexical Space</head>
<prod id="nt-dateRep"><lhs>dateLexicalRep</lhs>
<rhs><nt def="nt-yrFrag"/>&nbsp;<string>-</string>&nbsp;<nt def="nt-moFrag"/>&nbsp;<string>-</string>&nbsp;<nt def="nt-daFrag"/> <nt def="nt-tzFrag"/>?</rhs>
<constraint def="con-date-day"/></prod></defset>

<constraintnote id="con-date-day" type="lexical">
<head>Day-of-month Representations</head>
<p>Within a
<phrase diff="del" dg="dt4"><nt def="nt-dateTimeRep"/></phrase><phrase diff="add" dg="dt4"><nt def="nt-dateRep"/></phrase>,
a <nt def="nt-daFrag"/> &mustnot;
begin with the digit <string>3</string> or be <string>29</string>
unless the value to
which it would map would satisfy the value constraint on
<pfref ref="vp-dt-day"/> values
<!-- The <quote> following should be a ref of some sort.  I don't know
how to link to <constraintnote>s. -->
(<quote>Constraint: Day-of-month Values</quote>) given above.</p>
</constraintnote>

The <nt def="nt-dateRep"/> <phrase diff="add" dg="dt3">production
</phrase>is equivalent to this
regular expression<phrase diff="del" dg="dt3">,
except that it does not enforce
the constraint just noted</phrase>:
<display role="shrink"><code>\-?([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9])\-(0[1-9])|(1[0-2])\-([0-2][0-9])|(3[01])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?</code></display>
<phrase diff="add" dg="dt3">Note that neither
the <nt def="nt-dateRep"/> production
nor this regular
expression alone enforce the constraint
on <nt def="nt-dateRep"/> given above.</phrase></p>

<p>The lexical mapping and canonical mapping
for <dtref ref="date"/> are the following functions:

<defsetsum ref="defs-dateLexmap"/>
<defsetsum ref="defs-dateCanmap"/>
</p>
</div4>
</div3>

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

<p dg="dt2" diff="del">
<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 dg="dt2" diff="add">
<term>gYearMonth</term> <!--* is a datatype that *--> 
represents specific whole Gregorian months in specific 
Gregorian years.</p>

<p dg="dt2" diff="del">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 diff="del" dg="dt2">
<p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the year part of this datatype<phrase diff="del" dg="wdd"> 
as well</phrase>.</p>
</note>

<div4 id="gYear-value-space" diff="add" dg="dt2">
<head>Value Space</head>

<p><dtref ref="gYearMonth"/> uses the <dtref ref="dt-dt-7PropMod"/>, with
<pfref ref="vp-dt-day"/>, <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>.</p>

<note>
<p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the <pfref ref="vp-dt-year"/> value of this datatype.</p>
</note>

<p>Equality and order are as prescribed in
<specref ref="theSevenPropertyModel"/>.</p>

<!--* <ednote dg="review" diff="add"><edtext>The following note and example
are true, but unlike for date, 1.0 2E did not spell
out the fact.</edtext></ednote> *-->

<note>
<p>In version 1.0 of this specification, <dtref ref="gYearMonth"/>
values did not
retain a timezone explicitly, but timezones not too far from
<termref def="dt-utc"></termref>
 could be recovered based on the <dtref ref="gYearMonth"/>
value&apos;s first moment on the timeline.&nbsp; The
<dtref ref="dt-dt-7PropMod"/> simply retains all timezones.</p>

<p>An example that shows the difference from version 1.0 (see 
<specref ref="gYearMonth-lexical-repr"/> for the notations):
<ulist>
<item>
<p>A day is a calendar (or <unusual>local time</unusual>) day in
each timezone, including the timezones outside of +12:00 through
&minus;11:59 inclusive:</p>
<p>2000-12+13:00&nbsp;&lt; 2000-12+11:00&nbsp;
(just as 2000-12+12:00 has always been less than 2000&minus;12+11:00,
but in version 1.0&nbsp; 2000-12+13:00&nbsp;&gt;
2000-12+11:00&nbsp;, since 2000&minus;12+13:00&apos;s <unusual>recoverable
timezone</unusual> was &minus;11:00)</p></item>
</ulist>
</p>

</note>
</div4>

<div4 id="gYearMonth-lexical-repr">
<head>Lexical
<phrase diff="del" dg="dt3">representation</phrase><phrase diff="add" dg="dt3">Mappings</phrase></head>

<!--ednote diff="add" dg="dt2" diff="del" dg="dt3"><edtext>This "Lexical representation"
section will be replaced by a "Lexical Mappings" section similar in
spirit to that for <dtref ref="date"/> and others above, as soon as
the appropriate mappings are written.</edtext></ednote-->

<p dg="dt2" diff="del">
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 dg="dt2" diff="del">
For example, to indicate the month of May 1999, one would write: 1999-05.
See also <specref ref="isoformats"/>.
</p>

<p dg="dt2" diff="add">The lexical representations for
<dtref ref="gYearMonth"/> are <unusual>projections</unusual> of 
those of <dtref ref="dateTime"/>, as follows:

<defset><head>Lexical Space</head>
<prod id="nt-gYearMonthRep"><lhs>gYearMonthLexicalRep</lhs>
<rhs><nt def="nt-yrFrag"/> <string>-</string>&nbsp;<nt def="nt-moFrag"/>&nbsp;<nt def="nt-tzFrag"/>?</rhs>
</prod></defset>

The <nt def="nt-gYearMonthRep"/> is equivalent to this regular expression:
<display role="shrink"><code>\-?([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9])\-(0[1-9])|(1[0-2])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?</code></display>
</p>

<p diff="add" dg="dt3">The lexical mapping and canonical mapping 
for <dtref ref="gYearMonth"/> are the following functions:

<defsetsum ref="defs-gYearMonthLexmap"/>
<defsetsum ref="defs-gYearMonthCanmap"/>
</p>
</div4>

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

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

<p dg="dt2" diff="del">
<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 dg="dt2" diff="add"><term>gYear</term>
represents Gregorian calendar years.</p>

<p dg="dt2" diff="del">
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 diff="del" dg="dt2">
 <p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the year part of this datatype<phrase diff="del" dg="wdd">
as well</phrase>.</p>
</note>

<div4 id="gYearMonth-value-space" diff="add" dg="dt2">
<head>Value Space</head>

<p><dtref ref="gYear"/> uses the <dtref ref="dt-dt-7PropMod"/>, with
<pfref ref="vp-dt-month"/>, <pfref ref="vp-dt-day"/>, <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>.</p>

<note>
<p>See the conformance note in <specref ref="year-sec-conformance"/> which
applies to the <pfref ref="vp-dt-year"/> value of this datatype.</p>
</note>

<p>Equality and order are as prescribed in
<specref ref="theSevenPropertyModel"/>.</p>

<note>
<p>In version 1.0 of this specification, <dtref ref="gYear"/>
values did not
retain a timezone explicitly, but timezones not too far from
<termref def="dt-utc"></termref>
 could be recovered based on the <dtref ref="gYear"/>
value&apos;s first moment on the timeline.&nbsp; The
<dtref ref="dt-dt-7PropMod"/> simply retains all timezones.</p>

<p>An example that shows the difference from version 1.0 (see 
<specref ref="gYear-lexical-repr"/> for the notations):
<ulist>
<item>
<p>A day is a calendar (or <unusual>local time</unusual>) day in
each timezone, including the timezones outside of +12:00 through
&minus;11:59 inclusive:</p>
<p>2000+13:00&nbsp;&lt; 2000+11:00&nbsp;
(just as 2000+12:00 has always been less than 2000+11:00,
but in version 1.0&nbsp; 2000+13:00&nbsp;&gt;
2000+11:00&nbsp;, since 2000+13:00&apos;s <unusual>recoverable
timezone</unusual> was &minus;11:00)</p></item>
</ulist>	
</p>
</note>
</div4>

<div4 id="gYear-lexical-repr">
<head>Lexical 
<phrase diff="del" dg="dt3">representation</phrase><phrase diff="add" dg="dt3">Mappings</phrase></head>
<!--* <ednote diff="del" dg="dt3"><edtext>The editors intend to replace this "Lexical
representation" section with a "Lexical Mappings" section in
the spirit of that in "date" and others above, as soon as the
appropriate mappings can be written.</edtext></ednote> *-->

<p diff="del" dg="dt2">
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 dg="dt2" diff="del">
For example, to indicate 1999, one would write: 1999.
See also <specref ref="isoformats"/>.
</p>

<p dg="dt2" diff="add">The lexical representations for
<dtref ref="gYear"/> are <unusual>projections</unusual> of 
those of <dtref ref="dateTime"/>, as follows:

<defset><head>Lexical Space</head>
<prod id="nt-gYearRep"><lhs>gYearLexicalRep</lhs>
<rhs><nt def="nt-yrFrag"/><string>-</string>&nbsp;<nt def="nt-moFrag"/>&nbsp;<nt def="nt-tzFrag"/>?</rhs>
</prod></defset>

The <nt def="nt-gYearRep"/> is equivalent to this regular expression:
<display role="shrink"><code>\-?([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?</code></display>
</p>

<p diff="add" dg="dt3">The lexical mapping and canonical mapping 
for <dtref ref="gYear"/> are the following functions:

<defsetsum ref="defs-gYearLexmap"/>
<defsetsum ref="defs-gYearCanmap"/>
</p>
</div4>

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

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

<p dg="dt2" diff="del">
<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 diff="add" dg="wdd"><dtref ref="gMonthDay"/> represents whole calendar 
days that recur at the same point in each calendar year, or that occur 
in some arbitrary calendar year.</p>

<p diff="add" dg="dt2">This datatype can be used, for example, to record
birthdays; an instance of the datatype could be used to say that 
someone's birthday occurs on the 14th of September every year.</p>

<p dg="dt3" diff="del">
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 id="gMonthDay-value-space" diff="add" dg="dt2">
<head>Value Space</head>

<p><dtref ref="gMonthDay"/> uses the <dtref ref="dt-dt-7PropMod"/>, with
<pfref ref="vp-dt-year"/>, <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>.</p>

<constraintnote id="con-gMonthDay-dayValue" type="value"><head>Day-of-month Values</head>
<p>The <pfref ref="vp-dt-day"/> value &must; be no more than 30 if <pfref ref="vp-dt-month"/>
is one of 4, 6, 9, or 11, and no more than 29 if <pfref ref="vp-dt-month"/> is 2.</p>
</constraintnote>


<p>Equality and order are as prescribed in
<specref ref="theSevenPropertyModel"/>.</p>

<note> 
<p>In version 1.0 of this specification, <dtref ref="gMonthDay"/> values 
did not retain a timezone explicitly, but for timezones not too far from 
<termref def="dt-utc"></termref> their timezone could be recovered based on
their value&apos;s first moment on the timeline.&nbsp; The
<dtref ref="dt-dt-7PropMod"/> retains all timezones.</p>

<p>An example that shows the difference from version 1.0 (see 
<specref ref="gMonthDay-lexical-repr"/> for the notations):
<ulist>
<item>
<p>A day is a calendar (or <unusual>local time</unusual>) day in each timezone,
including the timezones outside of +12:00 through &minus;11:59 inclusive:</p>
<p>--12-12+13:00&nbsp;&lt; --12-12+11:00&nbsp;
(just as --12-12+12:00 has always been less than
--12-12+11:00, but in version 1.0&nbsp;
--12-12+13:00&nbsp;&gt; --12-12+11:00&nbsp;, since
--12-12+13:00&apos;s <unusual>recoverable
timezone</unusual> was &minus;11:00)</p></item>
</ulist>
</p>
</note>
</div4>

<div4 id="gMonthDay-lexical-repr">
<head>Lexical 
<phrase diff="del" dg="dt3">representation</phrase><phrase diff="add" dg="dt3">Mappings</phrase></head>

<p dg="dt2" diff="del">
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 dg="dt2" diff="add">The lexical representations for 
<dtref ref="gMonthDay"/> are <unusual>projections</unusual> 
of those of <dtref ref="dateTime"/>, as follows:

<defset><head>Lexical Space</head>
<prod id="nt-gMonthDayRep"><lhs>gMonthDayLexicalRep</lhs>
<rhs><string>--</string>&nbsp;<nt def="nt-moFrag"/>&nbsp;<string>-</string>&nbsp;<nt def="nt-daFrag"/> <nt def="nt-tzFrag"/>?</rhs>
<constraint def="con-gMonthDay-day" diff="add" dg="dt4"/></prod></defset>

<constraintnote id="con-gMonthDay-day" type="lexical" diff="add" dg="dt4">
<head>Day-of-month Representations</head>
<p>Within a <nt def="nt-gMonthDayRep"/>, a <nt def="nt-daFrag"/> &mustnot;
begin with the digit <string>3</string> or be <string>29</string>
unless the value to
which it would map would satisfy the value constraint on
<pfref ref="vp-dt-day"/> values
<!-- The <quote> following should be a ref of some sort.  I don't know
how to link to <constraintnote>s. -->
(<quote>Constraint: Day-of-month Values</quote>) given above.</p>
</constraintnote>

The <nt def="nt-gMonthDayRep"/> is equivalent to this regular 
expression<phrase diff="del" dg="dt4">(note that it does 
not enforce the constraint just mentioned)</phrase>:
<!--* <ednote diff="del" dg="dt3"><edtext>Note initial escape hyphen does not appear on 
most other d/ts; check them out.</edtext></ednote> *-->
<!--* er, why ARE we escaping the initial hyphen? 
    * It's not a reserved character, is it?
YES  AFAIK, we didn't ever agree to making it part-time reserved.  -DP
    *-->
<display role="shrink"><code>\-\-(0[1-9])|(1[0-2])\-([0-2][0-9])|(3[01])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?</code></display>
<!--* also, if role="shrink" does what I think it does, it renders
    * the thing unreadable in my browser; is it expendable?
It's forced one line, so without shrink the line is quite long. -DP
    *-->
<phrase diff="add" dg="dt4">Note that neither
the <nt def="nt-gMonthDayRep"/> production
nor this regular
expression alone enforce the constraint
on <nt def="nt-gMonthDayRep"/> given above.</phrase></p>

<p diff="del" dg="dt2">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>
<p diff="add" dg="dt3">The lexical mapping and canonical mapping 
for <dtref ref="gMonthDay"/> are the following functions:

<defsetsum ref="defs-gMonthDayLexmap"/>
<defsetsum ref="defs-gMonthDayCanmap"/>
</p>
</div4>

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

<div3 id="gDay">
<head>gDay</head>
<p diff="del" dg="dt1">
<termdef id="del-dt-gDay" 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" dg="dt1" id="dt-gday" role="local" term="dDay"><term>gDay</term> 
<phrase diff="del" dg="dt2">is a datatype that</phrase> 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" dg="dt1">can
be</phrase><phrase diff="add" dg="dt1">is</phrase> used to represent a specific day of the month.
To <phrase diff="del" dg="dt1">say, for example, that I get my paycheck</phrase><phrase diff="add" dg="dt1">indicate, for example, that an employee gets a paycheck</phrase> on the 15th of each month.&nbsp; <phrase diff="add" dg="dt1">(Obviously, days
beyond 28 cannot occur in <emph>all</emph> months; they are nonetheless permitted, up to 31.)</phrase></p>

<p diff="del" dg="dt1">
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>

<!-- F27Aug FTF--> 
<!--* MSM doesn't know what the August ftf said about this, but I'm
    * restoring the note because it's as true for gDay as for gMonth
    * and the others. *-->
<!-- FTF Directed that this note be removed.  Probably should go
in all cases, and I missed the others. -->
<!--* <note dg="dt2" diff="del"> *-->
<note>
<p>Because days in one calendar only rarely
correspond to days in other calendars, 
<phrase diff="add" dg="dt1"><term>gday</term> </phrase>values<phrase diff="del" dg="dt1">
of this type</phrase> do not, in general, have any straightforward or
intuitive representation in terms of most 
<phrase diff="del" dg="dt1">other</phrase><phrase diff="add" dg="dt1">non-Gregorian</phrase> 
calendars. 
<phrase diff="del" dg="dt1">This 
type</phrase><phrase diff="add" dg="dt1"><term>gday</term></phrase> 
should therefore be used with caution in contexts where conversion to 
other calendars is desired.</p>
</note>

<div4 diff="add" dg="dt1">
<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="del-RQ-13i" role="1.1" diff="del" dg="dt2">
<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" ("local"
property values) so that in any given timezone, the days start at "local" 00:00:00 and end not quite including "local" 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
<phrase diff="del" dg="dt3">are </phrase>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><!-- 2004-08-27 FTF-->
<!--* <phrase diff="del" dg="dt2">Timezones</phrase><phrase diff="add" dg="dt2">
Because of the definition in <specref ref="theSevenPropertyModel"/>,
timezones</phrase> *-->
<!--* I don't know what the ftf said, but it says here I'm suggesting 
    * we go back to 'Timezones do not cause wrap-around'.
    *-->
<!--* If we have to mention the 7-property model, then we should
    * recast the sentence.  Because of the definition of WHAT? in the
    * model?  Because of the way XXX is defined in the 7-property model ...
    *-->
Timezones do not cause wrap-around at the end of the month:&nbsp; 
<phrase diff="del" dg="dt2">---31&minus;13:00 in one month 
may start after ---01+13:00 in the <emph>next</emph> 
month,</phrase><phrase diff="add" dg="dt2">the last day of a 
given month in timezone &minus;13:00 may start after the first 
day of the <emph>next</emph> month in timezone +13:00, as 
measured on the global timeline,</phrase>
but nonetheless&nbsp;
---01+13:00&nbsp;&lt;&nbsp;---31&minus;13:00&nbsp;.</p>
</note>
</div4>

<div4 id="gDay-lexical-repr" diff="del" dg="dt1">
<head>Lexical 
<phrase diff="del" dg="dt3">representation</phrase><phrase diff="add" dg="dt3">Mappings</phrase></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" dg="dt1">
<head>Lexical Mappings</head>
<p>
The lexical representations for <dtref ref="gDay"/> are 
<unusual><phrase diff="del" dg="dt2">restrictions</phrase><phrase diff="add" dg="dt2">projections</phrase></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><phrase diff="del" dg="dt3">---</phrase><phrase diff="add" dg="dt3">\-\-\-</phrase>([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>

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

<p dg="dt2" diff="del">
<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><phrase dg="dt2" diff="del">This datatype can be used to represent a 
specific month.  To say, for example, that Thanksgiving falls in the month of
November.</phrase><phrase dg="dt2" diff="add"><term><phrase diff="del" dg="dt3">gDay</phrase><phrase diff="add" dg="dt3">gMonth</phrase></term>
represents whole (Gregorian) months
within an arbitrary year&mdash;months that recur at the same point in 
each year.&nbsp; It might be used, for example, to say what
month annual Thanksgiving celebrations fall in different countries
(--11 in the United States, --10 in Canada, and possibly other months in
other countries).</phrase></p><!-- I think Oct in Germany as well -DP -->

<p dg="dt2" diff="del">
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 id="gMonth-value-space" diff="add" dg="dt2">
<head>Value Space</head>

<p><dtref ref="gMonth"/> uses the <dtref ref="dt-dt-7PropMod"/>, with
<pfref ref="vp-dt-year"/>, <pfref ref="vp-dt-day"/>, <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>.</p>

<p>Equality and order are as prescribed in
<specref ref="theSevenPropertyModel"/>.</p>

<note>
<p>In version 1.0 of this specification, <dtref ref="gMonth"/> values 
did not retain a timezone explicitly, but for timezones not too far from 
<termref def="dt-utc"></termref> their timezone could be recovered based on
their value&apos;s first moment on the timeline.&nbsp; The
<dtref ref="dt-dt-7PropMod"/> retains all timezones.</p>

<p>An example that shows the difference from version 1.0 (see 
<specref ref="gMonth-lexical-repr"/> for the notations):
<ulist>
<item>
<p>A month is a calendar (or <unusual>local time</unusual>) month in each timezone,
including the timezones outside of +12:00 through &minus;11:59 inclusive:</p>
<p>--12+13:00&nbsp;&lt; --12+11:00&nbsp;
(just as --12+12:00 has always been less than --12+11:00, but in version 1.0&nbsp;
--12+13:00&nbsp;&gt; --12+11:00&nbsp;, since --12+13:00&apos;s <unusual>recoverable
timezone</unusual> was &minus;11:00)</p></item>
</ulist>
</p>
</note>

</div4>

<div4 id="gMonth-lexical-repr">
<head>Lexical 
<phrase diff="del" dg="dt3">representation</phrase><phrase diff="add" dg="dt3">Mappings</phrase></head>

<p dg="dt2" diff="del">
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><p dg="dt2" diff="add">The lexical representations for <dtref ref="gMonth"/> are <unusual>projections</unusual> of 
those of <dtref ref="dateTime"/>, as follows:

<defset><head>Lexical Space</head>
<prod id="nt-gMonthRep"><lhs>gMonthLexicalRep</lhs>
<rhs><string>--</string>&nbsp;<nt def="nt-moFrag"/>&nbsp;<nt def="nt-tzFrag"/>?</rhs>
</prod></defset>

The <nt def="nt-gMonthRep"/> is equivalent to this regular expression:
<display role="shrink"><code>\-\-(0[1-9])|(1[0-2])((+|\-)(0[0-9]|1[0-4]):[0-5][0-9])?</code></display>
</p>

<p diff="add" dg="dt3">The lexical mapping and canonical mapping
for <dtref ref="gMonth"/> are defined as follows:

<defsetsum ref="defs-gMonthLexmap"/>
<defsetsum ref="defs-gMonthCanmap"/>
</p>
</div4>

<div4 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 <phrase diff="del" dg="fpwd">8</phrase><phrase diff="add" dg="fpwd">7</phrase>
<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">
<!--* !!! n.b. newOrg gives this section the ID other-builtin-STDs.
    * I'm leaving the old ID for now. -msm 2005-01-09 *-->
<head><phrase diff="del" dg="dpno">Derived datatypes</phrase><phrase diff="add" dg="dpno">Other Built-in <compref ref="std"/>s</phrase></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 0 and
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" diff="add" dg="fpwd">
<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>. 
<phrase diff="add" dg="du1">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.</phrase>

<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 diff="add" dg="du1" ref="defs-yearMonthDurationLexmap"/>
</p>

<note diff="add" dg="du2">
<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 diff="add" dg="du1" 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" diff="add" dg="fpwd">
<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>. 
<phrase diff="add" dg="du1">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. </phrase>
</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 diff="add" dg="du1" ref="defs-dayTimeDurationLexmap"/>
</p>

<note diff="add" dg="du2">
<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" dg="du2">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" dg="du2">to</phrase> the <dtref ref="yearMonthDuration"/> value 
space<phrase diff="del" dg="du2">)</phrase>.

<defsetsum diff="add" dg="du1" 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">
<!--* !!! n.B. newOrg assigns this the id components-datatypes.
    * For now I've left the ID unchanged.
    *-->

<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 diff="del" dg="fa1.z">
<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>
<ulist diff="add" dg="fa1.z"><item><p>In the case of 
<termref def="dt-primitive"></termref> datatypes, 
identifying a datatype with its definition in this specification.</p></item>
<item><p>In the case of <termref def="dt-constructed"></termref> datatypes, 
defining the datatype in terms of other datatypes.</p></item>
<item><p>Attaching a <dtref ref="QName"/> to the datatype.</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" abbrev="std"/>
<p>
Datatypes are identified by their <propref comp="std" prop="name"/>
and <propref comp="std" prop="target namespace"/>.&nbsp; Except
for anonymous datatypes (those with no <propref comp="std" prop="name"/>),
datatype definitions <termref def="dt-must"/> be uniquely identified
within a schema.
</p>
<p>
If <propref comp="std" prop="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 comp="std" prop="base type definition"/> (which is a subset of the
<termref def="dt-value-space"/> of <propref comp="std" prop="primitive type definition"/>).
If <propref comp="std" prop="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 comp="std" prop="item type definition"/>.
If <propref comp="std" prop="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 comp="std" prop="member type definitions"/>.
</p>
<p>
If <propref comp="std" prop="variety"/> is <termref def="dt-atomic"/>
then the <propref comp="std" prop="variety"/> of <propref comp="std" prop="base type definition"/>
must be <termref def="dt-atomic"/>.
If <propref comp="std" prop="variety"/> is <termref def="dt-list"/>
then the <propref comp="std" prop="variety"/> of <propref comp="std" prop="item type definition"/>
must be either <termref def="dt-atomic"/> or <termref def="dt-union"/>.
If <propref comp="std" prop="variety"/> is <termref def="dt-union"/>
then
<propref comp="std" prop="member type definitions"/> must be a list of datatype definitions.</p>

<!--* <ednote diff="del" dg="dpno">
<edtext>The definition of <propref comp="std" prop="facets"/> causes
it to contain both <termref def="dt-fundamental-facet">fundamental
facets</termref> and <termref def="dt-constraining-facet">constraining
facets</termref>.&ensp; I doubt this was
intended.&emsp;&mdash;DP</edtext>
</ednote> *-->

<p>The value of <propref comp="std" prop="facets"/> consists of the set of
<phrase diff="del" dg="fa1.z"><termref def="del-dt-facet"></termref>s</phrase><phrase diff="add" dg="fa1.z"><phrase diff="del" dg="dpno"><termref def="dt-fundamental-facet">fundamental facets</termref> 
and </phrase><termref def="dt-constraining-facet">constraining facets</termref></phrase> 
specified directly in the datatype definition
unioned with the possibly empty set of <propref comp="std" prop="facets"/> of
<propref comp="std" prop="base type definition"/>.
</p>
<p>
The value of <propref comp="std" prop="fundamental facets"/> consists of the set of
<phrase diff="del" dg="dpno"><termref def="dt-fundamental-facet"/>s</phrase><phrase diff="add" dg="dpno"><termref def="dt-fundamental-facet">fundamental
facets</termref></phrase> and their values.
</p>
<p>
If <propref comp="std" prop="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="std"/> 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="Simple Type Definition" ref="dc-defn">
<propmap comp="std" prop="name">
The &v-value; of the <phrase diff="del" dg="dpno"><code>name</code>&nbsp;&i-attribute;</phrase><phrase diff="add" dg="dpno"><att>name</att> attribute</phrase>, if present,
otherwise <phrase diff="del" dg="dpno"><xtermref href="&xsdl;#key-null">null</xtermref></phrase><phrase diff="add" dg="dpno"><pt>absent</pt></phrase>
</propmap>
<propmap comp="std" prop="final">
A <phrase diff="del" dg="dpno">set</phrase><phrase diff="add" dg="dpno">subset of 
{<pt>restriction</pt>, <pt>list</pt>, <pt>union</pt>}</phrase>
corresponding to <phrase diff="add" dg="dpno">the sequence which is</phrase>
the &v-value; of the
<phrase diff="del" dg="dpno"><code>final</code> &i-attribute;</phrase><phrase diff="add" dg="dpno"><att>final</att> attribute</phrase>, 
if present, otherwise the &v-value; of the
<phrase diff="del" dg="dpno"><code>finalDefault</code> &i-attribute;</phrase><phrase diff="add" dg="dpno"><att>finalDefault</att> attribute</phrase> of the ancestor
<phrase diff="del" dg="dpno"><xtermref href="&xsdl;#element-schema">schema</xtermref>
element information item</phrase><phrase diff="add" dg="dpno"><el>schema</el> element</phrase>, 
if present, <phrase diff="add" dg="dpno">and</phrase> 
<phrase diff="del" dg="dpno">otherwise the empty string, as follows:</phrase>
   <glist diff="del" dg="dpno">
    <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 comp="std" prop="final"/>
       </p>
      </note>
     </def>
    </gitem>
   </glist>
<phrase diff="add" dg="dpno">otherwise the
empty sequence.&nbsp; The constant <pt>restriction</pt> is present 
in the set if and only if <string>restriction</string> or <string>#all</string> 
is present in the sequence; similarly also
for <pt>list</pt> and <pt>union</pt>.</phrase><note diff="add" dg="wdd">
<p>Although the <att>finalDefault</att> attribute of a <el>schema</el> 
may include &string;s other than <string>restriction</string>, 
<string>list</string> or <string>union</string>, those other values
are ignored in the determination of <propref comp="std" prop="final"/>.</p></note>
</propmap>
<propmap comp="std" prop="target namespace">
The &v-value; of the 
<phrase diff="del" dg="dpno"><code>targetNamespace</code> &i-attribute;
of the parent <code>schema</code> element information item</phrase><phrase diff="add" dg="dpno"><att>targetNamespace</att> attribute
of the parent <el>schema</el> element information item</phrase>.
</propmap>
<propmap comp="std" prop="annotations">
<phrase diff="del" dg="dpno">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></phrase>
<phrase diff="add" dg="dpno">A sequence whose one term is the 
<phrase role="UNSURE">annotation</phrase>
corresponding to the child <eltref ref="annotation"/>
element information item, if one is present, otherwise <pt>absent</pt></phrase>
<!--* MSM notes a certain amount of inconsistency and uncertainty
    * about tagging things 'el' or 'eltref' or ... 
    *-->
</propmap>
</reprcomp>
</reprdef>
<p diff="del" dg="dpno">
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>
<p diff="add" dg="dpno">A <compref ref="std"/> can be added to a schema by deriving it from
another <phrase role="UNSURE">ordinary</phrase> <compref ref="std"/>
either by <phrase role="UNSURE">direct derivation</phrase>, explicit
<phrase role="UNSURE">construction as a list</phrase>, or explicit
<phrase role="UNSURE">construction as a union</phrase>.</p>
<p diff="add" dg="dpno">A user-defined
<compref ref="std"/> can be directly derived from an ordinary
    <compref ref="std"/>, or constructed from an
    ordinary <compref ref="std"/> as a list, or constructed from a
    sequence of ordinary <compref ref="std"/>s as a union.
</p>


<div4 role="1.0" id="derivation-by-restriction">
<head><phrase diff="add" dg="dpno">Direct </phrase>Derivation<phrase diff="del" dg="dpno"> by restriction</phrase></head>
<reprdef>
<reprelt eltname="restriction"/>
<reprcomp abstract="Simple Type Definition" ref="dc-defn">
<propmap comp="std" prop="variety">
The 
<phrase diff="add" dg="dpno">&v-value; of</phrase><phrase diff="add" dg="dpno">same value as that of</phrase>
<propref comp="std" prop="variety"/> of <propref comp="std" prop="base type definition"/>
</propmap>
<propmap comp="std" prop="facets">
<phrase diff="del" dg="dpno">The union of the set of 
<phrase diff="del" dg="fa1"><specref ref="del.facets"/></phrase><phrase diff="add" dg="fa1"><termref def="dt-fundamental-facet">fundamental facets</termref> and <termref def="dt-constraining-facet">constraining facets</termref></phrase>
components</phrase><phrase diff="add" dg="dpno">The set of 
<termref def="dt-constraining-facet"/> components</phrase>
resolved to by the facet &i-children; merged with <propref comp="std" prop="facets"/>
from <propref comp="std" prop="base type definition"/>, subject to 
<phrase diff="del" dg="dpno">the <phrase diff="del" dg="fa1">Facet Restriction Valid</phrase><phrase diff="add" dg="fa1">applicable facet</phrase>
constraint<phrase diff="del" dg="fa1">s</phrase> specified in 
<phrase diff="del" dg="fa1"><specref ref="del.facets"/></phrase><phrase diff="add" dg="fa1"><specref ref="defn-coss"/></phrase></phrase><phrase diff="add" dg="dpno"> the applicable facet
constraints specified in <specref ref="defn-coss"/></phrase>.
</propmap>
<propmap comp="std" prop="base type definition">
The <compref ref="std"/> component resolved to by the &v-value; of the
<phrase diff="del" dg="dpno"><code>base</code> &i-attribute;</phrase><phrase diff="add" dg="dpno"><att>base</att> attribute</phrase> 
or the <eltref ref="simpleType"/> <phrase diff="del" dg="dpno">&i-children;</phrase><phrase diff="add" dg="dpno">child element</phrase>,
whichever is present.
</propmap>
</reprcomp>
</reprdef>

<note role="example">
<p>
An electronic commerce schema might define a datatype called
<phrase diff="del" dg="dpno"><emph>Sku</emph></phrase><phrase diff="add" dg="dpno"><quote>SKU</quote></phrase>
(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>&lt;simpleType name='<phrase diff="del" dg="dpno">Sku</phrase><phrase diff="add" dg="dpno">SKU</phrase>'&gt;
    &lt;restriction base='string'&gt;
      &lt;pattern value='\d{3}-[A-Z]{2}'/&gt;
    &lt;/restriction&gt;
&lt;/simpleType&gt;</eg>
<p>
In this case, <phrase diff="del" dg="dpno"><emph>Sku</emph></phrase><phrase diff="add" dg="dpno"><string>SKU</string></phrase> is the name of the new
<termref def="dt-user-derived"/> datatype, <dtref ref="string" role="def"/> is
its <phrase diff="del" dg="dpno"><termref def="dt-basetype"/></phrase><phrase diff="add" dg="dpno"><propref comp="std" prop="baseType"/></phrase> 
and 
<phrase diff="del" dg="dpno"><termref def="dt-pattern"/> is the facet.</phrase>
<phrase diff="add" dg="dpno">a <compref ref="f-p"/>
facet is introduced in the 
<phrase role="UNSURE">direct derivation</phrase>.</phrase>
</p>
</note>

</div4>

<div4 role="1.0" id="derivation-by-list">
<head><phrase diff="del" dg="dpno">Derivation by list</phrase><phrase diff="add" dg="dpno">Construction as a List</phrase></head>
<reprdef>
 <reprelt eltname="list"/>
<reprcomp abstract="Simple Type Definition" ref="dc-defn">
<propmap comp="std" prop="variety">
list
</propmap>
<propmap comp="std" prop="item type definition">
The <compref ref="std"/> 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><phrase diff="del" dg="dpno">Derivation by union</phrase><phrase diff="add" dg="dpno">Construction as a Union</phrase></head>
<reprdef>
 <reprelt eltname="union"/>
<reprcomp abstract="Simple Type Definition" ref="dc-defn">
<propmap comp="std" prop="variety">
union
</propmap>
<propmap comp="std" prop="member type definitions">
The sequence of <compref ref="std"/> 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="std"/> components resolved to by the
<eltref ref="simpleType"/> &i-children;, if any, in order.
If <propref comp="std" prop="variety"/> is <emph>union</emph> for
any <compref ref="std"/> components resolved to above, then
the <compref ref="std"/> is replaced by its
<propref comp="std" prop="member type definitions"/>.
</propmap>
</reprcomp>
</reprdef>

<p>
A <termref def="dt-union"/> datatype can be <termref def="dt-derived"/>
from one or more <phrase diff="add" dg="aatf">ordinary
</phrase><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 <phrase diff="add" dg="iff">and only if</phrase>:
</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<phrase diff="add" dg="iff"> and only if</phrase>:
</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 comp="std" prop="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 comp="std" prop="facets"/>,
				then
				</p>
				<olist>
					<item>
						<p>
						if <propref comp="std" prop="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 comp="std" prop="base type definition"/>
						</p>
					</item>
					<item>
						<p>
						if <propref comp="std" prop="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 comp="std" prop="item type definition"/>
						</p>
					</item>
					<item>
						<p>
						if <propref comp="std" prop="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 comp="std" prop="member type definitions"/>
						</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 comp="std" prop="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 comp="std" prop="facets"/> are dependent on
<propref comp="std" prop="base type definition"/> 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 comp="std" prop="variety"/> is <termref def="dt-list"/>, then
the <propref comp="std" prop="variety"/> of <propref comp="std" prop="item type definition"/>
&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 comp="std" prop="variety"/> is <termref def="dt-union"/>,
then
it is an <termref def="dt-error"/> if
<propref comp="std" prop="name"/> and <propref comp="std" prop="target namespace"/>
&nbsp;<termref def="dt-match"/>&nbsp;<propref comp="std" prop="name"/>
and <propref comp="std" prop="target namespace"/> of any member of
<propref comp="std" prop="member type definitions"/>.
</p>
</constraintnote>
</div3>

<div3 id="stdHierarchy" dg="trm1" diff="add">
<head>The Simple Type Definition Hierarchy</head>
<p>The Constraints just given serve, among other things, to insure
that <compref ref="std"/>s are properly placed  the <phrase role="UNSURE">schema type hierarchy</phrase> by virtue of the setting
of their <propref comp="std" prop="base type definition"/>.</p>
</div3>

<div3 role="1.0" id="anySimpleType-component" diff="del" dg="aat">
<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>
 <schemaComp id="del-anySimpleType">
     <head>Simple Type Definition of the Ur-Type</head>
     <pvlist>
      <pvpair comp="std" prop="name">anySimpleType</pvpair>
      <pvpair comp="std" prop="target namespace">http://www.w3.org/2001/XMLSchema</pvpair>
      <pvpair comp="std" prop="base type definition"><xtermref href="&xsdl;#ur-type-itself">the ur-type definition</xtermref></pvpair>
      <pvpair comp="std" prop="final">The empty set</pvpair>
      <pvpair comp="std" prop="variety"><xtermref href="&xsdl;#key-null">null</xtermref></pvpair>
     </pvlist>
    </schemaComp>
</div3>

<div3 id="builtin-stds" diff="add" dg="aat">
<head>Built-in Simple Type Definitions</head>

<!--* !!! n.b. It's not clear where this material actually belongs.  For the
    * moment, I'm leaving it here where I found it, but it's not clear
    * that the approval of diff group 'aat' actually fixed this as the
    * appropriate location.  I have to check the minutes. 
    * [2005-01-21: minutes are clear: location was not discussed; the
    * text the WG approved was in section 4.]
    * Some smaller-order resequencing is noted in comments.
    *-->

<!--* !!! paragraph ast_radix_omnium was moved to this point in newOrg *-->

<!--* It's aatf that deletes the following paragraph and inserts the next.
    * Redone to tag this as a change to aat, rather than as aatf, so that
    * the final wording will be colored correctly. 
<p diff="del" dg="aatf">The <phrase diff="del" dg="dpno"><compref
ref="std"/> of <phrase role="UNSURE">anySimpleType</phrase></phrase>
<phrase diff="add" dg="dpno"><dtref role="def"
ref="anySimpleType"/></phrase> is present in every schema.&nbsp; It
has the following properties:</p>
*-->
<p>The definition of <dtref ref="anySimpleType"/> is
present in every schema.&nbsp; It has the following properties:</p>

<schemaComp id="anySimpleType-def">
<!--* <schemaComp id="simple-ur-type-itself"> *-->
<!--* !!! n.b. old datatypes.xml had id of 'simple-ur-type-itself'.
    * I have adopted the ID used in newOrg.  The old one does not
    * appear to be in use anywhere in any case. -msm 2005-01-09 *-->
<head><phrase diff="del" dg="dpno">Simple Type Definition of <phrase role="UNSURE">anySimpleType</phrase></phrase><phrase diff="add" dg="dpno">The <compref ref="std"/> of <dtref ref="anySimpleType"/></phrase></head>
<pvlist>
<pvpair comp="std" prop="name"><string>anySimpleType</string></pvpair>
<pvpair comp="std" prop="target namespace">http://www.w3.org/2001/XMLSchema</pvpair>
<pvpair comp="std" prop="base type definition">anyType</pvpair>
<pvpair comp="std" prop="final">The empty set</pvpair>
<pvpair comp="std" prop="variety"><pt>absent</pt></pvpair>
<!--* !!! N.B. the following items were added by dpno.
    * I doubt that the style sheet would have colored them properly, 
    * even if the DTD had allowed me to add 'diff="add' dg="dpno"' as
    * I originally tried to do.  I don't have time to wrestle with the
    * DTD on this just at the moment, so I'm backing off the diff 
    * markup on them. In the absence of stylesheet support it was 
    * in any case purely symbolic.
    *-->
<pvpair comp="std" prop="primitive type definition"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="facets">The empty set</pvpair>
<pvpair comp="std" prop="fundamental facets">The empty set</pvpair>
<!--* MSM changes TBD to global here.  I'm not sure what the
    * uncertainty was, so I may be missing something. *-->
<pvpair comp="std" prop="scope"><pt>global</pt></pvpair>
<pvpair comp="std" prop="item type definition"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="member type definitions"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="annotations">The empty sequence</pvpair>
</pvlist>
</schemaComp>

<!--* n.b. newOrg moves the following paragraph up to the top of the 
    * section.  I've left it here for now. -msm 2005-01-09 *-->
<p id="ast_radix_omnium">The 
definition of <dtref ref="anySimpleType"/>
is the root of the Simple Type Definition
hierarchy, and as such mediates between the other 
<phrase diff="del" dg="dpno">simple type definitions</phrase><phrase diff="add" dg="dpno"><compref ref="std"/>s</phrase>, 
which all eventually trace back to it via their
<propref comp="std" prop="base type definition"/> properties, and thus to the 
definition of <dtref ref="anyType"/>, 
<!--* !!! n.b. newOrg has ref='anySimpleType', which I assume to
    * be a typo. I've changed it without checking to see whether
    * a dtref to anyType will actually work. -msm 2005-01-09 *-->
which is
<emph>its</emph> <propref comp="std" prop="base type definition"/>.</p>

<!--* !!! should the following material move to section 3? -msm *-->
<!--* following paragraph was in datatypes.xml.  MSM suppressed it
    * silently (except for this comment) because its adddition is
    * not attributed to any diff group.  It can't have been in
    * 2E; if it was in the July 2004 WD, then we'll need to bring it back. 
    * -msm 2005-01-09
    *-->
<!--* <p diff="add"><termdef term="anyAtomicType" id="dt-anyAtomicType"
>There is a simple type definition named <term>anyAtomicType</term> present in every
schema by definition</termdef>.  It has the following properties:</p> *-->

<p diff="add" dg="dpno">The <compref ref="std"/> of <dtref ref="anyAtomicType"/> is present in every schema.&nbsp; It has the
following properties:</p>


<schemaComp id="anyAtomicType-def">
<!--* MSM silently changes 'aat-def' to 'anyAtomicType-def' following
    * newOrg.  I see no incoming pointers. *-->
<head><phrase diff="del" dg="dpno">Simple Type Definition of <phrase role="UNSURE">anyAtomicType</phrase></phrase><phrase diff="add" dg="dpno"><compref ref="std"/> of <dtref ref="anyAtomicType"/></phrase></head>
<pvlist>
<pvpair comp="std" prop="name"><string>anyAtomicType</string></pvpair>
<pvpair comp="std" prop="target namespace">http://www.w3.org/2001/XMLSchema</pvpair>
<pvpair comp="std" prop="base type definition"><dtref ref="anySimpleType"/></pvpair>
<pvpair comp="std" prop="final">The empty set</pvpair>
<pvpair comp="std" prop="variety"><pt>atomic</pt></pvpair>
<!--* !!! n.b. The following properties were added by newOrg. *-->
<pvpair comp="std" prop="primitive type definition"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="facets">The empty set</pvpair>
<pvpair comp="std" prop="fundamental facets">The empty set</pvpair>
<pvpair comp="std" prop="scope"><pt>global</pt></pvpair>
<pvpair comp="std" prop="item type definition"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="member type definitions"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="annotations">The empty sequence</pvpair>
</pvlist>
</schemaComp>

<p>Simple type definitions for all the built-in primitive datatypes,
namely <dtref ref="string"/>, <dtref ref="boolean"/>, <dtref ref="float"/>, <dtref ref="double"/>, <dtref ref="decimal"/>, 
<dtref ref="&pD;"/>, <dtref ref="dateTime"/>, <dtref ref="duration"/>, 
<dtref ref="time"/>, <dtref ref="date"/>, <dtref ref="gMonth"/>, 
<dtref ref="gMonthDay"/>, <dtref ref="gDay"/>, <dtref ref="gYear"/>, 
<dtref ref="gYearMonth"/>, <dtref ref="hexBinary"/>, 
<dtref ref="base64Binary"/>, <dtref ref="anyURI"/>
are present by definition in every schema.&nbsp; All 
are in the XML Schema namespace (http://www.w3.org/2001/XMLSchema), 
have an <pt>atomic</pt> <propref comp="std" prop="variety"/> 
with an empty <propref comp="std" prop="facets"/> (unless otherwise specified in this specification) 
and <dtref ref="anyAtomicType"/> as their
<propref comp="std" prop="base type definition"/>, and themselves as
<propref comp="std" prop="primitive type
definition"/>.</p>

<p>Similarly, simple type definitions for all the built-in &derived;
datatypes are present by definition in every schema, with properties
as specified in <specref ref="built-in-derived"/> and as represented
in XML in <specref ref="schema"/>.</p>
</div3>

</div2>

<div2 id="del-rf-fund-facets" diff="del" dg="fa1">
<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>

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

<div2 id="rf-fund-facets">
<head alt="Fundamental Facets"><phrase diff="add" dg="fa1"><termref def="dt-fundamental-facet"><phrase diff="add" dg="fpwd-rescinded-add">Information</phrase><phrase diff="del" dg="fpwd-rescinded-del">Fundamental</phrase> Facets</termref></phrase></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>The decision that the four informational facets, each of which have only one property,
will be lumped into one facet having four properties has been rescinded by the WG before it
made it into the text of this specification.</p>
</issue>

<p diff="add" dg="fa1">
<phrase diff="del" dg="fa1.z">(<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;</phrase>
<phrase diff="add" dg="fa1.z"><termdef term="fundamental facet" id="dt-fundamental-facet">Each 
<term>fundamental facet</term> is a schema component that 
provides a limited piece of information about some aspect
of each datatype.</termdef>&nbsp; 
For example, <compref ref="ff-c"/> is a 
<termref def="dt-fundamental-facet"/>.&nbsp; </phrase>
Most <termref def="dt-fundamental-facet"><phrase diff="del" dg="fa1.z">information</phrase><phrase diff="add" dg="fa1.z">fundamental</phrase> 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="ff-c"/>  and <compref ref="ff-b"/> 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" dg="fa1">
<p>Schema components are identified by kind.&nbsp; <quote><phrase diff="del" dg="fa1.z">Information</phrase><phrase diff="add" dg="fa1.z">Fundamental</phrase></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 <phrase diff="del" dg="wdd">realized as</phrase>
a separate kind of schema component.</p>
</note>

<p diff="add" dg="fa1">A <termref def="dt-fundamental-facet"></termref> can occur only
in the <propref comp="std" prop="fundamental facets"/> of a <compref ref="std"/>, and this is the
only place where <termref def="dt-fundamental-facet"></termref> components
occur.&nbsp; <termdef term="owner" id="dt-info-facet-parent" role="local"><phrase diff="del" dg="wdd">The
<!--* 2005-02-21, MSM changes the remaining two occurrences of 
    * <compref ref="dc-defn"/> to <compref ref="std"/>
    * so that the diffed display against 1.0 will work properly.
    * The target of the link, of course, is slightly different.
    *-->
<compref ref="std"/> in whose 
<!--* <propref ref="defn-fund-facets"/> *--><propref comp="std" prop="fundamental facets"/> 
an
<termref def="dt-fundamental-facet"></termref> component occurs is that
component&apos;s <term>parent</term>.</phrase><phrase diff="add" dg="wdd">A
<compref ref="std"/> in whose <propref comp="std" prop="fundamental facets"/> a
<termref def="dt-fundamental-facet"></termref> component occurs is that
component&apos;s <term>owner</term>.</phrase></termdef>&nbsp; Each kind of <termref def="dt-fundamental-facet"></termref>
component occurs (once) in each <compref ref="std"/>&apos;s <propref comp="std" prop="fundamental facets"/> set.</p>

<note diff="add" dg="fa1">
<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>.&nbsp; 
<phrase diff="add" dg="wdd">Fundamental facets are not required for schema processing,
but some applications use them.</phrase><!--&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="rf-ordered"><head>ordered</head>

<p diff="del" dg="fa1">
<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" dg="fa1">
<termdef id="del_fa1-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" dg="fa1">
<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" dg="fa1">
A <termref def="dt-partial-order"/> has the following properties:
</p>
<ulist diff="del" dg="fa1">
<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" dg="fa1">
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" dg="fa1"><termdef id="del-dt-incomparable" 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="del_fa1-dt-comparable" term="comparable">otherwise they are <term>comparable</term>.</termdef></p>
<p diff="del" dg="fa1">
<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" dg="fa1">
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" dg="fa1">
<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" dg="fa1">
<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" dg="fa1">
<termref def="dt-ordered"/> provides for:
</p>
<ulist diff="del" dg="fa1">
<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" dg="fa1">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
<phrase diff="del" dg="fa1-fix">vale
for a  and <termref def="dt-list"></termref></phrase>
<phrase diff="add" dg="fa1-fix">value
for a <termref def="dt-list"/></phrase>
is always <pt>false</pt>
and the value for a <termref def="dt-union"></termref> is computed as described below.</p>

<p diff="add" dg="fa1">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 
<phrase diff="del" dg="fa1-fix">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.
</phrase>
<phrase diff="add" dg="fa1-fix">that the prescribed order is a partial
order, but not (for the primitive type in question) a total order.  
Derivation of new datatypes from datatypes 
with partial orders may impose constraints which make the
effective ordering either a trivial order or a non-trivial total order,
but the value of the <compref ref="ff-o"/> facet is not changed to
reflect this.
</phrase> 
</p>
<p diff="add" dg="fa1-fix">
<termdef id="dt-ordered" term="ordered">A
<termref def="dt-value-space"/>, and hence a datatype, is said to be
<term>ordered</term> if this specification prescribes a non-trivial 
order for that
<termref def="dt-value-space"/>.</termdef></p>

<note diff="add" dg="fa1">
<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" abbrev="ff-o"/>

<!--* <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" dg="fa1">
<propref comp="ff-o" prop="value"/> depends on <propref comp="std" prop="variety"/>,
<propref comp="std" prop="facets"/> and <propref comp="std" prop="member type definitions"/>
in the <compref ref="std"/> component in which a
<termref def="dt-ordered"/> component appears as a member of
<propref comp="std" prop="fundamental facets"/>.
</p>

<p diff="del" dg="fa1">
When <propref comp="std" prop="variety"/> is <termref def="dt-atomic"/>,
<propref comp="ff-o" prop="value"/> is inherited from
<propref comp="ff-o" prop="value"/> of <propref comp="std" prop="base type definition"/>.
For all <termref def="dt-primitive"/> types <propref comp="ff-n" prop="value"/>
is as specified	in the table in <specref ref="app-fundamental-facets"/>.
</p>
<p diff="del" dg="fa1">
When <propref comp="std" prop="variety"/> is <termref def="dt-list"/>,
<propref comp="ff-o" prop="value"/> is <emph>false</emph>.
</p>

<p diff="del" dg="fa1">
When <propref comp="std" prop="variety"/> is <termref def="dt-union"/>,

<propref comp="ff-o" prop="value"/> is <emph>partial</emph> unless one of the
following:
</p>
<ulist diff="del" dg="fa1">
<item>
<p>
If every member of <propref comp="std" prop="member type definitions"/> 
is derived from a common ancestor other than 
<phrase diff="del" dg="aatf">the simple ur-type</phrase><phrase diff="add" dg="aatf"><dtref ref="anyAtomicType"/></phrase>, 
then <propref comp="ff-o" prop="value"/> is the same as that
ancestor's <term>ordered</term> facet
</p>
</item>
<item>
<p>
If every member of <propref comp="std" prop="member type definitions"/> has a
<propref comp="ff-o" prop="value"/> of <emph>false</emph> for the <term>ordered</term>
facet, then <propref comp="ff-o" prop="value"/> is <emph>false</emph></p>
</item>
</ulist>

<p diff="add" dg="fa1"><propref comp="ff-o" prop="value"/> depends on 
the <termref def="dt-info-facet-parent">owner&apos;s</termref> 
<propref comp="std" prop="variety"/>, <propref comp="std" prop="facets"/>, 
and <propref comp="std" prop="member type definitions"/>.

<olist role="Case">
<item id="x04042a"><p role="if">the 
<termref def="dt-info-facet-parent">&owners.Diff;</termref>
<propref comp="std" prop="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 comp="ff-o" prop="value"/> is as specified in the
table in <specref ref="app-fundamental-facets"/>.</p>
 </item>

 <item>
 <p role="otherwise"><propref comp="ff-o" prop="value"/> is the <termref def="dt-info-facet-parent">owner&apos;s</termref>
<propref comp="std" prop="base type definition"/>'s <compref ref="ff-o"/> <propref comp="ff-o" prop="value"/>.</p>
 </item>
 </olist>
</p>
</item>

<item>
<p role="if">the <termref def="dt-info-facet-parent">owner&apos;s</termref>
<propref comp="std" prop="variety"/> is <pt>list</pt></p>
<p role="then"><propref comp="ff-o" prop="value"/> is <pt>false</pt>.</p>
</item>

<item>
<p role="otherwise">the <termref def="dt-info-facet-parent">owner&apos;s</termref> <propref comp="std" prop="variety"/> is <pt>union</pt>;
<olist role="case">
<item id="x040428">
<p role="if">every member of the 
<termref def="dt-info-facet-parent">&owners.Diff;</termref> 
<propref comp="std" prop="member type definitions"/> 
<phrase diff="del" dg="aatg">is derived from a common ancestor other than 
the simple ur-type</phrase><phrase diff="add" dg="aatg">has 
<propref comp="std" prop="variety"/> atomic and has the same
<propref comp="std" prop="primitive type definition"/></phrase></p>
<p role="then"><propref comp="ff-o" prop="value"/> is the same as the
<compref ref="ff-o"/> component&apos;s <propref comp="ff-o" prop="value"/> in that 
<phrase diff="del" dg="aatg">common ancestor&apos;s</phrase><phrase diff="add" dg="aatg">primitive 
type definition&apos;s</phrase> 
<propref comp="std" prop="fundamental facets"/>.</p>
 </item>

 <item>
 <p role="if">each member of the <termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="member type definitions"/> has an <compref ref="ff-o"/>
component in its 
<propref comp="std" prop="fundamental facets"/> whose <propref comp="ff-o" prop="value"/> is <pt>false</pt></p>
 <p role="then"><propref comp="ff-o" prop="value"/> is
<pt>false</pt>.</p>
 </item>

 <item>
 <p role="otherwise"><propref comp="ff-o" prop="value"/> is
<pt>partial</pt>.</p>
 </item>
 </olist>
</p>
</item>
</olist>

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

<div3 id="rf-bounded">
<head>bounded</head>
 
<p diff="del" dg="fa1">
<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<phrase diff="add" dg="iff"> and only if</phrase> 
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" dg="fa1">
<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<phrase diff="add" dg="iff"> and only if</phrase> 
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" dg="fa1">
<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<phrase diff="add" dg="iff"> and only if</phrase> 
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" dg="fa1">
<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<phrase diff="add" dg="iff"> and only if</phrase> 
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" dg="fa1">
<termdef id="dt-bounded" term="bounded">A datatype is <term>bounded</term>
if<phrase diff="add" dg="iff"> and only if</phrase> 
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" dg="fa1">
<termref def="dt-bounded"/> provides for:
</p>
<ulist diff="del" dg="fa1">
<item>
<p>
indicating whether a <termref def="dt-value-space"/> is
<termref def="dt-bounded"/>
</p>
</item>
</ulist>

<p diff="add" dg="fa1">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 <phrase diff="del" dg="fa1-fix">may not be</phrase> <phrase diff="add" dg="fa1-fix">are
not necessarily</phrase> in the value space of the derived datatype,
but <phrase diff="add" dg="fa1-fix">they</phrase> 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="f-p"/>
component.</p>

<div4 id="dc-bounded">
<head>The bounded Schema Component</head>
<compdef name="bounded" abbrev="ff-b"/>

<p><propref comp="ff-b" prop="value"/> depends on 
<phrase diff="add" dg="fa1">the 
<termref def="dt-info-facet-parent">&owners.Diff;</termref></phrase>
<propref comp="std" prop="variety"/>,
<propref comp="std" prop="facets"/> and 
<propref comp="std" prop="member type definitions"/><phrase diff="del" dg="fa1">
in the <compref ref="std"/> component in which a
<compref ref="ff-b"/> component appears as a member of
<propref comp="std" prop="fundamental facets"/></phrase>.</p>

<p>When <phrase diff="add" dg="fa1">the <termref def="dt-info-facet-parent"></termref>
is <termref def="dt-primitive"></termref>, 
<propref comp="ff-b" prop="value"/> is as specified in the
table in <specref ref="app-fundamental-facets"/>.&nbsp; Otherwise, when the
<termref def="dt-info-facet-parent">&owners.Diff;</termref></phrase>
<propref comp="std" prop="variety"/> is <pt>atomic</pt>,
if one of <compref ref="f-mii"/> or <compref ref="f-mie"/>
and one of <compref ref="f-mai"/> or <compref ref="f-mae"/>
are <phrase diff="del" dg="fa1">among <propref comp="std" prop="facets"/></phrase><phrase diff="add" dg="fa1">members of
the <termref def="dt-info-facet-parent">owner&apos;s</termref> <propref comp="std" prop="facets"/> set</phrase>, then
<propref comp="ff-b" prop="value"/> is <pt>true</pt>;
<phrase diff="del" dg="fa1">else</phrase><phrase diff="add" dg="fa1">otherwise</phrase>
<propref comp="ff-b" prop="value"/> is <pt>false</pt>.</p>

<p>When <phrase diff="add" dg="fa1">the <termref def="dt-info-facet-parent">owner&apos;s</termref>
</phrase><propref comp="std" prop="variety"/> is <pt>list</pt>,
<!--* !!! probable ID problems !!! *-->
<phrase diff="del" dg="fpwd">if <termref def="dt-length"/> or both of
<termref def="dt-minLength"/> and <termref def="dt-maxLength"/>
are among <propref comp="std" prop="facets"/>, then
<propref comp="ff-b" prop="value"/> is <emph>true</emph>; else</phrase>
<propref comp="ff-b" prop="value"/> is <pt>false</pt>.</p>

<p>
When the <phrase diff="add" dg="fa1"><termref def="dt-info-facet-parent">owner&apos;s</termref>
</phrase><propref comp="std" prop="variety"/> is <pt>union</pt>,
if <propref comp="ff-b" prop="value"/> is <pt>true</pt>
for every member of <phrase diff="del" dg="fa1"><propref comp="std" prop="member type definitions"/>and all members of
<propref comp="std" prop="member type definitions"/></phrase><phrase diff="add" dg="fa1">the
<termref def="dt-info-facet-parent">owner&apos;s</termref> <propref comp="std" prop="member type definitions"/>
set and all of these</phrase> share
<!--* !!! should this not be 'share a common primitive type ? !!! *-->
a common ancestor, then <propref comp="ff-b" prop="value"/> is <pt>true</pt>;
<phrase diff="del" dg="fa1">else</phrase><phrase diff="add" dg="fa1">otherwise</phrase>
<propref comp="ff-b" prop="value"/> is <pt>false</pt>.
</p>

</div4>
</div3>

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

<p diff="del" dg="fa1">
<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" dg="fa1">
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" dg="fa1">
<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" dg="fa1">
<termref def="dt-cardinality"/> provides for:
</p>
<ulist diff="del" dg="fa1">
<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" dg="fa1">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="f-p"/> component.</p>

<div4 id="dc-cardinality">
<head>The cardinality Schema Component</head>
<compdef name="cardinality" abbrev="ff-c"/>

<p>
<propref comp="ff-c" prop="value"/> depends on <phrase diff="add" dg="fa1">the <termref def="dt-info-facet-parent">&owners.Diff;</termref> </phrase><propref comp="std" prop="variety"/>,
<propref comp="std" prop="facets"/>, and <propref comp="std" prop="member type definitions"/><phrase diff="del" dg="fa1">
in the <compref ref="std"/> component in which a
<compref ref="ff-c"/> component appears as a member of
<propref comp="std" prop="fundamental facets"/></phrase>.</p>

<p diff="del" dg="fa1">
When <propref comp="std" prop="variety"/> is <termref def="dt-atomic"/> and
<propref comp="ff-c" prop="value"/> of <propref comp="std" prop="base type definition"/>
is <emph>finite</emph>, then <propref comp="ff-c" prop="value"/> is
<emph>finite</emph>.
</p>

<p diff="del" dg="fa1">When <propref comp="std" prop="variety"/> is <termref def="dt-atomic"/> and
<propref comp="ff-c" prop="value"/> of <propref comp="std" prop="base type definition"/>
is <emph>countably infinite</emph> and <strong>either</strong> of the following
conditions are true, then <propref comp="ff-c" prop="value"/> is
<emph>finite</emph>; else <propref comp="ff-c" prop="value"/>
is <emph>countably infinite</emph>:
</p>

<olist role="orval" diff="del" dg="fa1">
<item>
<p>
one of <termref def="dt-length"/>, <termref def="dt-maxLength"/>,
<termref def="dt-totalDigits"/> is among <propref comp="std" prop="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 comp="std" prop="facets"/>
</p>
</item>
<item>
<p>
one of <termref def="dt-maxInclusive"/> or
<termref def="dt-maxExclusive"/>
is among <propref comp="std" prop="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 comp="std" prop="facets"/>
</p>
</item>
<item>
<p>
<propref comp="std" prop="base type definition"/> 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" dg="fa1">When the <termref def="dt-info-facet-parent"></termref> is
<termref def="dt-primitive"></termref>, <propref comp="ff-c" prop="value"/> is as specified in the
table in <specref ref="app-fundamental-facets"/>.&nbsp; Otherwise, when
the <termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="variety"/> is <pt>atomic</pt>,
<propref comp="ff-c" prop="value"/>
is <pt>countably infinite</pt> unless <strong>any</strong> of the following
conditions are true, in which case <propref comp="ff-c" prop="value"/> is
<pt>finite</pt>:

<olist role="orval">
<item>
<p>the <termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="base type definition"/>'s
<compref ref="ff-c"/> <propref comp="ff-c" prop="value"/> is <pt>finite</pt>,</p>
</item>

<item>
<p>at least one of <compref ref="f-l"/>, <compref ref="f-mal"/>,
or <compref ref="f-td"/> is a member of the
<termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="facets"/> set,</p>
</item>

<item>
<p><strong>all</strong> of the following are true:</p>
 <olist role="and">
 <item>
 <p>one of <compref ref="f-mii"/> or <compref ref="f-mie"/>
is a member of the <termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="facets"/> set</p>
 </item>

 <item>
 <p>one of <compref ref="f-mai"/> or <compref ref="f-mae"/>
is a member of the <termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="facets"/> set</p>
</item>

 <item>
 <p><strong>either</strong> of the following are true:</p>
  <olist role="orval">
  <item>
  <p><compref ref="f-fd"/> is a member of the <termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="facets"/> set</p>
  </item>

  <item>
  <p><propref comp="std" prop="primitive type definition"/> 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 <phrase diff="del" dg="fpwd">the 
<termref def="dt-info-facet-parent"><phrase diff="add" dg="wdd">parent&apos;s</phrase><phrase diff="add" dg="wdd">owner&apos;s</phrase></termref></phrase>
<propref comp="std" prop="variety"/> is <pt>list</pt>,
if <compref ref="f-l"/> or both <phrase diff="del" dg="fa1">of
</phrase><compref ref="f-mil"/> and <compref ref="f-mal"/>
are <phrase diff="del" dg="fa1">among <propref comp="std" prop="facets"/></phrase><phrase diff="add" dg="fa1">members of the
<termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="facets"/> set
and the <termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="item type definition"/>'s
<compref ref="ff-c"/> <propref comp="ff-c" prop="value"/> is <pt>finite</pt></phrase>
then <propref comp="ff-c" prop="value"/> is <pt>finite</pt>;
<phrase diff="del" dg="fa1">else</phrase><phrase diff="add" dg="fa1">otherwise</phrase>
<propref comp="ff-c" prop="value"/> is <pt>countably infinite</pt>.
</p>

<p>
When the <termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="variety"/> is <pt>union</pt>,
if <compref ref="ff-c"/>&apos;s <propref comp="ff-c" prop="value"/> is <emph>finite</emph>
for every member of <phrase diff="add" dg="fa1">the <termref def="dt-info-facet-parent">&owners.Diff;</termref> </phrase><propref comp="std" prop="member type definitions"/><phrase diff="add" dg="fa1"> set</phrase> then
<propref comp="ff-c" prop="value"/> is <pt>finite</pt>,
<phrase diff="del" dg="fa1">else</phrase><phrase diff="add" dg="fa1">otherwise</phrase> <propref comp="ff-c" prop="value"/>
is <pt>countably infinite</pt>.
</p>
</div4>
</div3>

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

<p diff="del" dg="fa1">
<termdef id="dt-numeric" term="numeric">A datatype is said to be
<term>numeric</term> 
if<phrase diff="add" dg="iff"> and only if</phrase> 
its values are conceptually quantities (in some
mathematical number system).
</termdef>
</p>
<p diff="del" dg="fa1">
<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" dg="fa1">
<termref def="dt-numeric"/> provides for:
</p>
<ulist diff="del" dg="fa1">
<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" dg="fa1">Some value spaces are made up of things that
are <phrase diff="del" dg="fa1-fix">generally considered</phrase>
<phrase diff="add" dg="fa1-fix">conceptually</phrase> 
<emph>numeric</emph>, others are
not.&nbsp;The <emph>numeric</emph> facet value indicates which are
considered numeric.
<!--* 
<phrase diff="add" dg="fa1-fix">In this specification, 
<termdef id="dt-numeric" term="numeric">a datatype is said to be
<term>numeric</term> if its <emph>numeric</emph> facet has the 
value <pt>true</pt></termdef>.
</phrase>
*-->
<!--* and otherwise non-numeric *-->
<!--* We don't seem to use 'non-numeric', so I won't restore
    * its definition. -msm *-->  
<!--* In fact, we don't actually use 'numeric' as a term at all.
    * The termrefs to dt-numeric should in fact all be property
    * references to comp="ff-n" -->
</p>

<div4 id="dc-numeric">
<head>The numeric Schema Component</head>
<compdef name="numeric" abbrev="ff-n"/>

<p>
<propref comp="ff-n" prop="value"/> depends on <phrase diff="add" dg="fa1">the <termref def="dt-info-facet-parent">&owners.Diff;</termref> </phrase><propref comp="std" prop="variety"/>,
<propref comp="std" prop="facets"/>, <propref comp="std" prop="base type definition"/> and
<propref comp="std" prop="member type definitions"/><phrase diff="del" dg="fa1"> in the <compref ref="std"/> component
in which a <termref def="dt-cardinality"/> component appears as a member of
<propref comp="std" prop="fundamental facets"/></phrase>.
</p>

<p>
When <phrase diff="add" dg="fa1">the <termref def="dt-info-facet-parent"></termref> is <termref def="dt-primitive"></termref>, <propref comp="ff-n" prop="value"/> is as specified in the
table in <specref ref="app-fundamental-facets"/>.&nbsp; Otherwise, when the <termref def="dt-info-facet-parent">&owners.Diff;</termref> </phrase><propref comp="std" prop="variety"/> is <pt>atomic</pt>,
<propref comp="ff-n" prop="value"/> is inherited from
<phrase diff="add" dg="fa1">the <termref def="dt-info-facet-parent">&owners.Diff;</termref> <propref comp="std" prop="base type definition"/>&apos;s <compref ref="ff-n"/></phrase><propref comp="ff-n" prop="value"/><phrase diff="del" dg="fa1"> of <propref comp="std" prop="base type definition"/>.
For all <termref def="dt-primitive"/> types <propref comp="ff-n" prop="value"/>
is as specified	in the table in <specref ref="app-fundamental-facets"/></phrase>.
</p>

<p>
When <phrase diff="add" dg="fa1">the <termref def="dt-info-facet-parent">&owners.Diff;</termref> </phrase><propref comp="std" prop="variety"/> is <pt>list</pt>,
<propref comp="ff-n" prop="value"/> is <pt>false</pt>.
</p>

<p>
When <phrase diff="add" dg="fa1">the 
<termref def="dt-info-facet-parent">&owners.Diff;</termref> 
</phrase><propref comp="std" prop="variety"/> is <pt>union</pt>,
if <phrase diff="add" dg="fa1"><compref ref="ff-n"/>&apos;s </phrase><propref comp="ff-n" prop="value"/> is <pt>true</pt>
for every member of <phrase diff="add" dg="fa1">the <termref def="dt-info-facet-parent">&owners.Diff;</termref> </phrase><propref comp="std" prop="member type definitions"/><phrase diff="add" dg="fa1"> set</phrase> then
<propref comp="ff-n" prop="value"/> is <pt>true</pt>,
<phrase diff="del" dg="fa1">else</phrase><phrase diff="add" dg="fa1">otherwise</phrase> <propref comp="ff-n" prop="value"/> is <pt>false</pt>.
</p>

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

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

<p diff="add" dg="fa1"><termdef term="&cfacet;" id="dt-constraining-facet"><term>&Cfacet;s</term>
are schema components whose values may be set or changed
during <termref def="dt-derived">derivation</termref> (subject to facet-specific controls) 
to control various aspects of the derived datatype.</termdef>&nbsp; For example, 
<compref ref="f-w"/> 
is a <termref def="dt-constraining-facet"></termref>.&nbsp; 
<termref def="dt-constraining-facet">&Cfacet;s</termref> are given a value as part of
the <termref def="dt-derived">derivation</termref>
defining a <termref def="dt-derived"></termref> datatype; a few
<termref def="dt-constraining-facet">constraining facets</termref> have default values
that are also provided for <termref def="dt-primitive"></termref> datatypes.</p>

<note diff="add" dg="fa1">
<p>Schema components are identified by kind.&nbsp; <quote>Constraining</quote> 
is not a kind of component.&nbsp; Each kind of <termref def="dt-constraining-facet"></termref>
(<quote>whiteSpace</quote>, 
<quote>length</quote>, etc.) is 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-->

<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 comp="std" prop="base type definition"/>.
</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" abbrev="f-l"/>

<p>
If <propref comp="f-l" prop="fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref comp="std" prop="base type definition"/> cannot specify a
value for <compref ref="f-l"/> other than <propref comp="f-l" prop="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="f-l"/> 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 comp="f-l" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-l" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-l" prop="annotations">
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"/><phrase diff="del" dg="iff">, determined as follows:</phrase>
<phrase diff="add" dg="iff">if and only if:</phrase>
</p>
<olist>
<item>
<p>
if the <propref comp="std" prop="variety"/> is <termref def="dt-atomic"/> then
<olist>
<item>
<p>
if <propref comp="std" prop="primitive type definition"/> 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 comp="f-l" prop="value"/>;
</p>
</item>
<item>
<p>
if <propref comp="std" prop="primitive type definition"/> 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 comp="f-l" prop="value"/>;
</p>
</item>
<item>
<p>
if <propref comp="std" prop="primitive type definition"/> is <dtref ref="QName"/> or <dtref ref="NOTATION"/>, then any <propref comp="f-l" prop="value"/> is facet-valid.
</p>
</item>
</olist>
</p>
</item>
<item>
<p>
if the <propref comp="std" prop="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 comp="f-l" prop="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="f-l"/> is a member of <propref comp="std" prop="facets"/> then
  <olist>
   <item>
    <p>It is an error for <compref ref="f-mil"/> to be a member of
<propref comp="std" prop="facets"/> unless
     <olist>
      <item>
       <p>the <propref comp="f-mil" prop="value"/> of <compref ref="f-mil"/> &lt;= the <propref comp="f-l" prop="value"/> of <compref ref="f-l"/> 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="f-mil"/> has the same
         <propref comp="f-mil" prop="value"/> and <compref ref="f-l"/> is not specified.</p>
      </item>
     </olist>
    </p>
   </item>
   <item>
    <p>It is an error for <compref ref="f-mal"/> to be a member of
<propref comp="std" prop="facets"/> unless
     <olist>
      <item>
       <p>the <propref comp="f-l" prop="value"/> of <compref ref="f-l"/> &lt;= the <propref comp="f-mal" prop="value"/> of <compref ref="f-mal"/> 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="f-mal"/> has the same
         <propref comp="f-mal" prop="value"/> and <compref ref="f-l"/> 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="f-l"/>
is among the members of <propref comp="std" prop="facets"/> of
<propref comp="std" prop="base type definition"/> and <propref comp="f-l" prop="value"/> is
not equal to the <propref comp="f-l" prop="value"/> of the parent
<compref ref="f-l"/>.
</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 comp="std" prop="base type definition"/>.
</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" abbrev="f-mil"/>

<p>
If <propref comp="f-mil" prop="fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref comp="std" prop="base type definition"/> cannot specify a
value for <compref ref="f-mil"/> other than <propref comp="f-mil" prop="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="f-mil"/> 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 comp="f-mil" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-mil" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-mil" prop="annotations">
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 comp="std" prop="variety"/> is <termref def="dt-atomic"/> then
<olist>
<item>
<p>
if <propref comp="std" prop="primitive type definition"/> 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 comp="f-mil" prop="value"/>;
</p>
</item>
<item>
<p>
if <propref comp="std" prop="primitive type definition"/> 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 comp="f-mil" prop="value"/>;
</p>
</item>
<item>
<p>

if <propref comp="std" prop="primitive type definition"/> is <dtref ref="QName"/> or <dtref ref="NOTATION"/>, then
any <propref comp="f-mil" prop="value"/> is facet-valid.
</p>
</item>
</olist>
</p>
</item>
<item>
<p>
if the <propref comp="std" prop="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 comp="f-mil" prop="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="f-mil"/> and <compref ref="f-mal"/>
are members of <propref comp="std" prop="facets"/>, then the
<propref comp="f-mil" prop="value"/> of <compref ref="f-mil"/>
&nbsp;<termref def="dt-must"/> be less than or equal to the
<propref comp="f-mal" prop="value"/> of <compref ref="f-mal"/>.
</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="f-mil"/>
is among the members of <propref comp="std" prop="facets"/> of
<propref comp="std" prop="base type definition"/> and <propref comp="f-mil" prop="value"/> is
less than the <propref comp="f-mil" prop="value"/> of the parent
<compref ref="f-mil"/>.
</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 comp="std" prop="base type definition"/>.
</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" abbrev="f-mal"/>

<p>
If <propref comp="f-mal" prop="fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref comp="std" prop="base type definition"/> cannot specify a
value for <compref ref="f-mal"/> other than <propref comp="f-mal" prop="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="f-mal"/> 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 comp="f-mal" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-mal" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-mal" prop="annotations">
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 comp="std" prop="variety"/> is <termref def="dt-atomic"/> then
<olist>
<item>
<p>
if <propref comp="std" prop="primitive type definition"/> 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 comp="f-mal" prop="value"/>;
</p>
</item>
<item>
<p>
if <propref comp="std" prop="primitive type definition"/> 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 comp="f-mal" prop="value"/>;
</p>
</item>
<item>
<p>

if <propref comp="std" prop="primitive type definition"/> is <dtref ref="QName"/> or <dtref ref="NOTATION"/>, then
any <propref comp="f-mal" prop="value"/> is facet-valid.
</p>
</item>
</olist>
</p>
</item>
<item>
<p>
if the <propref comp="std" prop="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 comp="f-mal" prop="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="f-mal"/>
is among the members of <propref comp="std" prop="facets"/> of
<propref comp="std" prop="base type definition"/> and <propref comp="f-mal" prop="value"/> is
greater than the <propref comp="f-mal" prop="value"/> of the parent
<compref ref="f-mal"/>.
</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" abbrev="f-p"/>
</div4>

<div4 role="1.0" id="xr-pattern">
<head>XML Representation of pattern Schema Components</head>
<p>
The XML representation for a <compref ref="f-p"/> 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 comp="f-p" prop="value"/>&nbsp;<termref def="dt-must"/> be a valid
<termref def="dt-regex"/>.
</reprdep>
<propmap comp="f-p" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-p" prop="annotations">
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<phrase diff="add" dg="iff"> and only if</phrase>:
</p>
<olist>
<item>
<p>
the literal is among the set of character sequences denoted by
the <termref def="dt-regex"/> specified in <propref comp="f-p" prop="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" abbrev="f-e"/>
</div4>

<div4 role="1.0" id="xr-enumeration">
<head>XML Representation of enumeration Schema Components</head>
<p>
The XML representation for an <compref ref="f-e"/> 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 comp="f-e" prop="value"/>&nbsp;<termref def="dt-must"/> be
in the <termref def="dt-value-space"/> of <propref comp="std" prop="base type definition"/>.
</reprdep>
<propmap comp="f-e" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-e" prop="annotations">
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 comp="f-e" prop="value"/> of the <compref ref="f-e"/>
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<phrase diff="add" dg="iff"> and only if</phrase>
the value is one of the values specified in
<propref comp="f-e" prop="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 comp="f-e" prop="value"/> is not in the <termref def="dt-value-space"/>
of <propref comp="std" prop="base type definition"/>.
</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" abbrev="f-w"/>

<p>
If <propref comp="f-w" prop="fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref comp="std" prop="base type definition"/> cannot specify a
value for <compref ref="f-w"/> other than <propref comp="f-w" prop="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="f-w"/> 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 comp="f-w" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-w" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-w" prop="annotations">
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="f-w"/>
is among the members of <propref comp="std" prop="facets"/> of
<propref comp="std" prop="base type definition"/> and any of the following conditions is
true:
</p>
<olist>
<item>
<p>
<propref comp="f-w" prop="value"/> is <emph>replace</emph> or <emph>preserve</emph>
and the <propref comp="f-w" prop="value"/> of the parent
<compref ref="f-w"/> is <emph>collapse</emph>
</p>
</item>
<item>
<p>
<propref comp="f-w" prop="value"/> is <emph>preserve</emph>
and the <propref comp="f-w" prop="value"/> of the parent
<compref ref="f-w"/> 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">
<phrase>maxInclusive</phrase> is the <phrase diff="del" dg="fa1-fix"><termref def="dt-inclusive-upper-bound">inclusive upper
bound</termref></phrase><phrase diff="add" dg="fa1-fix"><phrase>inclusive upper bound</phrase></phrase> 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 <phrase diff="add" dg="rq31m">equal to some value</phrase>
in the <termref def="dt-value-space"/> of the <termref def="dt-basetype"/>.
</termdef>
</p>

<!--* <p diff="add" dg="rq31m"><termdef id="dt-numVal" term="numeric value">
In discussions of the constraints on value spaces imposed by various
facets, the <term>numeric value</term> of a value <var>d</var> in the
&odec; value space is just <var>d</var> itself.  The <term>numeric
value</term> of a value <var>p</var> in the value space of &pD; is the
value of the <pfref ref="vp-pd-numVal"/> property of <var>p</var>.
</termdef>
As noted in the definition of <dtref ref="&pD;"/>, for purposes
of numeric comparisons, a numeric <dtref ref="&pD;"/> value <var>v</var>
is less than, equal to, or greater than, some upper or lower
bound just in case its <pfref ref="vp-pd-numVal"/> is.
</p> *-->
<!--* need further work here? *-->
<p>
<termref def="dt-maxInclusive"/> provides for:
</p>
<ulist>
<item>
<p>
Constraining a <termref def="dt-value-space"/> to values with a
specific <phrase diff="del" dg="fa1-fix"><termref def="dt-inclusive-upper-bound">inclusive upper bound</termref></phrase><phrase diff="add" dg="fa1-fix"><phrase>inclusive upper
bound</phrase></phrase>.
</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" abbrev="f-mai"/>

<p>
If <propref comp="f-mai" prop="fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref comp="std" prop="base type definition"/> cannot specify a
value for <compref ref="f-mai"/> other than <propref comp="f-mai" prop="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="f-mai"/> 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 comp="f-mai" prop="value"/>&nbsp;<termref def="dt-must"/> 
be <phrase diff="add" dg="rq31m">equal to some value</phrase>
in the <termref def="dt-value-space"/> of <propref comp="std" prop="base type definition"/>.
</reprdep>
<propmap comp="f-mai" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-mai" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
<phrase diff="del" dg="rq31m">, if present, otherwise false</phrase>
</propmap>
<propmap comp="f-mai" prop="annotations">
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 <phrase diff="add" dg="vrd"><var>v</var></phrase>
in an <termref def="dt-ordered"/>&nbsp;<termref def="dt-value-space"/>
is facet-valid with respect to 
<termref def="dt-maxInclusive"/><phrase diff="del" dg="vrd">,
determined as follows</phrase><phrase diff="add" dg="vrd">if
and only if one of the following is true</phrase>:
</p>


<olist diff="del" dg="vrd">
<item>
<p>
if the 
<phrase diff="del" dg="fa1-fix"><termref def="dt-numeric">numeric</termref> property in
<propref comp="std" prop="fundamental facets"/></phrase>
<phrase diff="add" dg="fa1-fix"><propref comp="ff-n" prop="value"/> property 
of the <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/></phrase> 
is <emph>true</emph>, then the value
<termref def="dt-must"/> be 
numerically less than or
equal to <propref comp="f-mai" prop="value"/>;
</p>
</item>
<item>
<p>
if the 
<phrase diff="del" dg="fa1-fix"><termref def="dt-numeric">numeric</termref> property in
<propref comp="std" prop="fundamental facets"/></phrase>
<phrase diff="add" dg="fa1-fix"><propref comp="ff-n" prop="value"/> property 
of the <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/></phrase> 
is <emph>false</emph> (i.e.,
<propref comp="std" prop="base type definition"/> is one of the date and time related
datatypes), then the value 
<termref def="dt-must"/> be 
chronologically
less than or equal to <propref comp="f-mai" prop="value"/>;
</p>
</item>
</olist>
<olist diff="add" dg="vrd">
<item><p>The <compref ref="ff-n"/> component in 
<propref comp="std" prop="fundamental facets"/> 
has a <propref comp="ff-n" prop="value"/> of <pt>true</pt>,
and <!--* the <termref def="dt-numVal"/> of *-->
<var>v</var> is
numerically less than or equal to <propref comp="f-mai" prop="value"/>.
</p>
</item>
<item>
<p>
The <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/> 
has a <propref comp="ff-n" prop="value"/> of <pt>false</pt>
(i.e., <propref comp="std" prop="primitive type definition"/> is 
one of the date and time related datatypes), and <var>v</var>
is chronologically less than or equal to <propref comp="f-mai" prop="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 <phrase diff="del" dg="vrd">&lt;=</phrase><phrase diff="add" dg="vrd">&le;</phrase> 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="f-mai"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mai" prop="value"/> is
greater than the <propref comp="f-mai" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mai"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mae"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mai" prop="value"/> is
greater than or equal to the <propref comp="f-mae" prop="value"/> of
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mae"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mii"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mai" prop="value"/> is
less than the <propref comp="f-mii" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mii"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mie"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mai" prop="value"/> is
less than or equal to the <propref comp="f-mie" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mie"/><phrase diff="add" dg="rq31m">.</phrase>
</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 <phrase diff="del" dg="fa1-fix"><termref def="dt-exclusive-upper-bound">exclusive upper
bound</termref></phrase> <phrase diff="add" dg="fa1-fix"><phrase>exclusive upper bound</phrase></phrase> 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 <phrase diff="add" dg="rq31m">equal to some value</phrase>
in the
<termref def="dt-value-space"/> of the <termref def="dt-basetype"/> or
be equal to <propref comp="f-mae" prop="value"/> in <propref comp="std" prop="base type definition"/>. </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 <phrase diff="del" dg="fa1-fix"><termref def="dt-exclusive-upper-bound">exclusive upper bound</termref></phrase><phrase diff="add" dg="fa1-fix"><phrase>exclusive upper
bound</phrase></phrase>.
</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" abbrev="f-mae"/>

<p>
If <propref comp="f-mae" prop="fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref comp="std" prop="base type definition"/> cannot specify a
value for <compref ref="f-mae"/> other than <propref comp="f-mae" prop="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="f-mae"/> 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 comp="f-mae" prop="value"/>&nbsp;<termref def="dt-must"/> 
be <phrase diff="add" dg="rq31m">equal to some value</phrase>
in the <termref def="dt-value-space"/> of <propref comp="std" prop="base type definition"/>.
</reprdep>
<propmap comp="f-mae" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-mae" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-mae" prop="annotations">
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 <phrase diff="add" dg="vrd"><var>v</var></phrase>
in an <termref def="dt-ordered"/>&nbsp;<termref def="dt-value-space"/>
is facet-valid with respect to 
<termref def="dt-maxExclusive"/><phrase diff="del" dg="vrd">, determined
as follows</phrase><phrase diff="add" dg="vrd">if 
and only if one of the following is true</phrase>:
</p>
<olist diff="del" dg="vrd">
<item>
<p>
if the 
<phrase diff="del" dg="fa1-fix">
<termref def="dt-numeric">numeric</termref> property in
<propref comp="std" prop="fundamental facets"/></phrase>
<phrase diff="add" dg="fa1-fix"><propref comp="ff-n" prop="value"/> property 
of the <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/></phrase> 
is <emph>true</emph>, then the
value <termref def="dt-must"/> be numerically less than
<propref comp="f-mae" prop="value"/>;
</p>
</item>
<item>
<p>
if the 
<phrase diff="del" dg="fa1-fix">
<termref def="dt-numeric">numeric</termref> property in
<propref comp="std" prop="fundamental facets"/></phrase>
<phrase diff="add" dg="fa1-fix"><propref comp="ff-n" prop="value"/> property 
of the <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/></phrase>
is <emph>false</emph> (i.e.,
<propref comp="std" prop="base type definition"/> is one of the date and time related
datatypes), then the value <termref def="dt-must"/> be chronologically
less than <propref comp="f-mae" prop="value"/>;
</p>
</item>
</olist>
<olist diff="add" dg="vrd">
<item>
<p>The <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/> 
has a <propref comp="ff-n" prop="value"/> of <pt>true</pt>,
and <!--* the <termref def="dt-numVal"/> of *-->
<var>v</var> is numerically less than
<propref comp="f-mae" prop="value"/>.
</p>
</item>
<item>
<p>The <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/>
has a <propref comp="ff-n" prop="value"/> of <pt>false</pt> (i.e.,
<propref comp="std" prop="base type definition"/> is one of the date and time related
datatypes), and <var>v</var> is chronologically
less than <propref comp="f-mae" prop="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="f-mae"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mae" prop="value"/> is
greater than the <propref comp="f-mae" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mae"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mai"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mae" prop="value"/> is
greater than the <propref comp="f-mai" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mai"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mii"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mae" prop="value"/> is
less than or equal to the <propref comp="f-mii" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mii"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mie"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mae" prop="value"/> is
less than or equal to the <propref comp="f-mie" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mie"/><phrase diff="add" dg="rq31m">.</phrase>
</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 <phrase diff="del" dg="fa1-fix"><termref def="dt-exclusive-lower-bound">exclusive lower
bound</termref></phrase> <phrase diff="add" dg="fa1-fix"><phrase>exclusive lower bound</phrase></phrase> 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 <phrase diff="add" dg="rq31m">equal to some value</phrase>
in the
<termref def="dt-value-space"/> of the <termref def="dt-basetype"/> or
be equal to <propref comp="f-mie" prop="value"/> in <propref comp="std" prop="base type definition"/>. </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 <phrase diff="del" dg="fa1-fix"><termref def="dt-exclusive-lower-bound">exclusive lower
bound</termref></phrase><phrase diff="add" dg="fa1-fix"><phrase>exclusive lower bound</phrase></phrase>.
</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 
<phrase diff="del" dg="rq31m">previous</phrase><phrase diff="add" dg="rq31m">following</phrase>
one (named 'one-hundred-or-more').
</p>
</note>

<div4 role="1.0" id="dc-minExclusive">
<head>The minExclusive Schema Component</head>
<compdef name="minExclusive" abbrev="f-mie"/>

<p>
If <propref comp="f-mie" prop="fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref comp="std" prop="base type definition"/> cannot specify a
value for <compref ref="f-mie"/> other than <propref comp="f-mie" prop="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="f-mie"/> 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 comp="f-mie" prop="value"/>&nbsp;<termref def="dt-must"/> 
be <phrase diff="add" dg="rq31m">equal to some value</phrase>
in the <termref def="dt-value-space"/> of <propref comp="std" prop="base type definition"/>.
</reprdep>
<propmap comp="f-mie" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-mie" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-mie" prop="annotations">
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<phrase diff="add" dg="iff"> and only if</phrase>:
</p>
<olist diff="del" dg="vrd">
<item>
<p>
if the 
<phrase diff="del" dg="fa1-fix">
<termref def="dt-numeric">numeric</termref> property in
<propref comp="std" prop="fundamental facets"/></phrase>
<phrase diff="add" dg="fa1-fix"><propref comp="ff-n" prop="value"/> property 
of the <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/></phrase>
is <emph>true</emph>, then the
value 
<termref def="dt-must"/> be 
numerically greater than
<propref comp="f-mie" prop="value"/>;
</p>
</item>
<item>
<p>
if the 
<phrase diff="del" dg="fa1-fix">
<termref def="dt-numeric">numeric</termref> property in
<propref comp="std" prop="fundamental facets"/></phrase>
<phrase diff="add" dg="fa1-fix"><propref comp="ff-n" prop="value"/> property 
of the <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/></phrase>
is <emph>false</emph> (i.e.,
<propref comp="std" prop="base type definition"/> is one of the date and time related
datatypes), then the value 
<termref def="dt-must"/> be 
chronologically
greater than <propref comp="f-mie" prop="value"/>;
</p>
</item>
</olist>
<olist diff="add" dg="vrd">
<item>
<p>The <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/>
has a <propref comp="ff-n" prop="value"/> of <pt>true</pt>,
and the value is numerically greater than
<propref comp="f-mie" prop="value"/>.
</p>
</item>
<item>
<p>The <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/> has a <propref comp="ff-n" prop="value"/> of <pt>false</pt> (i.e.,
<propref comp="std" prop="base type definition"/> is one of the date
and time related datatypes), and the value is chronologically greater
than <propref comp="f-mie" prop="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="f-mie"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mie" prop="value"/> is
less than the <propref comp="f-mie" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mie"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mai"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mie" prop="value"/> is
greater the <propref comp="f-mai" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mai"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mii"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mie" prop="value"/> is
less than the <propref comp="f-mii" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mii"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mae"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mae" prop="value"/> is
greater than or equal to the <propref comp="f-mae" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mae"/><phrase diff="add" dg="rq31m">.</phrase>
</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 <phrase diff="del" dg="fa1-fix"><termref def="dt-inclusive-lower-bound">inclusive lower
bound</termref></phrase> <phrase diff="add" dg="fa1-fix"><phrase>inclusive lower bound</phrase></phrase> 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 <phrase diff="add" dg="rq31m">equal to some value</phrase> 
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 <phrase diff="del" dg="fa1-fix"><termref def="dt-inclusive-lower-bound">inclusive lower bound</termref></phrase><phrase diff="add" dg="fa1-fix"><phrase>inclusive lower
bound</phrase></phrase>.
</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" abbrev="f-mii"/>

<p>
If <propref comp="f-mii" prop="fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref comp="std" prop="base type definition"/> cannot specify a
value for <compref ref="f-mii"/> other than <propref comp="f-mii" prop="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="f-mii"/> 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 comp="f-mii" prop="value"/>&nbsp;<termref def="dt-must"/> 
be <phrase diff="add" dg="rq31m">equal to some value</phrase> 
in the <termref def="dt-value-space"/> of <propref comp="std" prop="base type definition"/>.
</reprdep>
<propmap comp="f-mii" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-mii" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-mii" prop="annotations">
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<phrase diff="add" dg="iff"> and only if</phrase>:
</p>
<olist>
<item>
<p>
if the 
<phrase diff="del" dg="fa1-fix">
<termref def="dt-numeric">numeric</termref> property in
<propref comp="std" prop="fundamental facets"/></phrase>
<phrase diff="add" dg="fa1-fix"><propref comp="ff-n" prop="value"/> property 
of the <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/></phrase>
is <emph>true</emph>, then the
value 
<termref def="dt-must"/> be 
numerically greater than or equal to
<propref comp="f-mii" prop="value"/>;
</p>
</item>
<item>
<p>
if the 
<phrase diff="del" dg="fa1-fix">
<termref def="dt-numeric">numeric</termref> property in
<propref comp="std" prop="fundamental facets"/></phrase>
<phrase diff="add" dg="fa1-fix"><propref comp="ff-n" prop="value"/> property 
of the <compref ref="ff-n"/> component in
<propref comp="std" prop="fundamental facets"/></phrase>
is <emph>false</emph> (i.e.,
<propref comp="std" prop="base type definition"/> is one of the date and time related
datatypes), then the value 
<termref def="dt-must"/> be 
chronologically
greater than or equal to <propref comp="f-mii" prop="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="f-mii"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mii" prop="value"/> is
less than the <propref comp="f-mii" prop="value"/> of
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mii"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mai"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mii" prop="value"/> is
greater the <propref comp="f-mai" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mai"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mie"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mii" prop="value"/> is
less than or equal to the <propref comp="f-mie" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mie"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
<item>
<p>
<compref ref="f-mae"/> is among the members of
<propref comp="std" prop="facets"/> of <propref comp="std" prop="base type definition"/>
and <propref comp="f-mii" prop="value"/> is
greater than or equal to the <propref comp="f-mae" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<compref ref="f-mae"/><phrase diff="add" dg="rq31m">.</phrase>
</p>
</item>
</olist>
</constraintnote>
</div4>

</div3>

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

<!--* status quo ante *-->
<p diff="del" dg="pd1">
<termdef id="del_pd1-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&nbsp;&times;&nbsp;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>

<!--* pd1 *-->
<!--* <p diff="del" dg="rq31facets"><phrase diff="add" dg="pd1">
<phrase diff="del" dg="rq31facets">
<termdef id="del_rq31facets_dt-totalDigits" term="totalDigits" role="local">
<term>totalDigits</term> places an upper limit on the <vpropref
ref="vp-pd-precision"/> of <dtref ref="&pD;"/> values.&nbsp; <phrase
role="UNSURE">The effect is to require that a value in the derived
datatype must have floating-point precision less than or equal to the
fractionDigits value.</phrase></termdef></phrase></phrase>
</p> *-->

<!--* rq31facets *-->
<!--* <p diff="add" dg="rq31facets">[v.0]
<termdef id="dt-totalDigits" term="totalDigits" role="local">
<term>totalDigits</term> 
restricts the <termref def="dt-value-space">value spaces</termref> 
of <dtref ref="&pD;"/> and datatypes derived from it.
If the <propref prop="value" comp="f-td"/> of <compref ref="f-td"/> is
<var>t</var>, the effect is to restrict the value space 
to values with <vpropref ref="vp-pd-numVal"/> expressible as
<var>i</var>&nbsp;&times;&nbsp;10<sup><var>n</var></sup>, for some
integers <var>i</var> and <var>n</var>, with 
|&nbsp;<var>i</var>&nbsp;| &lt; 10<sup><var>t</var></sup>.
The <propref prop="value" comp="f-td" /> of 
<term>totalDigits</term>&nbsp;<termref def="dt-must"/> be
a <dtref ref="positiveInteger"/>.
</termdef></p> *-->

<p diff="add" dg="rq31m">
<termdef id="dt-totalDigits" term="totalDigits" role="local">
<term>totalDigits</term> 
restricts the magnitude and <termref def="dt-arithmetic-precision"/> of values in the
<termref def="dt-value-space">value spaces</termref> 
of <dtref ref="&pD;"/> and
<dtref ref="&odec;"/> 
and datatypes derived from them.</termdef>
The effect must be described separately for the two primitive types.
</p>
<p diff="add" dg="rq31m">
For <dtref ref="&odec;"/>,
if the <propref prop="value" comp="f-td"/> of <compref ref="f-td"/> is
<var>t</var>, the effect is to require that values be equal to
<phrase diff="del" dg="rq31fix"><var>i</var>&nbsp;&times;&nbsp;10<sup><var>n</var></sup></phrase><phrase diff="add" dg="rq31fix"><var>i</var>&nbsp;/&nbsp;10<sup><var>n</var></sup></phrase>, for some
integers <var>i</var> and <var>n</var>, with 
|&nbsp;<var>i</var>&nbsp;| &lt; 10<sup><var>t</var></sup>
and
0&nbsp;&le;&nbsp;<var>n</var>&nbsp;&le;&nbsp;<var>t</var>.
This has as a consequence that the values are expressible
using at most <var>t</var> digits in decimal notation.
</p>

<p diff="add" dg="rq31m">
For <dtref ref="&pD;"/>, values with <vpropref ref="vp-pd-numVal"/> of
<var>nV</var> and
<vpropref ref="vp-pd-precision"/> of <var>aP</var>, if the
<propref prop="value" comp="f-td"/> of <compref ref="f-td"/> is
<var>t</var>, the effect is to require that (<var>aP</var> + 1 +
<phrase role="eqn">log</phrase><sub>10</sub>(|&nbsp;<var>nV</var>&nbsp;|)
<termref def="dt-div"/> 1) &le; <var>t</var>, for values other than
zero, NaN, and the infinities. This means in effect that values are
expressible in scientific notation
using at most <var>t</var> digits for the coefficient.
</p>
<p diff="add" dg="rq31m">
The <propref prop="value" comp="f-td"/> of 
<compref ref="f-td"/> &must; be
a <dtref ref="positiveInteger"/>.
</p>

<p>
The term <mention>totalDigits</mention> 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<phrase diff="add" dg="rq31m"> in
decimal notation, or at most <emph role="eq">totalDigits</emph> digits
for the coefficient, in scientific notation</phrase>.&nbsp;
Note that it does not restrict
the <termref def="dt-lexical-space"/> directly; a lexical
representation that adds 
<phrase diff="del" dg="rq31m">additional leading zero digits or trailing 
fractional</phrase><phrase diff="add" dg="rq31facets">non-significant
leading or trailing</phrase> 
zero digits is still permitted.
<phrase diff="add" dg="rq31m">It also has no effect on the values 
NaN, INF, and -INF.</phrase>
</p>

<div4 role="1.0" id="dc-totalDigits">
<head>The totalDigits Schema Component</head>
<compdef name="totalDigits" abbrev="f-td"/>

<p>
If <propref comp="f-td" prop="fixed"/> is <emph>true</emph>, then types for which
the current type is the <propref comp="std" prop="base type definition"/> 
<!--* perhaps simpler to just say 
    * "types immediately derived from the current type" 
    * but I'm in change-as-little-as-you-can mode.
    *-->
<phrase diff="del" dg="rq31facets">cannot</phrase>
<phrase diff="add" dg="rq31facets">&must; not</phrase> specify a
value for <compref ref="f-td"/> other than
<propref comp="f-td" prop="value"/>.
</p>
<!--* <ednote diff="add" dg="review">
<edtext>N.B. this constraint on facets with fixed values should
(a) be expressed in a validation rule and (b) be expressed
once for all, instead of once for each facet.  A future
editorial change proposal.</edtext>
</ednote> *-->
</div4>

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

<p>
The XML representation for a <compref ref="f-td"/> 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 comp="f-td" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-td" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-td" prop="annotations">
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 diff="del" dg="rq31facets">A value in a <termref def="dt-value-space"/> is facet-valid with respect to 
<termref def="dt-totalDigits"/>
if<phrase diff="add" dg="iff"> and only if</phrase>:</p>
<olist diff="del" dg="rq31facets">
<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 comp="f-td" prop="value"/></emph> and
<emph role="eq">0 &lt;= n &lt;= <propref comp="f-td" prop="value"/></emph>.
</p>
<!--* use of the word 'value' in such close proximity to the
    * property reference {value} seems prone to confusion.
    * Let's try to reduce the risk. *-->
<!--* <phrase diff="add" dg="rq31facets">
that value is expressible as
<var>i</var>&nbsp;&times;&nbsp;10<sup><var>n</var></sup> for some
integers <var>i</var> and <var>n</var>, such that if
<var>t</var> is the <propref comp="f-td" prop="value"/>
of <compref ref="f-td"/>, then 
|&nbsp;<var>i</var>&nbsp;| &lt; 10<sup><var>t</var></sup> 
and 0 &le; <var>n</var> &le; <var>t</var>.
</phrase> *-->
</item>
</olist>

<p diff="add" dg="rq31m">A value <var>v</var>
is facet-valid with respect to a <compref ref="f-td"/> facet with 
a <propref prop="value" comp="f-td"/> of <var>t</var> if and only 
if one of the following is true:</p>

<olist diff="add" dg="rq31m">
<item>
<p><var>v</var> is a <dtref ref="&pD;"/> value with 
<vpropref ref="vp-pd-numVal"/> of
<phrase diff="del" dg="rq31fix">NaN, INF, 
-INF</phrase><phrase diff="add" dg="rq31fix"><pt>positiveInfinity</pt>, 
<pt>negativeInfinity</pt>, <pt>notANumber</pt></phrase>,
or zero.
</p></item>
<item>
<p><var>v</var> is a <dtref ref="&pD;"/> value 
with <vpropref ref="vp-pd-numVal"/> of <var>nV</var> and <vpropref ref="vp-pd-precision"/> of <var>aP</var>, and 
<phrase diff="del" dg="rq31fix"><var>nV</var></phrase><phrase diff="del" dg="rq31fix"><var>v</var></phrase> 
is not NaN, INF, -INF, or zero, 
and (<var>aP</var> + 1 + 
<phrase role="eqn">log</phrase><sub>10</sub>(|&nbsp;<var>nV</var>&nbsp;|)
<termref def="dt-div"/> 1) &le; <var>t</var>.
</p></item>
<item>
<p><var>v</var> is a <dtref ref="&odec;"/> value equal to 
<phrase diff="del" dg="rq31fix"><var>i</var>&nbsp;&times;&nbsp;10<sup><var>n</var></sup></phrase><phrase diff="add" dg="rq31fix"><var>i</var>&nbsp;/&nbsp;10<sup><var>n</var></sup></phrase>, 
for some
integers <var>i</var> and <var>n</var>, with 
|&nbsp;<var>i</var>&nbsp;| &lt; 10<sup><var>t</var></sup>
and
0&nbsp;&le;&nbsp;<var>n</var>&nbsp;&le;&nbsp;<var>t</var>.
</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 diff="del" dg="rq31facets">
It is an <termref def="dt-error"/> if
<compref ref="f-td"/> is among the members of
<propref comp="std" prop="facets"/> of 
<propref comp="std" prop="base type definition"/>
and <propref comp="f-td" prop="value"/> is
greater than the <propref comp="f-td" prop="value"/> of  
the parent
<compref ref="f-td"/>.
</p>

<p diff="add" dg="rq31facets">
It is an <termref def="dt-error"/> if the owner's
<propref comp="std" prop="base type definition"/>
has a <compref ref="f-td"/> facet 
among its <propref comp="std" prop="facets"/>
and
<propref comp="f-td" prop="value"/> is
greater than the <propref comp="f-td" prop="value"/> of
that <compref ref="f-td"/> facet.
</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>
<phrase diff="del" dg="pd1">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>.</phrase><phrase diff="add" dg="rq31m">places an upper limit on the <termref def="dt-arithmetic-precision"/> of <dtref ref="&odec;"/> values: if the <propref comp="f-fd" prop="value"/> of
<term>fractionDigits</term> = <var>f</var>, then the value space is
restricted to values equal to
<var>i</var>&nbsp;/&nbsp;10<sup><var>n</var></sup> for some integers
<var>i</var> and
<var>n</var> and <!--* <var>minFractionDigits</var> &le; *-->
0 &le; <var>n</var> &le; <var>f</var>.</phrase></termdef>
The value of
<term>fractionDigits</term>&nbsp;<termref def="dt-must"/> be a <dtref ref="nonNegativeInteger"/>
</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 
<phrase diff="add" dg="rq31m">in decimal notation</phrase> 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 
<phrase diff="del" dg="pd1">non-<termref def="dt-canonical-representation"/></phrase><phrase diff="add" dg="pd1">lexical representation</phrase> that adds 
<phrase diff="del" dg="rq31m">additional 
leading zero digits or non-significant trailing 
fractional</phrase><phrase diff="add" dg="rq31m">non-significant
leading or trailing</phrase> 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" abbrev="f-fd"/>

<p>
If <propref comp="f-fd" prop="fixed"/> is <emph>true</emph>, then
types for which the current type is the <propref comp="std" prop="base
type definition"/> 
<phrase diff="del" dg="rq31facets">cannot</phrase><phrase diff="add" dg="rq31facets">&must; not</phrase>
specify a value for <compref ref="f-fd"/> other
than <propref comp="f-fd" prop="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="f-fd"/> 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 comp="f-fd" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-fd" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-fd" prop="annotations">
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 <phrase diff="del" dg="rq31m">in a <termref def="dt-value-space"/></phrase>
is facet-valid with
respect to <termref def="dt-fractionDigits"/> 
if<phrase diff="add" dg="iff"> and only if</phrase>
<phrase diff="del" dg="rq31facets">
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 comp="f-fd" prop="value"/></emph>.
<!--* as before for total digits, so also here *-->
<!--* <phrase diff="add" dg="rq31facets">
that value is expressible as 
<var>i</var>&nbsp;/&nbsp;10<sup><var>n</var></sup>
for some integers <var>i</var> and <var>n</var>, such that if
<var>f</var> is the <propref comp="f-fd" prop="value"/>
of <compref ref="f-fd"/>, then 
0 &le; <var>n</var> &le; <var>f</var>.
</phrase> *-->

</phrase>
<phrase diff="add" dg="rq31m">
that value is equal to
<var>i</var>&nbsp;/&nbsp;10<sup><var>n</var></sup> for integer
<var>i</var> and
<var>n</var>, with <!--* <var>minFractionDigits</var> &le; *-->
0 &le; <var>n</var> &le; <propref comp="f-fd" prop="value"/>.
</phrase>
</p>
</constraintnote>
</div4>

<div4 role="1.0" id="fractionDigits-coss">
<head>Constraints on fractionDigits Schema Components</head>
<!--* MSM inclines to the belief that this constraint should go away.
    * There is a prose statement in the intro paragraphs; that
    * suffices for clarity.  But this is something the WG should
    * really just vote on.
    *-->
<!--*
<constraintnote type="cos" id="fractionDigits-nonNegative" diff="add" dg="rq31m">
<head>fractionDigits greater than or equal to zero</head>
<p>
It is an <termref def="dt-error"/> for 
the <propref comp="f-fd" prop="value"/> of 
<compref ref="f-fd"/> to be less than zero.
</p>
</constraintnote>
*-->
<!--* The WG agreed, 2005-02-04 *-->


<constraintnote type="cos" id="fractionDigits-totalDigits">
<head>fractionDigits less than or equal to totalDigits</head>
<p>
It is an <termref def="dt-error"/> for 
<phrase diff="add" dg="rq31m">the <propref comp="f-fd" prop="value"/> of 
</phrase><phrase diff="del" dg="rq31m"><termref def="dt-fractionDigits"/></phrase><phrase diff="add" dg="rq31m"><compref ref="f-fd"/></phrase>
to be greater than that of
<phrase diff="del" dg="rq31m"><termref def="dt-totalDigits"/></phrase><phrase diff="add" dg="rq31m"><compref ref="f-td"/></phrase>.
</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 comp="std" prop="facets"/> of
<propref comp="std" prop="base type definition"/> and
<propref comp="f-fd" prop="value"/> is greater than the <propref comp="f-fd" prop="value"/> of 
<phrase diff="del" dg="rq31m">the parent</phrase><phrase diff="add" dg="rq31m">that</phrase>
<termref def="dt-fractionDigits"/>.
</p>
</constraintnote>
</div4>
</div3>

<div3 role="1.0" id="rf-maxScale" diff="add" dg="rq31m">
<head>maxScale</head>

<p>
<termdef id="dt-maxScale" term="maxScale" role="local">
<term>maxScale</term> places an upper limit on the <termref def="dt-arithmetic-precision"/> of <dtref ref="&pD;"/> values: if the
<propref comp="f-ms" prop="value"/> of <term>maxScale</term> =
<var>m</var>, then only values with 
<vpropref ref="vp-pd-precision"/> &le; <var>m</var>
are retained in
the <termref def="dt-value-space"/>.</termdef> 
As a consequence, every value in the value space will have
<vpropref ref="vp-pd-numVal"/> equal to
<var>i</var>&nbsp;/&nbsp;10<sup><var>n</var></sup> for some integers
<var>i</var> and <var>n</var>, with
<var>n</var> &le; <var>m</var>.
The <propref comp="f-ms" prop="value"/> of
<compref ref="f-ms"/> must be an <dtref ref="integer"/>.  
<!--* not sure about including this next sentence *-->
If it is negative, the numeric values of the datatype are 
restricted to multiples of 10 (or 100, or &hellip;).
</p>

<p>
The term <mention>maxScale</mention> is chosen to reflect the fact that it
restricts the <termref def="dt-value-space"/> to those values that can
be represented lexically in scientific notation using an integer
coefficient and a scale (or negative exponent) no greater than 
<compref ref="f-ms"/>. (It has nothing to do with the use of the
term <mention>scale</mention> to denote the radix or base of a
notation.) Note that <compref ref="f-ms"/> does not restrict the
<termref def="dt-lexical-space"/> directly; a lexical representation 
that adds non-significant leading or trailing zero digits, or that uses 
a lower exponent with a non-integer coefficient is still permitted.
</p>

<note role="example">
<p>
The following is the definition of a user-defined
datatype which could be used to represent a floating-point decimal 
datatype which allows seven decimal digits for the coefficient and 
exponents between &minus;95 and 96.  Note that the scale is &minus;1 times
the exponent.
</p>
<eg><![CDATA[<simpleType name='decimal32'>
  <restriction base=']]>&pD;<![CDATA['>
    <totalDigits value='7'/>
    <maxScale value='95'/>
    <minScale value='-96'/>
  </restriction>
</simpleType>
]]></eg>
</note>

<div4 role="1.0" id="dc-maxScale">
<head>The maxScale Schema Component</head>
<compdef name="maxScale" abbrev="f-ms"/>

<p>
If <propref comp="f-ms" prop="fixed"/> is <pt>true</pt>, then
types for which the current type is the 
<propref comp="std" prop="base type definition"/> 
&must; not specify a value for <compref ref="f-ms"/> other
than <propref comp="f-ms" prop="value"/>.
</p>
</div4>

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

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

<reprdef>
<reprelt eltname="maxScale"/>
<reprcomp abstract="maxScale" ref="dc-maxScale">
<propmap comp="f-ms" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-ms" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-ms" prop="annotations">
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="maxScale-validation-rules">
<head>maxScale Validation Rules</head>
<constraintnote type="cvc" id="cvc-maxScale-valid">
<head>maxScale Valid</head>
<p>
A <dtref ref="&pD;"/> value <var>v</var> is facet-valid with
respect to <compref ref="f-ms"/> if and only if one of the
following is true:
</p>
<olist>
<item>
<p><var>v</var> has <vpropref ref="vp-pd-precision"/> 
less than or equal to the 
<propref comp="f-ms" prop="value"/> of <compref ref="f-ms"/>.</p>
</item>
<item>
<p>The <vpropref ref="vp-pd-precision"/> of <var>v</var>
is <pt>absent</pt>.</p>
</item>
</olist>
</constraintnote>
</div4>

<div4 role="1.0" id="maxScale-coss">
<head>Constraints on maxScale Schema Components</head>

<constraintnote type="cos" id="maxScale-valid-restriction">
<head>maxScale valid restriction</head>
<p>
It is an <termref def="dt-error"/> if <compref ref="f-ms"/> 
is among the members of <propref comp="std" prop="facets"/> of
<propref comp="std" prop="base type definition"/> and
<propref comp="f-ms" prop="value"/> is greater than the <propref comp="f-ms" prop="value"/> of that <compref ref="f-ms"/>.
</p>
</constraintnote>
</div4>
</div3>

<div3 role="1.0" id="rf-minScale" diff="add" dg="rq31facets">
<head>minScale</head>

<p>
<termdef id="dt-minScale" term="minScale" role="local">
<term>minScale</term> places a lower limit on
the <termref def="dt-arithmetic-precision"/> of <dtref ref="&pD;"/> values.
If the <propref comp="f-mns" prop="value"/> of <term>minScale</term> 
is <var>m</var>, then the value space is restricted to values with 
<vpropref ref="vp-pd-precision"/> &ge; <var>m</var>.</termdef>
As a consequence, every value in the value space will have
<vpropref ref="vp-pd-numVal"/> equal to
<var>i</var>&nbsp;/&nbsp;10<sup><var>n</var></sup> for some integers
<var>i</var> and <var>n</var>,
with <var>n</var> &ge; <var>m</var>.
</p>

<p>
The term <term>minScale</term> is chosen to reflect the fact that it
restricts the <termref def="dt-value-space"/> to those values that can
be represented lexically in exponential form using an integer
coefficient and a scale (negative exponent)
at least as large as <emph role="eq">minScale</emph>. Note that
it does not restrict the <termref def="dt-lexical-space"/> directly; a
lexical representation that adds additional leading zero digits,
or that uses a larger exponent (and a correspondingly smaller coefficient) 
is still permitted.
</p>

<note role="example">
<p>
The following is the definition of a user-defined
datatype which could be used to represent amounts in a decimal
currency; it corresponds to a SQL column definition of
<code>DECIMAL(8,2)</code>.   The effect is to allow values
between -999,999.99 and 999,999.99, with a fixed interval
of 0.01 between values.
</p>
<eg><![CDATA[<simpleType name='price'>
  <restriction base=']]>&pD;<![CDATA['>
    <totalDigits value='8'/>
    <minScale value='2'/>
    <maxScale value='2'/>
  </restriction>
</simpleType>
]]></eg>
</note>

<div4 role="1.0" id="dc-minScale">
<head>The minScale Schema Component</head>
<compdef name="minScale" abbrev="f-mns"/>

<p>
If <propref comp="f-mns" prop="fixed"/> is <pt>true</pt>, then types for which
the current type is the <propref comp="std" prop="base type definition"/> 
&must; not specify a
value for <compref ref="f-mns"/> other than
<propref comp="f-mns" prop="value"/>.
</p>
</div4>

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

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

<reprdef>
<reprelt eltname="minScale"/>
<reprcomp abstract="minScale" ref="dc-minScale">
<propmap comp="f-mns" prop="value">
The &v-value; of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-mns" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>
<propmap comp="f-mns" prop="annotations">
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="minScale-validation-rules">
<head>minScale Validation Rules</head>
<constraintnote type="cvc" id="cvc-minScale-valid">
<head>minScale Valid</head>
<p>
A <dtref ref="&pD;"/> value <var>v</var> is facet-valid with
respect to <compref ref="f-mns"/> 
if and only if one of the following is true:
</p>
<olist>
<item>
<p>
<var>v</var> has <vpropref ref="vp-pd-precision"/>
greater than or equal to  
the <propref comp="f-td" prop="value"/>
of <compref ref="f-mns"/>.
</p>
</item>
<item>
<p>The <vpropref ref="vp-pd-precision"/> of <var>v</var>
is <pt>absent</pt>.</p>
</item>
</olist>
</constraintnote>
</div4>

<div4 role="1.0" id="minScale-coss">
<head>Constraints on minScale Schema Components</head>
<constraintnote type="cos" id="minScale-totalDigits">
<head>minScale less than or equal to maxScale</head>
<p>
It is an <termref def="dt-error"/> for <compref ref="f-mns"/> to
be greater than <compref ref="f-ms"/>.
</p>
</constraintnote>

<p>Note that it is <emph>not</emph> an error for <compref ref="f-mns"/> to
be greater than <compref ref="f-td"/>.</p>

<constraintnote type="cos" id="minScale-valid-restriction">
<head>minScale valid restriction</head>
<p>
It is an <termref def="dt-error"/> if <compref ref="f-mns"/> 
is among the members of <propref comp="std" prop="facets"/> of
<propref comp="std" prop="base type definition"/> and
<propref comp="f-mns" prop="value"/> is less than the <propref comp="f-mns" prop="value"/> of that <compref ref="f-mns"/>.
</p>
</constraintnote>
</div4>
</div3>

<!--* MSM is confused by the existence of what look like two
different sections for the constraining facet 'lexicalMappings'. *-->
<div3 id="rf-lexicalMappings" diff="add" dg="pd1">
<head>lexicalMappings</head>

<note>
<p>The <compref ref="f-lm"/> facet is new; like the datatype <dtref ref="&pD;"/>, it has been added in version 1.1 of this specification.
The XML Schema Working Group is interested in feedback from users,
schema authors, and software developers on whether it is useful and
should be retained, or not.</p>
<p>It has been suggested that the <compref ref="f-lm"/> facet be
made applicable also to other numeric types (<dtref ref="decimal"/>,
<dtref ref="float"/>, <dtref ref="double"/>, and datatypes derived
from them); the Working Group is also interested in hearing the
community's views on this question.</p>
</note>

<p><termdef id="dt-lexicalMappings" term="lexicalMappings">The <term>lexicalMappings</term> facet
restricts the <termref def="dt-lexical-mapping"></termref> of <dtref ref="&pD;"/> datatypes in a controlled way.</termdef> When the lexical
space is constrained using <compref ref="f-p"/> facets, it is possible
to produce datatypes for which some values have no canonical lexical
representations in the lexical space; when the
<term>lexicalMappings</term> facet is used, the 
<termref def="dt-canonical-mapping"/> is automatically adjusted
appropriately.</p>
<!--* suppressed the bit about optimization, not something
    * we need to talk about.  Smart implementors will known,
    * stupid ones won't be helped. *-->

<p>
The <termref def="dt-lexicalMappings"/> facet does not restrict the
<termref def="dt-value-space"/> directly; but if 
<pt>scientific</pt> is not among the <dtref ref="constant"/>s in the
value, then the <termref def="dt-value-space"/> may be diminished. For
example, some <dtref ref="&pD;"/> values have <termref def="dt-lexical-representation">lexical representations</termref> only
in scientific notation. If <pt>nodecimal</pt> is the only <dtref ref="constant"/> present
then only &integer; values with a <vpropref ref="vp-pd-precision"/> 
of zero have <termref def="dt-lexical-representation">lexical 
representations</termref> and
are hence in the <termref def="dt-value-space"></termref>.
</p>

<p>
A <dtref ref="&pD;"/> value <var>v</var> can be serialized
successfully for a datatype constrained by <compref ref="f-lm"/> 
if any of the following are true:</p>
<ulist>
<item>
<p><pt>scientific</pt> is a member of <propref comp="f-lm" prop="value"/>, or</p></item>
<item><p><pt>decimal</pt> is a member of
<propref comp="f-lm" prop="value"/> and <var>v</var>&apos;s 
<pfref ref="vp-pd-precision"/> is not less than zero, or
</p>
</item><item><p><var>v</var>&apos;s <pfref ref="vp-pd-precision"/> 
is equal to zero or is <pt>absent</pt>.</p>
</item>
</ulist>

<!--<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=']]>&pD;<![CDATA['>
    <totalDigits value='4'/>
    <lexicalMapping value='1'/>
    <minInclusive value='36.4'/>
    <maxInclusive value='40.5'/>
  </restriction>
</simpleType>
]]></eg>
</note>-->

<div4 role="1.0" id="dc-lexicalMappings">
<head>The lexicalMappings Schema Component</head>
<compdef name="lexicalMappings" abbrev="f-lm"/>

<p><propref comp="f-lm" prop="value"/> controls the usability of the
three partial <termref def="dt-lexical-mapping">lexical
mappings</termref>, <pfref ref="f-noDecVal"/> , <pfref ref="f-decVal"/>, and <pfref ref="f-sciVal"/>, by restricting
the <termref def="dt-lexical-space"></termref>.</p>
<p>If <propref comp="f-lm" prop="fixed"/> is <pt>true</pt>, then types
for which the current type is the 
<propref comp="std" prop="base type definition"/> 
&must; not specify a value for <compref ref="f-lm"/>
other than <propref comp="f-lm" prop="value"/>.
</p>
</div4>

<div4 id="xr-lexicalMappings">
<head>XML Representation of lexicalMappings Schema Components</head>

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

<reprdef>
<reprelt eltname="lexicalMappings"/>
<reprcomp abstract="lexicalMappings" ref="dc-lexicalMappings">
<propmap comp="f-lm" prop="value">
The set of <dtref ref="constant"/>s named in the list which is the <xtermref href="&xsdl;#key-vv">actual value</xtermref> of the <code>value</code> &i-attribute;
</propmap>
<propmap comp="f-lm" prop="fixed">
The &v-value; of the <code>fixed</code> &i-attribute;, if present, otherwise <pt>false</pt>
</propmap>

<propmap comp="f-lm" prop="annotations">
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="lexicalMapping-validation-rules">
<head>lexicalMappings Validation Rules</head>
<constraintnote type="cvc" id="cvc-lexicalMapping-representation-valid">
<head>Lexical Representation Valid against lexicalMappings facet
</head>

<p>A <termref def="dt-lexical-representation"/> <var>L</var> is
facet-valid
with respect to <compref ref="f-lm"/> if
<phrase diff="add" dg="iff">and only if</phrase>
any one of 
the following is true:
<!--* msm wonders whether this ought not perhaps to be tagged
    * olist role="or"
    * but decides to leave it for now
    *-->
<ulist>
<item>
<p><pt>nodecimal</pt> is a member of <propref comp="f-lm" prop="value"/> and <var>L</var> is a <nt def="nt-noDecNuml"/>,
or</p></item>
<item>
<p><pt>decimal</pt> is a member of <propref comp="f-lm" prop="value"/>
and <var>L</var> is a <nt def="nt-decNuml"/>, or</p></item>
<item>
<p><pt>scientific</pt> is a member of <propref comp="f-lm" prop="value"/> and <var>L</var> is a <nt def="nt-sciNuml"/>,
or</p></item>
<item>
<p> <var>L</var> is a <nt def="nt-numSpecReps"/>.</p></item>
</ulist></p>
</constraintnote>
</div4>

<div4 role="1.0" id="lexicalMapping-coss">
<head>Constraints on lexicalMappings Schema Components</head>

<!--* 
<constraintnote type="cos" id="lexicalMapping-fixed-restriction">
<head>lexicalMappings fixed restriction</head>
<p>It is an <termref def="dt-error"/> if the 
<propref comp="f-mfd" prop="fixed"/> of
<propref comp="std" prop="base type definition"/>&apos;s 
<compref ref="f-mfd"/> is <pt>true</pt> and 
<propref comp="f-mfd" prop="value"/> is <pt>false</pt>.</p>
</constraintnote>
*-->

<constraintnote type="cos" id="lexicalMapping-valid-restriction">
<head>lexicalMappings valid restriction</head>
<p>
It is an <termref def="dt-error"/> if
<propref comp="f-lm" prop="value"/> is not a subset 
of the <propref comp="f-lm" prop="value"/> of the 
<compref ref="f-lm"/> among the
<propref comp="std" prop="facets"/> of the
<propref comp="std" prop="base type definition"/>.
</p>
</constraintnote>
</div4>

<div4 id="lexicalMapping-sci">
<head>lexicalMappings Schema Component Inheritance</head>

<!--* <ednote><edtext>The following Note should read
".&nbsp;.&nbsp;.&nbsp;the <compref ref="f-lm"/> <emph>is the same
as</emph> the parent&apos;s
<compref ref="f-lm"/>", if that's the way identity of components
resolves.</edtext></ednote> *-->
<p>If during a <termref def="dt-derived">derivation</termref> a new
<compref ref="f-lm"/> is not prescribed, the new<compref ref="std"/>&apos;s  <compref ref="f-lm"/> has the same property values
as the parent&apos;s
<compref ref="f-lm"/>.&nbsp; In any case, there is exactly one
<compref ref="f-lm"/> facet in the 
<propref comp="std" prop="facets"/> set
of each <compref ref="std"/> <termref def="dt-derived"/> 
from <dtref ref="&pD;"/>.</p>

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

<div2 id="derivationHierarchy" diff="add" dg="dpno">
<head>Derivation and the Derivation Hierarchy</head>

<!--* <ednote><edtext>Definition of "derived", etc.&nbsp; Similiar to 2.5.1 and 2.5.2 in
my draft from yesterday.</edtext></ednote> *-->

<p><emph>Derivation</emph> is a simple concept.&nbsp;
<termdef id="dt-immediately-derived_55" term="immediately derived">A <compref ref="std"/>
is <term>immediately derived</term> from another if its <propref comp="std" prop="baseType"/>
is the other.</termdef>&nbsp; <termdef id="dt-derived_55" term="derived">A <compref ref="std"/>
is <term>derived</term> from another if it is <termref def="dt-immediately-derived"></termref>
from the other or (recursively) <termref def="dt-derived"></termref> from a third
<compref ref="std"/> that is itself <termref def="dt-immediately-derived"></termref>
from the other.</termdef></p>

<p>The constraints on the various facets and the explicit descriptions of
<termref def="dt-immediately-derived">immediate derivations</termref> for
the <compref ref="std"/>s defined in this specification insure that
<termref def="dt-derived">derivation</termref> puts the <compref ref="std"/>s
in a tree-structured hierarchy.&nbsp; This in turn induces a matching hierarchy
on the datatypes selected/defined by <compref ref="std"/>s.&nbsp; (A <emph>datatype</emph>
is derived from another if its corresponding <compref ref="std"/> is derived
from that of the other.)</p>

<p>The <compref ref="std"/> hierarchy is a subtree of the
<phrase role="UNSURE">type hierarchy</phrase> of Simple and Complex Types described
in <phrase role="UNSURE">Part 1 of this specification</phrase>.&nbsp; In the context
of that larger hierarchy, all derivations of <compref ref="std"/>s are <unusual>by
restriction</unusual>.</p>

<div3 id="structureListsAndUnions">
<head alt="Various Kinds of Simple Type Definitions">Various Kinds of <compref ref="std"/>s</head>

<p><termdef id="dt-built-in_55" term="built-in">The <term>built-in</term> <compref ref="std"/>s 
are those defined in
<!--* <specref ref="builtinSTDs"/>, *-->
<specref ref="built-in-datatypes"/>, 
and are a priori in every schema; they form the base of
the <compref ref="std"/> hierarchy.</termdef>&nbsp; There are three
kinds of <termref def="dt-built-in"></termref> <compref ref="std"/>s (and
their corresponding datatypes):
<ulist>
<item>
<p><termdef id="dt-special" term="special"><dtref role="def" ref="anySimpleType"/> and
<dtref role="def" ref="anyAtomicType"/> are the two <term>special</term>
<compref ref="std"/>s; all others, whether <termref def="dt-built-in"></termref> or
not, are <term>ordinary</term>.</termdef>&nbsp;
The <propref comp="std" prop="variety"/> of <term>special</term>
<compref ref="std"/>s is <pt>absent</pt>.</p></item>
<item>
<p><termdef term="primitive" id="dt-primitive_55"><compref ref="std"/>s
<termref def="dt-immediately-derived"></termref> from the
<dtref ref="anyAtomicType" role="def"/> are <term>primitive</term>.</termdef></p></item>
<item>
<p><termdef term="other built-in" id="dt-other-built-in"><term>Other built-in</term>
<compref ref="std"/>s are those which could have been introduced into schemas by
users (with a different <propref comp="std" prop="target namespace"/>), but are
cosidered sufficiently useful that they are made <termref def="dt-built-in"></termref>
to insure their availability everywhere with common names.</termdef></p></item>
</ulist>
</p>

<p><termdef id="dt-user-defined" term="user-defined"><term>User-defined</term>
<compref ref="std"/>s (over and above the <termref def="dt-built-in"></termref>
<compref ref="std"/>s) may be added to the hierarchy in any schema.</termdef>&nbsp;
They may be added in three ways:
<ulist>
<item>
<p><termdef term="list construction" id="dt-list-construction"><term>List
construction</term>.&nbsp; The result is a <compref ref="std"/> whose
<propref comp="std" prop="base type definition"/>  is <dtref ref="anySimpleType" role="def"/>
and whose <propref comp="std" prop="variety"/> is <pt>list</pt>.</termdef></p></item>
<item>
<p><termdef term="union construction" id="dt-union-construction"><term>Union
construction</term>.&nbsp; The result is a <compref ref="std"/> whose
<propref comp="std" prop="base type definition"/>  is <dtref ref="anySimpleType" role="def"/>
and whose <propref comp="std" prop="variety"/> is <pt>union</pt>.</termdef></p></item><item>
<p><termdef term="direct derivation" id="dt-direct-derivation"><term>Direct
derivation</term>.&nbsp; The result is a <compref ref="std"/> whose
<propref comp="std" prop="base type definition"/> is a  <compref ref="std"/> and
whose <propref comp="std" prop="variety"/> is the same as that of its
<propref comp="std" prop="base type definition"/>.</termdef>&nbsp; All
<termref def="dt-direct-derivation">directly derived</termref>
<compref ref="std"/>s have <termref def="dt-value-space">value
spaces</termref> and <termref def="dt-lexical-space">lexical
spaces</termref> that are subsets of those of their
<propref comp="std" prop="base type definition"/>s.&nbsp; All
<compref ref="std"/>s not <termref def="dt-immediately-derived"></termref>
from the <dtref ref="anySimpleType" role="def"/> or the
<dtref ref="anyAtomicType" role="def"/>are <termref def="dt-direct-derivation">directly
derived</termref> from their <propref comp="std" prop="base type definition"/>s.</p></item>
</ulist>
</p>

<p><termref def="dt-special">Ordinary</termref> <compref ref="std"/>s and their
associated datatypes are <emph>atomic</emph>, <emph>list</emph>, or <emph>union</emph>.
<ulist>
<item>
<p><termdef id="dt-atomic_55" term="atomic"><term>Atomic</term> <compref ref="std"/>s are
those derived from the <dtref role="def" ref="anyAtomicType"/>; their
<propref comp="std" prop="variety"/> is <pt>atomic</pt> and their
<propref comp="std" prop="primitive type definition"/> is not <pt>absent</pt>.&nbsp;
</termdef></p></item>
<item>
<p><termdef id="dt-list_55" term="list"><term>List</term> <compref ref="std"/>s
are those whose <propref comp="std" prop="variety"/> is <pt>list</pt>; they
are <termref def="dt-derived"></termref> from the <dtref role="def" ref="anySimpleType"/>
and their <propref comp="std" prop="item type definition"/> is not <pt>absent</pt>.</termdef></p></item>
<item>
<p><termdef id="dt-union_55" term="union"><term>Union</term> <compref ref="std"/>s
are those whose <propref comp="std" prop="variety"/> is <pt>union</pt>; they
are derived from the <dtref role="def" ref="anySimpleType"/> and their
<propref comp="std" prop="member type definitions"/> is not <pt>absent</pt>.</termdef></p></item>
</ulist>
</p>

<p>In each of the above, <propref comp="std" prop="primitive type definition"/>,
<propref comp="std" prop="item type definition"/>, and
<propref comp="std" prop="member type definitions"/> are <pt>absent</pt>
unless otherwise specified.</p>


</div3><div3 id="structureOfDatatypes">
<head alt="The Structure of Ordinary Datatypes">The Structure of
<termref def="dt-special">Ordinary</termref> Datatypes</head>

<p>The most basic datatypes are <termref def="dt-atomic"></termref>.&nbsp; These
begin with the <termref def="dt-primitive"></termref> datatypes.&nbsp; Their
<termref def="dt-value-space">value spaces</termref> are all disjoint
(at least for schema processing purposes) and are defined in this
specification.&nbsp; From these are <termref def="dt-derived"></termref>
all of the other <termref def="dt-atomic"></termref> datatypes.&nbsp; (Note that
<dtref ref="anyAtomicType" role="def"/> is not itself <termref def="dt-atomic"></termref>.)</p>

<p>Each <termref def="dt-list"></termref> datatype has a
<termref def="dt-value-space"></termref> consisting of sequences
(lists) of values from an <dtref ref="dt-atomic"/> datatype (the
<unusual>item type</unusual>); <termref def="dt-lexical-representation">lexical
representations</termref> are space-separated representations of values
from the item type.&nbsp; These begin with
<termref def="dt-list-construction">explicitly constructed
lists</termref> (which are <termref def="dt-immediately-derived"></termref>
from <dtref ref="anySimpleType" role="def"/>).&nbsp; From these are
<termref def="dt-derived"></termref> all of the other
<termref def="dt-list"></termref> datatypes.

<note>
<p>Only values from the item type which have
<termref def="dt-lexical-representation">lexical
representations</termref> without internal whitespace
can be in the lists of values, since otherwise the sequence
of values in which they might occur would have no
<termref def="dt-lexical-representation"></termref>.</p>
</note>

Similarly, each <termref def="dt-union"></termref> datatype
has a <termref def="dt-value-space"></termref> consisting of
values from any and all of a sequence of <dtref ref="dt-atomic"/>
datatypes (the <unusual>member types</unusual>).&nbsp; These begin
with <termref def="dt-union-construction">explicitly constructed
unions</termref> (which are <termref def="dt-immediately-derived"></termref>
from <dtref ref="anySimpleType" role="def"/>).&nbsp; From these
are <termref def="dt-derived"></termref> all of the other
<termref def="dt-list"></termref> datatypes.

<note>
<p>&String;s that are <termref def="dt-lexical-representation">lexical
representations</termref> of values from more than one member type are
mapped to the represented value from the first such datatype in the
sequence of member types.&nbsp; Other values whose 
<termref def="dt-lexical-representation">lexical representations</termref>
are all intercepted in this way can only be represented
in elements by using an <att>xsi:type</att> attribute.</p>
</note>
</p>
</div3>

<div3 id="shapeOfHierarchy">
<head>The Shape of the Hierarchy</head>

<p><?xm-replace_text {p}?></p>


</div3>
</div2>

   <div2 id="Auxiliary_Components" diff="add" dg="ep01">
    <head>Auxiliary Components</head>
    <!--* <ednote>
     <edtext>These abstract components and micro-components have been added to assist
in organising the preceding material.   The will probably move elsewhere in
a subsequent working draft.&emsp;&mdash;HT</edtext>
    </ednote> *-->
    <compdef name="Component" abbrev="c"/>
    <compdef name="Annotated Component" abbrev="ac"/>
    <compdef name="Facet" abbrev="f"/>
    <compdef name="Fundamental Facet" abbrev="ff"/>
    <compdef name="Type Definition" abbrev="td"/>
    <compdef name="Annotation" abbrev="a"/>
    <microCompdef name="Scope" abbrev="sc"/>
   </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" dg="fpwd"><head>Temporary Stuff (to be added elsewhere)</head>

<!--* <ednote><edtext>This section is a holding area for text snippets that
the editors don't want to lose, or that have targets of
crossreferences that are needed.  In any case, the material in this
section will move at some point to a more appropriate place in the
text, or will be replaced by other more appropriate text
elsewhere.</edtext></ednote> *-->

<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>).&nbsp;
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><phrase diff="del" dg="fa1"><termdef id="del_fa1-dt-derived" term="derived"><term>Derived</term>
datatypes are those that are
defined in terms of other datatypes.</termdef></phrase><phrase diff="add" dg="fa1"><termdef id="dt-derived" term="derived"><term>Derived</term>
datatypes are <termref def="dt-constructed"/> and
<termref def="dt-atomic"></termref>.</termdef></phrase></p>

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

<div1 id="constructedValueSpaces" diff="add" dg="cvs1_pwd">
<head diff="add" dg="cvs1">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 diff="add" dg="cvs1">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 diff="add" dg="cvs1">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 diff="add" dg="cvs1">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" diff="add" dg="num1"><head>Numerical Values</head>
<p diff="add" dg="num1">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 diff="add" dg="num1"><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>

<!--* the following text was colore as 'added' in the first public WD;
    * it was removed by the WG in January 2005 in Brisbane *-->
<div3 id="sec-precision" diff="add" dg="fpwd-rescinded-add"><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 diff="add" dg="numap1"><head>Exact Lexical Mappings</head>

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

</div2>

<div2 id="d-t-values"><head diff="add" dg="dt1">Date/time Values</head>

<issue id="RQ-122i" role="1.1" diff="del" dg="dt3">
<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 diff="add" dg="dt1">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>

<p diff="add" dg="dt2">All of the value spaces for dates and times
described here represent moments or periods of time in Universal
Coordinated Time (UTC).&nbsp;
<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></p>

<p diff="add" dg="dt2"><termdef id="dt-leapsec" term="leap-second">A
<term>leap-second</term> is an additional second added
to the last day of December, June, October, or March,
when such an adjustment is deemed necessary by the 
International Earth Rotation and Reference Systems Service
in order to keep <termref def="dt-utc"/> within 0.9 seconds
of observed astronomical time.&nbsp; When leap seconds are
introduced, the last minute in the day has more than
sixty seconds.&nbsp;
In theory leap seconds can also be removed from a
day, but this has not yet occurred.</termdef></p>

<!--*
    * There are a number of references to dayYM elsewhere in
    * the spec, but they are all deleted by either dt3 or dt4.
    * So for now I'm leaving this out.  It's not clear how to
    * make the diffed versions be free of broken links ...

    * To make the best of a bad job, I propose to include this,
    * marked as a deletion, only in the diff against 1.0 and
    * the diff against the July 2004 WD.

<div3 id="dayYM-bis" diff="add" dg="dt4"><head>Table of Gregorian Months</head>
<p>Some of the date-related functions given below appeal to 
knowledge of the number of the days in each month in the Gregorian
calendar.  Each year has 12 months, numbered 1 through
12, and each month 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>
</div3> *-->

<div3 id="dTReal" diff="add" dg="dtr">
<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 <phrase diff="del" dg="wdd">begins
and ends</phrase><phrase diff="add" dg="wdd"><unusual>centers</unusual>
(i.e., its noon is)</phrase> 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>)
<phrase diff="del" dg="wdd"><emph>at 0 degrees longitude</emph></phrase><phrase diff="add" dg="wdd"><emph>locally</emph></phrase>.</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>&nbsp; The time counts that
Schema has chosen to represent are based on <termref def="dt-utc"></termref>:&nbsp; <termdef term="UTC" id="add_dtr-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-bis" 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></ednote-->
<!--* ed. answer: yes, we do *-->
</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" diff="add" dg="dt1">
<head>The Seven-property Model</head>

<p>There are two distinct ways to model moments in time:&nbsp; 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
<phrase diff="del" dg="dt3"><termref def="dt-utc"></termref>, so having
the timezone makes it possible to calculate the corresponding
<phrase diff="del" dg="wdd"><unusual>raw</unusual></phrase><phrase diff="add" dg="wdd"><unusual>local</unusual></phrase>
values, as they would be reckoned in that timezone</phrase><phrase diff="add" dg="dt3">their
<unusual>local</unusual> values (the values shown in the lexical
representations), rather than converted to 
<termref def="dt-utc"></termref></phrase>.

<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
<phrase diff="del" dg="dt2">28, 29, 30, or </phrase>31 inclusive, 
<phrase diff="add" dg="dt2">possibly
restricted further </phrase>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<phrase diff="del" dg="wdd">,
or 24 if both <pfref ref="vp-dt-minute"/> and <pfref ref="vp-dt-second"/>
are zero</phrase></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
<phrase diff="del" dg="dt2">to 0, less than 60 except 
<phrase diff="del" dg="dtr">when there is a leap-second at the time
described</phrase><phrase diff="add" dg="dtr">as prescribed
in the table of leap-seconds 
in <specref ref="secMinDay"/></phrase></phrase><phrase diff="add" dg="dt2">to
0 and less than <phrase diff="del" dg="dt3">70</phrase><phrase diff="add" dg="dt3">61</phrase>, always subject
to a datatype-dependent leap-second restriction</phrase>; 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"/>
<phrase diff="add" dg="dt2">(unique modulo timezones
plus or minus 12 hours) </phrase>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
<phrase diff="del" dg="dt2">that
value for </phrase><pfref ref="vp-dt-hour"/> and
<pfref ref="vp-dt-minute"/><phrase diff="add" dg="dt2">
from being <pt>absent</pt></phrase>.)</p>
</note>

<p diff="add" dg="dt2">As of the time this specification was published,
leap-seconds (always one leap-second) have been introduced
by the responsible authorities at the end (in <termref def="dt-utc"/>) 
of the following days:
<ulist>
<item><p>1972-06-30</p></item>
<item><p>1972-12-31</p></item>
<item><p>1973-12-31</p></item>
<item><p>1974-12-31</p></item>
<item><p>1975-12-31</p></item>
<item><p>1976-12-31</p></item>
<item><p>1977-12-31</p></item>
<item><p>1978-12-31</p></item>
<item><p>1989-12-31</p></item>
<item><p>1981-06-30</p></item>
<item><p>1982-06-30</p></item>
<item><p>1983-06-30</p></item>
<item><p>1985-06-30</p></item>
<item><p>1987-12-31</p></item>
<item><p>1989-12-31</p></item>
<item><p>1990-12-31</p></item>
<item><p>1992-06-30</p></item>
<item><p>1993-06-30</p></item>
<item><p>1994-06-30</p></item>
<item><p>1995-12-31</p></item>
<item><p>1997-06-30</p></item>
<item><p>1998-12-31</p></item>
</ulist>
</p>

<p diff="del" dg="dt2"><phrase role="UNSURE">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.</phrase>
</p>

<p diff="add" dg="dt2">While calculating, property values from the
<dtref ref="dateTime"/> 1972-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; 1972-12-31T00:00:00
happens to permit both the maximum number
of days and the maximum number of seconds.</p>

<p>
<defsetsum ref="defs-dt-ToTl"/>
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.</p>

</div3>

<div3 diff="add" dg="dt1" id="rf-lexicalMappings-datetime">
<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>?
((<charclass>1-9</charclass>&nbsp;<nt def="nt-digit"/>&nbsp;<nt def="nt-digit"/>&nbsp;<nt def="nt-digit"/>+))&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;|
(<string>1</string>&nbsp;<phrase diff="del" dg="dt4"><charclass>01</charclass></phrase><phrase diff="add" dg="dt4"><charclass>0-2</charclass></phrase>)</rhs>
</prod>
<prod id="nt-daFrag"><lhs>dayFrag</lhs>
<rhs>(<phrase diff="del" dg="dt4"><charclass>0-2</charclass></phrase><phrase diff="add" dg="dt4">0&nbsp;<charclass>1-9</charclass>)&nbsp;|&nbsp;(<charclass>12</charclass></phrase>&nbsp;<nt def="nt-digit"/>)&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;|
(<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><phrase diff="del" dg="dt3"><charclass>0-6</charclass></phrase><phrase diff="add" dg="dt3">(<charclass>0-5</charclass></phrase>&nbsp;<nt def="nt-digit"/><phrase diff="add" dg="dt3">)&nbsp;|
<string>60</string></phrase> (<string>.</string>&nbsp;<nt def="nt-digit"/>+)?</rhs>
</prod>
<prod id="nt-eodFrag"><lhs>endOfDayFrag</lhs>
<rhs><string>24:00:00</string>&nbsp;(<string>.</string>&nbsp;<string>0</string>+)?</rhs>
</prod>
<prod id="nt-tzFrag"><lhs>timezoneFrag</lhs>
<rhs><string>Z</string>&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>

<p>Each fragment other than <nt def="nt-tzFrag"/> defines a subset of the 
<termref def="dt-lexical-space"></termref> of <dtref ref="&pD;"/>; 
the corresponding <termref def="dt-lexical-mapping"></termref> is the 
<dtref ref="&pD;"/> <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.&nbsp; 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>

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

<p diff="add" dg="funbase">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" dg="nu1"><head>Generic Number-related Functions</head>

<p>The following functions are used with various numeric and date/time datatypes.
</p>
<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><phrase diff="add" dg="wdd">a &decimal;</phrase></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"/>.</sum