<?xml version='1.0'?>
<!-- Id: datatypes.xml,v 1.7.2.276 2006/01/11 21:22:06 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 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>'>

<!ENTITY sp " ">
<!ENTITY fb-restriction.xr '<termref diff="del" dg="rq120" def="dt-restriction"/><termref diff="add" dg="rq120" def="dt-fb-restriction"/>'>
<!ENTITY atomic_datatype.x '<phrase diff="del" dg="rq120">atomic type</phrase><phrase diff="add" dg="rq120"><termref def="dt-atomic"/> datatype</phrase>'>
<!ENTITY atomic_datatypes.x '<phrase diff="del" dg="rq120">atomic types</phrase><phrase diff="add" dg="rq120"><termref def="dt-atomic"/> datatypes</phrase>'>
<!ENTITY constructed.x '<termref diff="del" dg="rq120" def="dt-derived"/><termref diff="add" dg="rq120" def="dt-constructed"/>'>
<!ENTITY user-defined.x '<termref diff="del" dg="rq120" def="dt-user-derived"/><termref diff="add" dg="rq120" def="dt-user-defined"/>'>
<!ENTITY ordinary.np '<termref diff="add" dg="rq120c" def="dt-onp"/><termref diff="add" dg="rq120o" def="dt-ordinary"/>'>
<!ENTITY ordinary.d.onp '<termref diff="del" dg="rq120" def="dt-derived"/><termref diff="add" dg="rq120c" def="dt-onp"/><termref diff="add" dg="rq120o" def="dt-ordinary"/>'
>

<!--* entities to make it easier to deal with some rec12-map changes *-->
<!ENTITY absent.pt.x '<phrase diff="del" dg="rec12-map"><pt>absent</pt></phrase
><phrase diff="add" dg="rec12-map"><xtermref href="&xsdl;#key-null">absent</xtermref></phrase>' >

<!ENTITY resolved..x '<phrase diff="del" dg="rec12-map">resolved</phrase
><phrase diff="add" dg="rec12-map"><xtermref href="&xsdl;#src-resolve">resolved</xtermref
></phrase>' >

<!--* new text of nV_limit *-->
<!ENTITY nV_limit "<var>c</var>&nbsp;&times;&nbsp;2<sup><var>e</var></sup>&nbsp;&minus;&nbsp;2<sup>(<var>e</var>&minus;1)</sup>" >
<!--* old text of nV_limit *-->
<!ENTITY nV_limit "<var>c</var>&nbsp;&times;&nbsp;(2<sup><var>e</var></sup>&nbsp;&minus;&nbsp;2<sup><var>e</var>&minus;2</sup>)" >

]>
<spec w3c-doctype="wd" status="final" role="TR-copy">
<header>
<title>XML Schema 1.1 Part 2: Datatypes</title>
<w3c-designation>wd-20060116</w3c-designation>
<!--* <w3c-doctype>W3C Working Draft</w3c-doctype> *-->
<!--* <w3c-doctype>Editors' Draft</w3c-doctype> *-->
<w3c-doctype>W3C Working Draft</w3c-doctype>
<pubdate>
<day>16</day>
<month>January</month>
<year>2006<!--* Id: datatypes.xml,v 1.7.2.276 2006/01/11 21:22:06 cmsmcq Exp  *--></year>
</pubdate>
<publoc> 
<loc href="http://www.w3.org/TR/2006/WD-xmlschema11-2-20060116/">http://www.w3.org/TR/2006/WD-xmlschema11-2-20060116/</loc> 
</publoc>
<altlocs>
<loc href="http://www.w3.org/TR/2006/WD-xmlschema11-2-20060116/datatypes.xml">XML</loc>
<!--* 
<loc href="http://www.w3.org/TR/2006/WD-xmlschema11-2-20060116/datatypes.diff-1.0.html">XHTML with changes since version 1.0 marked</loc>
<loc href="http://www.w3.org/TR/2006/WD-xmlschema11-2-20060116/datatypes.diff-wd.html">XHTML with changes since previous Working Draft marked</loc>
*-->
<loc href="http://www.w3.org/TR/2006/WD-xmlschema11-2-20060116/datatypes.diff-1.0.html">XHTML with changes since version 1.0 marked</loc>
<loc href="http://www.w3.org/TR/2006/WD-xmlschema11-2-20060116/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" diff="del" dg="dup-2214">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/2005/WD-xmlschema11-2-20050224/">http://www.w3.org/TR/2005/WD-xmlschema11-2-20050224/</loc>
<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 
<phrase diff="add" dg="wg-internal">
member-only review version which will in due course become a
</phrase>
Public Working Draft of XML Schema 1.1.  It 
<phrase diff="add" dg="wg-internal">has no formal standing within W3C; it</phrase>
is here made
available for review by W3C members<phrase diff="del" dg="wg-internal"> 
and the public</phrase>.  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.
<phrase diff="add" dg="wg-internal">
This draft was created on 16 January 2006.
It reflects (unless otherwise noted elsewhere) all decisions
on this document made by the Working Group 
through 6 January 2006.
</phrase>
</p>  

<!--* Paragraphs specific to individual editorial proposals go here.
    * They should be deleted after the proposal is acted on, but
    * do please keep one here, for use as a template.

<p diff="add" dg="rec12-main">It also includes an editorial proposal
for reconciliation of the treatment of the special simple types
(anySimpleType and anyAtomicType) between Datatypes and Structures.</p>

*-->
 
<p diff="add" dg="telltale">It also includes the following proposals
for changes to the wording of the spec:
<ulist>
<item diff="add" dg="rec12-map-eff-pentimenti">
<p>An editorial proposal proposal to correct some slips in the resolution of 
issue <strong>2435</strong> and change the wording of the
XML mapping rules for {item type definition} and
{member type definitions}.</p>
</item>
<item diff="add" dg="sfs-1933">
<p>A proposal to resolve issue <strong>1933</strong> by
moving the source declarations for the built-in datatypes
from the normative schema for schema documents into informative 
appendices.</p>
</item>
<item diff="add" dg="b2044"><p>A phase-2 wording proposal
to discharge issue <strong>2044</strong> (loss of facet restrictions
when a restricted union is named as a member of another union), 
by allowing unions to be members of other unions.
Descriptions of union types have been changed to reflect
the fact that unions can be derived by restricting other unions.
The concepts of <term>transitive membership</term> (the 
members of all members, recursively) and <term>basic member</term>
(those datatypes in the transitive membership which are
not unions) are introduced and used.
</p>
</item>
<item diff="add" dg="rq21-specials-1909"><p>A phase-2 wording proposal
to discharge <strong>RQ-21</strong> for the two special types 
<dtref ref="anySimpleType"/> 
and <dtref ref="anyAtomicType"/> 
by providing
an explicit account of their lexical spaces and lexical and canonical mappings.
N.B. The treatment of their lexical spaces should follow the 
WG decision on <dtref ref="string"/>.
</p>
</item>
<item diff="add" dg="ep01"><p>A revision of editorial proposal
<strong>EP-01</strong>, clarifying the treatment of complex
property values and component classes, modified in the light of
WG discussion. (This draft has been reformatted
so as to use the most recent version of the stylesheets.)
</p>
</item>
<item diff="add" dg="rec12-main-excepted"><p>An editorial proposal (rec12-main)
to discharge part of <strong>RQ-141b</strong> by
reconciliation of the treatment of the special simple types
(anySimpleType and anyAtomicType) between Datatypes and Structures.
Some proposals on this topic have already been accepted.
In this draft, the changes marked are those which still require
WG action:  changes not agreed to by the
WG in Edinburgh, and their amendments.
</p>
</item>
<!--* 
<item diff="add" dg="lexMapFacet-1912"><p>A phase-2 wording proposal
to discharge issue 
<strong><loc href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=1912">1912</loc></strong>
(RQ-31e), which requires that the <code>lexicalMappings</code>
facet introduced when <dtref ref="precisionDecimal"/> was added
be removed again.</p></item>
<item diff="add" dg="rec12-map"><p>An editorial proposal (rec12-map)
to discharge part of <strong>RQ-141b</strong> by
reconciliation of the mapping of XML representations to components for
simple type definitions between Datatypes and Structures.
This version of this proposal includes amendments made by the
WG in Edinburgh in September 2005.</p>
</item>
*-->
<!--* <item diff="add" dg="rec12-main"><p>An editorial proposal (rec12-main)
to discharge part of <strong>RQ-141b</strong> by
reconciliation of the treatment of the special simple types
(anySimpleType and anyAtomicType) between Datatypes and Structures.
In this draft, the amendments agreed to by the Working Group in
our meetings of 2, 9, 16, and 26 September 2005 have been integrated
into this proposal.  Changes which were proposed but have
not been approved by the WG have been excluded.  (So the
changes shown here should all be ones approved by the WG.)</p>
</item> *-->
<!--* <item diff="add" dg="rq140-tt"><p>A phase-2 wording proposal
to discharge <strong>RQ-140</strong> by explicitly distinguishing positive and negative
zero in the value space of <dtref ref="float"/> and <dtref ref="double"/>.
The relevant changes are marked [RQ-140].
</p>
</item> *-->
<!--* <item diff="add" dg="rq150c-tt"><p>A phase-2 wording proposal
to discharge RQ-150c by defining minimum required implementation support
for <dtref ref="precisionDecimal"/>; the values proposed are intended
to be those of a decimal64 (64-bit decimal) implementation.
</p>
</item> *-->
<!--* <item diff="add" dg="rq21-string-tt"><p>A phase-2 wording proposal
to discharge <strong>RQ-21</strong> for type <dtref ref="string"/> by providing
an explicit account of its lexical space and lexical and canonical mappings.
N.B. A WG decision is required to confirm the restriction of <dtref ref="string"/>
to strings with characters matching the XML Char production.
The relevant changes are marked [RQ-21 for string].
</p>
</item> *-->
<!--* <item diff="add" dg="rq21-lexmaps-tt"><p>An editorial proposal
incidental to the <strong>RQ-21</strong> proposal for boolean, 
to change the form in which the main text introduces and refers to
the lexical and canonical mappings of each type.
The relevant changes are marked [RQ-21 LM].
</p>
</item> *-->
<!--* <item diff="add" dg="rq21-lit-tt"><p>An editorial proposal
incidental to the <strong>RQ-21</strong> proposal for boolean, 
to define the term &literal; and use it whenever
referring to sequences of characters which may or may not be lexical
representations of values of a given type.
Some of the relevant changes are marked [RQ-21 literals];
most (especially the ubiquitous change from the unmarked string <string>literal</string>
to a term reference) are not so labeled, although they have diff markup.
</p>
</item> *-->
<!--* <item diff="add" dg="rq21-boolean-tt"><p>A phase-2 wording proposal
to discharge <strong>RQ-21</strong> for type <dtref ref="boolean"/> by providing
an explicit account of its lexical space and lexical and canonical mappings
(as amended by the Working Group on 2, 9, and 16 September).
The relevant changes are marked [RQ-21 for boolean].
</p>
</item> *-->
<!--* <item diff="add" dg="rq100-telltale"><p>a phase-2 wording proposal
to discharge, as far as feasible, requirement RQ-100 Canonical form for language.
The proposal makes the following changes:
<ulist diff="add" dg="rq100-telltale">
<item><p>The linkage to the relevant IETF specifications
has been made non-normative and to a Note, and it
refers not only to the current RFC but also to its
successor(s) in the IETF Standards Track.</p>
</item>
<item><p>The Note explicitly states that the semantic requirements
of RFC 3066, including IANA registration, are not part of 
type validity.</p></item>
<item><p>A further Note has been added calling attention to 
the requirement in <bibref ref="RFC3066"/> that language codes
be treated as case-insensitive.</p>
<p>
N.B. As formulated, the requirement calls for us to define
a case-insensitive canonical form for the <dtref ref="language"/> 
datatype.  Since <dtref ref="language"/> is derived from <dtref ref="string"/>,
and inherits a 1:1 mapping from lexical forms to values,
it is not possible to define the desired canonical form
without violence to our spec.  Since 
it is not possible to map <string>MN</string> and <string>mn</string>
to the same value, it is not feasible to assign them the same 
canonical form.  A health warning appears to be the best
we can do.</p>
</item>
</ulist>
</p>
</item> *--><!--
<item diff="add" dg="pattern-1929"><p>A proposal to make the {value}
property of the pattern facet take a set as a value, rather than
a single regular expression.  (This allows {facets} to follow the
rule that there is never more than one facet of the same type.)</p>
</item>
 <item diff="add" dg="context-2337">
  <p>A proposal to remove the {scope} property from Simple Type Definitions in
favour of a simpler {context} property.</p>
 </item>-->
</ulist>
</p>

<!--* 

<p diff="add" dg="flfix-tt">It also includes a proposal to provide a clean
specification of allowable lexical mappings and
more specifically define the value space of <dtref ref="float"/> and
<dtref ref="double"/>, and incidentally correct the boundary values for
<dtref ref="double"/>.&nbsp; Bugzilla 1837 (RQ-21), 1907 (RQ-21 float/double),
and 2206 (R-214).</p>
*-->
<!--* 
 <p diff="add" dg="rec12-tableaux">It also includes an editorial proposal to
systematically present autogenerated information about facets as part of the
definition of each built-in datatype.</p>
*-->
<!--* 
<p diff="add" dg="rq123">It also includes a revision of the editorial proposal
to discharge requirement RQ-123 (the note has been reworked in light
of WG comments).</p>
*-->
<!--* <p diff="add" dg="rq126-telltale">It also includes an editorial proposal
to discharge, as far as feasible, requirement RQ-126, by including
warnings about the possibility of unintentionally restricting away 
canonical forms when restricting datatypes using the 
&pattern.tc; facet.</p> *-->
<!--* <p diff="add" dg="wd25-telltale">It also includes an editorial proposal
to discharge, as far as feasible, pre-last-call issue wd-25 (and
other related issues), which request that the definition of
datatype <dtref ref="anyURI"/> be updated to refer to the current
generation of RFCs.
The proposal makes the following changes:
<ulist diff="add" dg="wd25-telltale">
<item><p>The links to the relevant IETF specifications
are made non-normative; the references are
not only to the current RFC but also to their
successor(s) in the IETF Standards Track.</p>
</item>
<item><p>Notes explicitly state that the syntactic and semantic requirements
of RFC 3986 and 3987 are not part of the datatype as defined here.</p></item>
</ulist></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.  <phrase
diff="del" dg="qd3hax">Accompanying versions of this document display
in color all changes to normative text since version 1.0 and since the
previous Working Draft.</phrase><phrase diff="add" dg="qd3hax">An
accompanying version of this document displays in color all changes to
normative text since version 1.0; another shows changes since the
previous Working Draft.</phrase></p> 

<p>The major changes since the previous Working Draft are:</p>
<ulist>
<item>
<!--* du0_prodigal du0_prodigal2 du0_prodigal2.add.rq21-lexmaps.add
du0_prodigal du0_prodigal.add.rq21-lexmaps.del
du0_prodigal.add.rq21-lexmaps.add wd17.  some duration-related
material which should have been included in earlier drafts, lost by
mistake *--> 
<p>The treatment of the <dtref ref="duration"/> datatype
has been expanded; the description of its value space has been
modified.</p>
</item>
<item><!--* rq120 rq120o *--> 
<p>Definitions have been revised thoroughly and technical terminology
is used more consistently.</p>
</item>
<item><!--* rq20 rq20ep *-->
<p>Simple type definitions have been supplied for <dtref
ref="yearMonthDuration"/> and <dtref ref="dayTimeDuration"/>, the two
totally ordered subtypes of <dtref ref="duration"/>.
</p>
</item>
<item><!--* totl rq122a_sg dudt dudt2 rq122d_sg *--> 
<p>Algorithms for arithmetic involving <dtref ref="dateTime"/> and
<dtref ref="duration"/> values have been provided, and corrections
made to the <pfref ref="vp-dt-timeOnTimeline"/> function.
</p></item>
<item>
<!--* noleap leapseconds *-->
<p>The treatment of leap seconds is no longer implementation-defined:
the date/time types described here do not include leap-second values.
<phrase diff="del" dg="qd3hax">An explicit list of leap seconds to
date is provided.</phrase>
</p>
</item>
<item>
<!--* wd-2 wd-3 wd-4 wd-5 wd-11 wd-19 wd-21 wd26 wd31 *-->
<p>Numerous minor corrections have been made in response
to comments on earlier working drafts.</p>
</item>
<item><!--* rec12-tableaux rec12-main rec12-map-1853 rec12-main-eff-ok
rec12-map rec12-map-eff rec12-main-dub *-->
<p>The treatment of topics handled both in this specification
and in <bibref ref="structural-schemas"/> has been revised to 
align the two specifications more closely.</p>
</item>
<item><!--* rq123 *-->
<p><phrase diff="add" dg="qd3hax">For the date related datatypes, 
t</phrase><phrase diff="del" dg="qd3hax">T</phrase>he 
literal <string>0000</string> is now recognized as designating
the year 1 BCE, in accordance with existing practice.  The literals
<string>-0001</string>, <string>-0002</string> are recognized as
denoting 2 BCE, 3 BCE, etc.</p>
</item>
<item><!--* wd25 *-->
<p>Several references to other specifications have been updated to
refer to current versions of those specifications, including
<bibref ref="XML"/>, <bibref ref="XMLNS"/>,
<bibref ref="RFC3986"/>, 
<bibref ref="RFC3987"/>, and
<bibref ref="RFC3548"/>.
</p>
</item>
<item><!--* rq100 *-->
<p>Requirements for the datatype-validity of
values of type <dtref ref="language"/> have been clarified.</p>
</item>
<item><!--* rq21-boolean" rq21-lit" rq21-lexmaps" *-->
<!--* rq31m.add.rq21-lexmaps.del *-->
<!--* rq31fix.add.rq21-lexmaps.del *-->
<!--* dt3.add.rq21-lexmaps.del *-->
<!--* rq21-string *-->
<!--* rq21-string-tt *-->
<!--* b1902amend *-->
<p>Explicit definitions have been provided for the lexical and
canonical mappings of most (although not yet all) primitive 
datatypes.
</p>

</item>
<item><!--* rq140 *-->
<p>The <dtref ref="float"/> and
<dtref ref="double"/> datatypes now follow IEEE 754 implementation
practice more closely; in particular, negative and positive zero are
now distinct values, although arithmetically equal. <phrase diff="add"
dg="qd3hax">Conversely, NaN is identical but not arithmetically equal
to itself.</phrase></p></item>
<item><!--* rq150c *-->
<p>The minimum requirements for implementation support of the <dtref
ref="precisionDecimal"/> datatype
have been clarified.</p></item>
<item><!--* metachar-2531 *-->
<p>Some errors in the definition of regular-expression metacharacters
have been corrected.</p>
</item>
<item><!--* pattern-1929 *-->
<p>The descriptions of the pattern and enumeration facets have been
revised to make clearer how values from different derivation steps are
combined.</p>
</item>
<item><!--* b2533-rq127-r196 *-->
<p>A warning against using the whitespace 
facet for tokenizing natural-language data has been added on the
request of the W3C Internationalization Working Group.</p>
</item>

<!--* Not mentioned specifically: *-->
<!--* wd2hax *-->
<!--* wd-23 *-->
<!--* rq126 health warning about restricting away canonical forms *-->
<!--* ep01-part2 *-->
<!--* moreFunctions *-->
<!--* context-2337 *-->
<!--* enum-2454 *-->
<!--* flfix *-->
<!--* rq20rb-1912 *-->
<!--* pd1-1912 *-->
<!--* lexMapFacet-1912 *-->
<!--* b2603 *-->
<!--* rq152temp *-->
<!--* wd3hax *-->
<!--* pattern-1929-fix *-->
</ulist>
<p>Other major changes since version 1.0 include:</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"/> 
<phrase diff="add" dg="qd3hax">which serves as the base type 
definition for all primitive atomic types</phrase>
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 diff="del" dg="qd3hax">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 diff="add" dg="qd3hax">Comments on this document should be made in
W3C's public installation of Bugzilla, specifying "XML Schema" as the
product. Instructions can be found at <loc
href="http://www.w3.org/XML/2006/01/public-bugzilla"
>http://www.w3.org/XML/2006/01/public-bugzilla</loc>. If access to
Bugzilla is not feasible, please send your comments to the W3C XML
Schema comments mailing list, <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>) 
Each Bugzilla entry and email message should contain only one
comment.</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" dg="rq152a"> 1.0</phrase>, provides a superset of the capabilities found in XML<phrase diff="del" dg="rq152a"> 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="telltale">A 'telltale' diff group is for use labeling phrases
which tell the reader which proposal / requirement / issue a change is
connected with.  It's intended for use when we provide only a single 
version of the spec with diff markup for several relatively small changes.
To distinguish changes related to RQ-nnn from those related to RQ-kkk
in the same display text, use 
<phrase diff="add" dg="telltale">[RQ-nnn]</phrase>
or 
<phrase diff="add" dg="telltale">[RQ-kkk]</phrase>
(or rather dg="rqnnn-telltale)
near the changes.  (This assumes the changes aren't anywhere near each
other; if they are, perhaps they shouldn't be in the same display.)
AFTER THE PRESENTATION FORM OF THE PROPOSALS IS PREPARED, or after the
WG approves the change, THE PHRASE ELEMENTS SHOULD GO AWAY, and
so should the telltale rqnnn-telltale diff group.

The 'telltale' diffgroup is also used (as of 2005-08-25) in the Status
section on the list of proposals included.

This usage proposal is currently (2005-08-25) experimental, but has
been used successfully for a couple of weeks.
For brevity, sometimes the suffix -tt is used instead of -telltale.
</sitem><sitem id="wg-internal">Phrases in status section which apply only to
to WG-internal draft copies.  (Copied into datatypes.xml from structures.xml,
2005-12-14.)</sitem>
<sitem id="diffHacks">Note to the reader: the following 'phrase' elements are 
here for use in supplying diff markup in auto-generated material.  Do not
delete them, and edit them only if you know what you are doing (i.e. if you
have reviewed either the output or the stylesheet or both).

  <phrase diff="add" dg="rec12-tableaux" role="hack" id="odiff_hack">odiff</phrase>
  <phrase diff="add" dg="rec12-tableaux" role="hack" id="idiff_hack">idiff</phrase>
  <phrase diff="add" dg="rec12-tableaux" role="hack" id="arrow_hack">arrow</phrase>
  <phrase diff="add" dg="rec12-tableaux" role="hack" id="odiff_del_hack">odiff</phrase>
  <phrase diff="add" dg="rec12-tableaux" role="hack" id="idiff_del_hack">idiff</phrase>
  <phrase diff="add" dg="rec12-tableaux" role="hack" id="del_arrow_hack">arrow</phrase>
  <!--* MSM essays a change to wording.  I'm leaving the old words here because
      * I'm not sure the change is an improvement. 
  <phrase diff="add" dg="rec12-tableaux" id="must_not_prose"> with <pt>fixed</pt> values as given &mdash; they <rfc2119>must not</rfc2119> be further restricted:</phrase>
  <phrase diff="add" dg="rec12-tableaux" id="may_prose1"> with values as given &mdash; they <rfc2119>may</rfc2119> be further restricted:</phrase>
      *-->
  <phrase diff="add" dg="rec12-tableaux" id="must_not_prose"> with <pt>fixed</pt> values; these
facets <rfc2119>must not</rfc2119> be changed from the values shown:</phrase>
  <phrase diff="add" dg="rec12-tableaux" id="may_prose1"> with the values shown; these
facets <rfc2119>may</rfc2119> be further restricted in the derivation of new types:</phrase>
  <phrase diff="add" dg="rec12-tableaux" id="may_prose2"> <rfc2119>may</rfc2119> also
specify values for the
     following</phrase></sitem>
<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="errata-2e">Some changes (assumed to be 2e) which were marked without
a diff group; this diff group added so as to control them better.</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="du0_prodigal">diff group du0_prodigal marks a paragraph which was
inadvertently marked 11 Jan as added by du1 and thus omitted from the Feb. draft,
since du1 was not status quo in Feb 2005.  It needs to be distinct from
the rest of du0 because it needs to shown as added against the Feb WD.</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="dudt">diff group dudt:&nbsp; function for adding duration to dateTime</sitem>
<sitem id="dudt_g">(experimental) diff group dudt_g: movement of prose commentary 
from the existing appendix G into the new statement of the algorithms (the new
locations will be marked as add with this diff group, but I plan to show that
diff group as 'post' so as not to color the paragraphs)</sitem>
<sitem id="dudt2">(experimental) diff group dudt2: revision of prose commentary 
moved from the existing appendix G into the new statement of the algorithms</sitem>
<sitem id="rq122d_sg">Corrections suggested by Sandy Gao's review of proposal RQ-122-d
for new duration algorithm.</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 of the phase-2 proposal (time and others).  This diff group
marks (as 'del') a single item which was added in dt2 and then delled
in dt3. Accept (i.e. display as "post") as a rule, but reject it (show
as "pre") if dt2 is accepted and dt3 is rejected, and show it
(show="colour") if dt2 is accepted and dt3 is set to '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 aPDecimal; 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.
(The single use of this got commented out later, I suspect because it
was merely a change to a non-sq proposal and doesn't need special
processing in future publications.  I leave this entry here and the
commented-out text in the body of the doc out of a sense of
historical piety or something.  Later we'll rip them out.)</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 (no longer in use here,
I think)</sitem>
<sitem id="ep01-part2">Micro-component-related changes specifically in
part 2.  Split off from the preceding 2005-06-07, so that the status quo for
Structures can continue to show ep01 as a non-status-quo change,
while for Datatypes it can be suppressed silently.</sitem>
<sitem id="ep01.add.ep01.del">Hack for section 4.4, added by EP-01 and
then removed from the EP-01 proposal.  On 2005-08-29 MSM believes section
4.4 was never part of the status quo and can be deleted entirely.
This hack is temporary, and only needs to be kept while we still have
a residue of doubt about the question.</sitem>
<sitem id="wd2hax">Last-minute hacks to make the Working Draft
of February 2005 be valid and produce valid clean HTML.</sitem>
<sitem id="rq120">MSM's draft phase-2 proposal for RQ-120, which uses
'ordinary' as the general term for non-special types and 
'constructed' as the general term for types of classes 3 and 4.</sitem>
<sitem id="rq120c">Bits of the RQ-120 proposal which should only
be included if rq120o is excluded.</sitem>
<sitem id="rq120o">An alternate form of the phase-2 proposal for RQ-120,
which uses 'ordinary' for classes 3 and 4.</sitem>
<sitem id="rq120fix">Changes made in the course of our work on RQ-120 that
were not marked as changes at the time.  
Some from version 152 (davep),
some from version 144 (cmsmcq).
Found and marked 26 August 2005.
</sitem>
<sitem id="lm.rel">lm.rel:  For making lex maps not functions.</sitem>
<sitem id="flfix">flfix: value/lexical space and lex/canon mappings
for float and double.</sitem>
<sitem id="flfix-tt">flfix-tt: comments only for flfix approval cycle.</sitem>
<sitem id="lp">lp:  Introduction of 'literate programming' markup.
A purely internal change: no change to presentation or substance of the
material.  Thus no need for WG review or approval; marked here solely
for editorial convenience.</sitem>
<sitem id="rq20">Addition of type definitions for the two new totally
ordered subtypes of duration; completes satisfaction of RQ-20.</sitem>
<sitem id="rq20ep">Changes made en passant in the schema document for schema
documents and the DTD for schema documents, while doing RQ-20.</sitem>
<sitem id="rq20rb">Changes which had been made in the externally stored
version of the schema document for schema documents and the DTD for 
schema documents, which MSM found while doing RQ-20 and which MSM
proposes to roll back (subject to objection from the other editors).
To roll them back, display rq20rb as 'pre'.</sitem>
<sitem id="rq20ids">Addition of id attributes on the declarations of the
two new totally ordered subtypes of duration, done on editorial 
initiative 2006-01-09.</sitem>
<sitem id="rq123">Changes for RQ-123 (allow year 0000).
Approved 17 June 2005.</sitem>
<sitem id="wd17">Resolution of issue wd-17 (changes to description of
value space of duration), including amendments of 29 April 2005.</sitem>
<sitem id="noleap">Changes for task 2-122-a remove leap seconds.
Decided by WG at Tech Plenary, action TP5-4.</sitem>
<sitem id="rq122a_sg">Corrections arising from Sandy Gao's comments on 
proposal RQ-122a.</sitem>
<sitem id="dt3-del-noleap">Changes originally added by dt3 and deleted
by noleap. It was set as "del" for generating the noleap proposal.
After the proposal was accepted, the single occurrence of this diff
group was changed to "add". The dg-approved file should (and does)
show this dg as "pre"). </sitem>
<sitem id="idleap">Changes for alternate text: leap second support is
implementation defined.  (Prepared on spec, in case the WG 
changes plans.)  The SQL spec says <quote>Whether an SQL-implementation
supports leap seconds, and the consequences of such support
for date and interval arithmetic, is implementation-defined.</quote>
Short and sweet.</sitem>
<sitem id="leapseconds">Addition of proper bibliographic reference to
ITU-R TF.460-6, which defines UTC.</sitem>
<sitem id="totl">Correction to timeOnTimeline function
(off by one error in step 3b).</sitem>
<sitem id="wd-2">Fix for wd-2 (add value constraint to list of duties
performed by identity checking).</sitem>
<sitem id="wd-3">Fix for wd-3 (wording in section 2.2.1 about
identity of values across types)</sitem>
<sitem id="wd-4">Fix for wd-4.</sitem>
<sitem id="wd-5">Fix for wd-5.</sitem>
<sitem id="wd-11">Fix for wd-11 (fundamental facets).</sitem>
<sitem id="wd-19">Fix for wd-19 (base64).</sitem>
<sitem id="wd-21">Fix for wd-2 (canonical form health warnings for QName
and NOTATION).</sitem>
<sitem id="wd-23">Fix for wd-23 (misleading / erroneous labels in the table
of applicable facets). Most changes are actually in dg.xsl
and xmlschema.xsl, not here.  Approved 2005-06-17.</sitem>
<sitem id="wd25">Fix for wd-25 (pointing to IRI spec).</sitem>

<sitem id="partialfix">Fix for handling of partial implementations.</sitem>
<sitem id="partialfixfix">Post-hoc marking of changes made at the same
time as partialfix (rev 1.7.2.183) which were accidentally left unmarked.</sitem>
<sitem id="decfix">Fix for facet-sensitive canonical mapping for decimal,
and text cleanup. (RQ-150, part of RQ-21)</sitem>
<sitem id="decfix_movement">Movement of data for decfix diff group.
Show as pre or post, not as colour (unless you want to make it
impossible to follow the fine-grained changes).</sitem>
<sitem id="rq31m_decfix_movement">Movement of data for decfix diff group.
This paragraph was originally added by rq31m, and moved by decfix.
It was then deleted by rq21-lexmaps.
Show accordingly.</sitem>
<sitem id="context">Lexmaps for context-sensitive QName and ENTITY,
and Canonmap for facet-sensitive decimal.</sitem>
<sitem id="rec12-main">RQ-141b Changes to reconcile overlap/conflict between parts 1
and 2 -- various items.  Much of this was accepted by the WG in
Edinburgh 2005-09 as part of the omnibus proposal of 31 August.
The parts that were not have been relabeled rec12-main-excepted.</sitem>
<sitem id="rec12-main-excepted">RQ-141b Changes to reconcile overlap/conflict 
between parts 1 and 2 -- various items which were not accepted as
part of the omnibus proposal of 31 August (they were 'excepted' from the
decision to approve the omnibus).</sitem>
<sitem id="rec12-tableaux">RQ-141b Changes to reconcile overlap/conflict between parts
1 and 2 -- provide better facet information in section 3</sitem>
<sitem id="rec12-map">RQ-141b Changes to reconcile overlap/conflict between parts 1
and 2 -- fix long-standing problems with mapping rules in 4.1.2.  Every section
in which this diff group appears was excepted from the approval of the
omnibus proposal in Edinburgh.  (That is why this diff group has not been
split in two the way rec12-main has been.)</sitem>
<!--* <sitem id="rec12-map">RQ-141b Changes to reconcile overlap/conflict between parts 1 
and 2. Fix long-standing problems with mapping rules in 4.1.2</sitem> *-->
<sitem id="rec12-map-1853">
<loc href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=1853">define
'ancestor'</loc></sitem>
<sitem id="dpno.del.rec12-map.del">dpno.del.rec12-map.del:  portmanteau hack
for paragraphs deleted by dpno (but still not in the status quo) and 
deleted (again) by rec12-map; these are currently marked del, so make
this diff group's disposition equal to that of rec12-map.</sitem>
<sitem id="dpno.add.rec12-map.del">dpno.add.rec12-map.del:  portmanteau hack
for paragraphs added by dpno and deleted by rec12-map.  These are
currently marked 'add', so to show rec12-map, make this diff group
'pre'.</sitem>
<sitem id="rec12-tt">A telltale for sections with a lot of rec12-map and
rec12-main changes.</sitem>
<sitem id="rq100">rq100: changes to achieve requirement RQ-100 
canonical form for language.  Approved with changes 2005-08-26.	</sitem>
<sitem id="wd-23-bis">wd-23-bis: another attempt to fix the table of applicable facets</sitem>
<sitem id="wd26">wd26: restore the notion of 'duration' in describing timezones.
Approved 1 July 2005.</sitem>
<sitem id="wd31">wd31: recast sentences about to Unicode database changes.
Approved 1 July 2005.</sitem>
<sitem id="sfs-cleaning">sfs-cleaning: trying to synch the schema for schemas with
recent changes found when checking ht's rec12 changes</sitem>

<sitem id="rq21-lit">rq21-lit: define 'literal' properly and use it to denote
the members of lexical spaces (some diffs are in local.dtd, specifically the
change in the entity declaration 'string' from 'character string' to 'literal').  
When this diff group goes to the WG, we must remember to note that the change
proposed includes changing each occurrence of the word 'literal' in the 
running prose (not in the tableaux) to a termref.  Those changes can be 
reverted easily and we would like not to show them in the diffed WD.
(They also lack any telltale in the formatted proposal.)
Approved by WG 26-28 Sept 2005 in Edinburgh 
as part of omnibus proposal of 31 August.
</sitem>
<sitem id="rq21-lexmaps">rq21-lexmaps:  editorial proposal to make references
to lexical and canonical mappings lighter weight.
Approved by WG 26-28 Sept 2005 in Edinburgh 
as part of omnibus proposal of 31 August.</sitem>
<sitem id="rq31m.add.rq21-lexmaps.del">rq31m.add.rq21-lexmaps.del:  
special diff group for material added by rq31m and re-deleted by rq21-lexmaps.
For this and the following analogous diff groups, be careful how you color them.
Approved by WG 26-28 Sept 2005 in Edinburgh 
as part of omnibus proposal of 31 August.</sitem>
<sitem id="rq31fix.add.rq21-lexmaps.del">rq31fix.add.rq21-lexmaps.del:  
special diff group for material added by rq31fix and re-deleted by rq21-lexmaps.
Approved by WG 26-28 Sept 2005 in Edinburgh 
as part of omnibus proposal of 31 August.</sitem>
<sitem id="du0_prodigal.add.rq21-lexmaps.del">du0.prodigal.add.rq21-lexmaps.del:  
special diff group for material added by du0.prodigal and re-deleted by rq21-lexmaps.
Approved by WG 26-28 Sept 2005 in Edinburgh 
as part of omnibus proposal of 31 August.</sitem>
<sitem id="du0_prodigal.add.rq21-lexmaps.add">du0.prodigal.add.rq21-lexmaps.del:  
special diff group for material added by du0.prodigal and by rq21-lexmaps.
Show as colour for the second of these to be considered.
Approved by WG 26-28 Sept 2005 in Edinburgh 
as part of omnibus proposal of 31 August.</sitem>
<sitem id="du0_prodigal2.add.rq21-lexmaps.del">du0.prodigal2.add.rq21-lexmaps.del:  
special diff group for material added by du0.prodigal2 and re-deleted by rq21-lexmaps.
It could probably have been changed silently, but I wanted to be careful.
Since prodigal2 has not been approved at the time rq21-lexmaps is proposed,
the disposition file will leave this as pre.  If rq21-lexmaps is approved,
this group should never become colour or post; see next item.
rq21-lexmaps WAS approved by WG 26-28 Sept 2005 in Edinburgh 
as part of omnibus proposal of 31 August, so this should never be colour or post,
always pre.
[Correction, 2006-01-10:  the material marked prodigal2 was included
in the duration proposal approved by the WG on 18 December 2003.
So today I have reviewed all the diff groups related to it and
made sure prodigal2 appears in the status quo documents (for the first
time in a long time, if ever) unless later overridden.  Leave this one pre.]
</sitem>
<sitem id="du0_prodigal2.add.rq21-lexmaps.add">du0.prodigal2.add.rq21-lexmaps.del:  
special diff group for material added by du0.prodigal2 and revised by rq21-lexmaps.
If and when du0_prodigal2 is sent to the WG, make this show as a colored
addition. [No, p2 was approved.  Show this approved after 200502]</sitem>
<sitem id="dt3.add.rq21-lexmaps.del">dt3.add.rq21-lexmaps.del:  
special diff group for material added by dt3 and re-deleted by rq21-lexmaps.
Approved by WG 26-28 Sept 2005 in Edinburgh 
as part of omnibus proposal of 31 August.</sitem>

<!--* MSM renames old str-bool-fix to rq21-string and -boolean, since
    * they are not actually bug fixes but part of fulfilling a new requirement.
    *-->
<sitem id="rq21-string">rq21-string: new lexical/canonical mappings for
string; requires moreFunctions DG as well.
Approved by WG 26-28 Sept 2005 in Edinburgh.</sitem>
<sitem id="rq21-string-hack">rq21-string-hack: dummy diff group:  for some
text which has moved, avoid showing it as new text in the new location,
but mark it as an add so that if rq21-string is rejected, the movement
can be rejected.  If rq21-string is set to post, set this to post.
If to pre, set this to pre.  If to colour, set this to post.</sitem>
<sitem id="b1902amend">b1902amend: amendments to the proposal for bug 1902
(RQ-21 for string) approved in Edinburgh.</sitem>

<sitem id="rq21-boolean">rq21-boolean: new lexical/canonical mappings for
boolean; requires moreFunctions DG as well.
Approved by WG 26-28 Sept 2005 in Edinburgh 
as part of omnibus proposal of 31 August.</sitem>

<sitem id="moreFunctions">moreFunctions: adds another subsection after numeric and d/t
in functions appendix; show this whenever rq21-string, rq21-boolean, or context are
to be shown.</sitem>
<sitem id="du0_prodigal2">du0_prodigal2: continues resurrection of lost duration 
stuff.  [Note, 2006-01-10:  the material marked prodigal2 was included
in the duration proposal approved by the WG on 18 December 2003.
It has not been included in recent status-quo documents, though, because
until today it was not clear that the material was in fact reviewed and
approved.]
</sitem>
<sitem id="rq126">rq126: health warning about restricting away canonical
forms.</sitem>
<sitem id="rq140">rq-140: distinguishing negative from positive zero.
An attempt at a minimum-needed proposal added by MSM.
Approved by WG 26-28 Sept 2005 in Edinburgh 
as part of omnibus proposal of 31 August.</sitem>
<sitem id="rq150c">rq-150c: require minimum support in precisionDecimal.
Approved with amendments by WG 26-28 Sept 2005 in Edinburgh.
</sitem>
<sitem id="rq152a">rq152a: quick initial change of 'XML 1.0' to 'XML' in abstract, 
done long ago (2004?) but not associated with a diff group til 2005-08-27.
(Other appearances of that string are machine-generated for bibliographic
references, don't get diff markup.)
</sitem>
<sitem id="ed-pattern">Editorial proposal to replace all occurrences of
'pattern' as a reference to a defined term with references to the
component.  (Need similar proposal for all the others ...)</sitem>
<sitem id="pattern-1929">pattern-1929: pattern value as set.
Follow-on proposal from RQ-141 reconciliation effort.  Make pattern facet
have a set-valued {value} in place of a regex-valued {value}, so we
can have just one.</sitem>
<sitem id="pattern-1929-fix">deletion of cross references to 
src-multiple-patterns and src-multiple-enumerations.  The references should have been
deleted as part of pattern-1929, since their targets were deleted then.</sitem>
<sitem id="lexMapFacet-1912">Remove lexicalMappings facet</sitem>
<sitem id="rq20rb-1912">Portmanteau for former additions destined for rollback
to actual deletions of lexicalMappings facet, ref. bug 1912</sitem>
<sitem id="pd1-1912">Portmanteau for former addition for precision to
actual deletion of lexicalMappings facet, ref. bug 1912</sitem>
<sitem id="rq21-specials-1909">RQ-21 (define lexical space and
lexical mappings more precisely) for specials.</sitem>
<sitem id="context-2337">Replacing {scope} with {context} on stds, ref. bug 2337.</sitem>
<sitem id="ep01-p2.add.context-2337.del">Material added by proposal EP-02 part 2,
but deleted by later context-2337 proposal.  This material was never status-quo.
It's shown as an ADD at the moment.
</sitem>
<sitem id="rec12-map-eff">Amendments to rec12-map agreed at Edinburgh f2f 2005-09-26</sitem>
<sitem id="rec12-main-eff">Amendments to rec12-main agreed at Edinburgh f2f 2005-09-26,
in sections which were not, ultimately, approved in Edinburgh.</sitem>
<sitem id="rec12-main-eff-ok">Amendments to rec12-main agreed at Edinburgh f2f 2005-09-26,
in sections which were ultimately approved in Edinburgh (notably appendix A).</sitem>
<sitem id="enum-2454">Simplify mapping rules for enumeration facet parallel to
changes agreed for pattern</sitem>
<sitem id="rec12-main-dub">Material in the enumeration sections not approved in
Edinburgh (explicitly excepted) but also not actually incorporated into the
enumeration proposal (it was marked nsq, not colour).  I'm going to swallow hard,
though, and treat it as approved anyway.</sitem>
<sitem id="metachar-2531">Correct Char production (was 10, now 51 or something) of regex
grammar to describe metacharacters correctly.</sitem>
<sitem id="b2603">Minor editorial change to resolve bug 2603.
Approved by the WG 2005-12-16.</sitem>
<sitem id="sfs-1933">Remove built-in and derived primitives from sForS proper,
relocate in separate appendices/non-schema-documents</sitem>
<sitem id="aux-1933">Auxiliary diff group for bug 1933, to mark the movement of
data.  Normally this should be pre if sfs-1933 is pre, post if sfs-1933 is
post or colour.</sitem>
<sitem id="old-1933">Auxiliary diff group for bug 1933, to hold wording which
was in the proposal of 16 December which the editors or WG later agreed to
change, in cases where we might want to consult it.  This may be dropped, and
the material deleted, after we are fully done with 1933.  Normally this should 
be pre; if we need the words, move them back to sfs-1933.  (Diff group
markup as a simple method of conditional section ...)</sitem>
<sitem id="dup-2214">Deprecate <code>XMLSchema-datatypes</code></sitem>
<sitem id="edinburgh.refuses.to.die">27 December, reviewing bugs marked 
'decided', I found some changes which had been agreed on in Edinburgh which
had not been made.  If any of these got re-deleted after Edinburgh, 
I don't know about it.</sitem>
<sitem id="rec12-map-eff-pentimenti">27 December, reviewing bugs marked 
'decided', I found some changes I would like to make in HT's execution
of the instructions from Edinburgh.  These changes should (aaaughh!) probably 
go to the WG.</sitem>
<sitem id="b2533-rq127-r196">Health warning about use of whitespace facet
for tokenizing natural-language data.  Approved for 1.1 in Toronto
(but overlooked by MSM when processing Toronto minutes).</sitem>
<sitem id="b2044">Bugzilla 2044, R-198, unions of unions</sitem>
<sitem id="rq152temp">Temporary hack for Bugzilla 1838, RQ-152, alignment with XML 1.1.
We don't have final wording on this yet, but I've updated the reference to point
to XML 1.1, which is at least consistent with the most recent clear WG decision
on the matter.</sitem>
<sitem id="b2642">Correct typo in description of double range: 2**53 not 2**57.</sitem>
<sitem id="wd3hax">Editorial hacks for publication of WD,
2006-01.  These should be shown coloured in diffed versions.</sitem>
<sitem id="qd3hax">Editorial hacks for publication of WD,
2006-01 which must be silent, NOT shown:  Correct / work around link rot.
(We can't show the old rotten links as links, because they
are bad and will raise linkcheck errors.)</sitem>

<!--* Dummy IDs, solely for validation; any actual use of these _should_ be
        accompanied by a name attribute allowing an xtermref to
        Part 1 to be generated. *-->
<sitem id="td">Type Definition component</sitem>
<sitem id="a">Annotations component</sitem>
<sitem id="ctd">Complex Type Definition component</sitem>
<sitem id="ad">Attribute Declaration</sitem>
<sitem id="ed">Element Declaration</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.
<phrase diff="add" dg="rq100">For some datatypes (e.g. 
<dtref ref="language"/> or <dtref ref="anyURI"/>) defined in part by
reference to other specifications which impose constraints not part of
the datatypes as defined here, applications may also wish to check
that values conform to the requirements given in the current version
of the relevant external specification.</phrase>
</p>
</note>
<!--* rq100: this would be a good place to add that applications may want
    * to check for RFC conformance
    *-->

<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 &strings; 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>

<!--* This note about simple type definitions added to allow
    * the discussion in section 4 to speak of 'the value
    * space of teh {base type definition}, etc.
    * Deleted 2005-08-31.  Rationale:  the crucial bit (simple typedef
    * uniquely identifies a datatype; vs/ls/etc of simple type (def)
    * are those of the datatype thus identified) is also stated in 
    * 4.4.1.  Some graf like this is required as a heads-up before
    * terms like 'facet' and so on are used, but that graf needs
    * careful drafting and must be based on a careful reading of
    * the first three sections of the spec.  No time for that today; 
    * postpone.
    *-->
<!--*
<p diff="add" dg="rec12-main">When this specification is used in
conjunction with <bibref ref="structural-schemas"/>, 
<compref ref="std"/>s are used to define datatypes.  In the
context of a valid schema, any <compref ref="std"/> identifies
exactly one datatype.  More than one <compref ref="std"/>
may identify the same datatype.
*-->
<!--* 
In what follows, references to the 
&value_space; or &lexical_space; of a <compref ref="std"/>
mean the &value_space; or &lexical_space; of the datatype
uniquely identifed by that <compref ref="std"/>.
*-->
<!--* </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> *-->

<!--* 2005-08-26.  Reviewing our diffs from 1.0 again, MSM sees
    * that whether we mark this as new vis-a-vis the WD of July 2004
    * or not, it needs to be marked as new vis-a-vis 1.0.
    *-->
<note diff="add" dg="fa1">
<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 diff="add" dg="fa1">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.
<phrase diff="add" dg="wd-21">For some datatypes, notably
<dtref ref="QName"/> and <dtref ref="NOTATION"/>, the mapping from
lexical representations to values is context-dependent; for these
types, no <termref def="dt-canonical-mapping"/> is defined.</phrase></p>

<note diff="add" dg="rq126">
<p>
Where canonical mappings are defined in this specification, they are
defined for primitive datatypes. When a datatype is derived <!--* by
<termref def="dt-fb-restriction"/> *--> using facets which directly
constrain the &value_space;, then for each value eliminated from the
&value_space;, the corresponding lexical representations are dropped
from the lexical space.  The canonical mapping for such a datatype is
a subset of the canonical mapping for its &primitive; type and
provides a canonical representation for each value remaining in the
&value_space;.
</p>
<p>
The &pattern.tc;
facet, on the other hand, restricts
the &lexical_space; directly.  When more than one lexical
representation is provided for a given value, the &pattern.tc; facet may 
remove the canonical representation while
permitting a different lexical representation; in this case, the value
remains in the &value_space; but has no canonical representation.
This specification provides no recourse in such situations.
Applications are free to deal with it as they see fit.
</p>


</note>

</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 
&fb.restrictions.xr; 
by <emph>enumeration</emph>, <phrase diff="del" dg="wd-2">and </phrase>when checking
identity constraints<phrase diff="add" dg="wd-2">, and when
checking value constraints</phrase>.&nbsp; These are the only 
uses of <emph>identity</emph> for schema processing.</p>

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

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

<p><emph>WARNING:</emph>&nbsp; Care must be taken when identifying values across 
distinct primitive datatypes.&nbsp; <phrase diff="del" dg="wd-3">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.)</phrase><phrase diff="add" dg="wd-3">The 
&literals; <string>0.1</string> and <string>0.10000000009</string> map to
the same value in <dtref ref="float"/> (neither is in the value space, and
each is mapped to the nearest value, namely 0.100000001490116119384765625),
but map to distinct values in <dtref ref="decimal"/>.</phrase></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, 
<phrase diff="del" dg="wd-5">it</phrase><phrase diff="add" dg="wd-5">equality</phrase> 
has been carefully defined so <phrase diff="del" dg="wd-5">as to be a 
<emph>congruence relation</emph></phrase><phrase diff="add" dg="wd-5">that</phrase> 
for most <phrase diff="del" dg="wd-5">other</phrase> operations of interest 
to the datatype<phrase diff="del" dg="wd-5">.&nbsp; (This means simply 
that</phrase><phrase diff="add" dg="wd-5">,</phrase> 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.<phrase diff="del" dg="wd-5">&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.</phrase></p>

<p>On the other hand,
equality need not cover the entire value space of the 
datatype (though it usually does).
<phrase diff="add" dg="wd-4">In particular, NaN &lt;&gt; NaN in the 
<dtref ref="precisionDecimal"/>, <dtref ref="float"/>, and
<dtref ref="double"/> datatypes.</phrase></p>

<p>The equality relation is used in conjunction with
order when making &fb.restrictions.xr; 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 &fb.restrictions.xr; 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 diff="add" dg="rq21-lit">
<termdef term="literal" id="dt-literal">A
sequence of zero or more characters in the Universal Character Set
(UCS) which may or may not prove upon inspection to be a member of the
&lexical_space; of a given datatype and thus a &lex_rep; of a given
value in that datatype's &value_space;, is referred to as a
<term>literal</term>.</termdef> The term is used indifferently both
for character sequences which are members of a
particular &lexical_space; and for those which are not.</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>

<div2 role="1.0" id="datatype-dichotomies" dg="trm1" diff="del">
<head>Datatype
<phrase diff="del" dg="rq120">dichotomies</phrase><phrase diff="add" dg="rq120">Distinctions</phrase></head>

<p>It is useful to categorize the datatypes defined in this specification
along various dimensions, <phrase diff="del" dg="rq120">forming a set of 
characterization dichotomies</phrase><phrase diff="add" dg="rq120">defining
terms which can be used to characterize datatypes and the <dtref ref="std"/>s
which define them</phrase>.</p>

<div3 role="1.0" id="atomic-vs-list">
<head>Atomic vs. List vs. Union Datatypes</head>

<p diff="del" dg="rq120">
The first distinction to be made is that 
between 
<termref def="dt-atomic"/>, <termref def="dt-list"/> and 
<termref def="dt-union"/> datatypes.
</p>

<p diff="add" dg="rq120">First, we distinguish <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 <phrase diff="del" dg="rq120">which are
regarded</phrase><phrase diff="add" dg="rq120">treated</phrase> by
this specification as <phrase diff="del" dg="rq120">being</phrase>
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 
<phrase dg="rq120" diff="del">derived</phrase><termref def="dt-derived" dg="rq120" diff="add"/> 
from it.</phrase></termdef></p>
</item>
<item>
<p><termdef id="dt-list" term="list"><term>List</term>
datatypes are those having values each of which consists of a
finite-length (possibly empty) sequence of values of an
<termref def="dt-atomic"/> datatype<phrase diff="add" dg="rq120">
(or a <termref def="dt-union"/> of <termref def="dt-atomic"/> datatypes), 
which is the <termref def="dt-itemType"></termref> of the 
<term>list</term></phrase>.
<phrase dg="aat1" diff="add">&nbsp; <term>List</term> datatypes are 
those which are explicitly 
<phrase dg="rq120" diff="del">constructed</phrase><termref def="dt-constructed" dg="rq120" diff="add"/> 
as lists, or are 
<phrase dg="rq120" diff="del">derived</phrase><termref def="dt-derived" dg="rq120" diff="add"/> 
from another <term>list</term> datatype.</phrase>
</termdef></p>
</item>
<item>
<p><termdef id="dt-union" term="union"><term>Union</term>
datatypes are <phrase diff="add" dg="b2044">(a)
</phrase>those whose 
<phrase diff="del" dg="rq120"><termref def="dt-value-space"/>s and
<termref def="dt-lexical-space"/>s</phrase><phrase diff="add" dg="rq120"><termref def="dt-value-space">value spaces</termref><phrase diff="add" dg="b2044">,</phrase><phrase diff="del" dg="b2044"> and</phrase> <termref def="dt-lexical-space">lexical spaces</termref><phrase diff="add" dg="b2044">,
and <termref def="dt-lexical-mapping">lexical mappings</termref></phrase> are the union of
the <phrase diff="del" dg="rq120"><termref def="dt-value-space"/>s and
<termref def="dt-lexical-space"/>s</phrase><phrase diff="add" dg="rq120"><termref def="dt-value-space">value spaces</termref><phrase diff="add" dg="b2044">,</phrase><phrase diff="del" dg="b2044"> and</phrase> <termref def="dt-lexical-space">lexical spaces</termref><phrase diff="add" dg="b2044">,
and <termref def="dt-lexical-mapping">lexical mappings</termref></phrase> of one or more other 
datatypes<phrase diff="add" dg="rq120">, which are the 
<termref def="dt-memberTypes">member types</termref> of the 
union</phrase><phrase diff="add" dg="b2044">,
or (b) those derived by &fb.restriction; of a union 
type</phrase>.<phrase dg="aat1" diff="add">&nbsp; <term>Union</term> 
datatypes are those which are explicitly <termref def="dt-constructed"/> as lists, or 
are <termref def="dt-derived"/> from another <term>union</term> datatype.</phrase>
</phrase></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"/> <phrase diff="del" dg="rq120">could be the 
value</phrase><phrase diff="add" dg="rq120">is in the value space</phrase> of 
<phrase diff="del" dg="rq120">an</phrase><phrase diff="add" dg="rq120">the</phrase> 
<termref def="dt-atomic"/> datatype 
<phrase diff="del" dg="rq120">(</phrase><dtref ref="NMTOKEN"/><phrase diff="del" dg="rq120">);</phrase><phrase diff="add" dg="rq120">,</phrase> while a sequence of such tokens
<phrase diff="del" dg="rq120">could be the value of 
a</phrase><phrase diff="add" dg="rq120">is in the value space of 
the</phrase> <termref def="dt-list"/> datatype
<phrase diff="del" dg="rq120">(</phrase><dtref ref="NMTOKENS"/><phrase diff="del" dg="rq120">)</phrase>.
</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 <unusual>atomic</unusual> 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
<phrase diff="del" dg="rq21-lit"><emph>literals</emph></phrase><phrase diff="add" dg="rq21-lit">&literals;</phrase>
whose internal structure is specific to the datatype in question.&nbsp;
<phrase diff="add" dg="aatf">There is one
<phrase diff="del" dg="rq120"><unusual>special</unusual></phrase><termref def="dt-special" diff="add" dg="rq120"/>
&atomic_datatype.x;
(<dtref ref="anyAtomicType"/>)<phrase diff="add" dg="rq120">,</phrase> and a
number of <termref def="dt-primitive"/> <phrase diff="del" dg="rq120">atomic
types,</phrase><phrase diff="add" dg="rq120"><termref def="dt-atomic"/>
datatypes</phrase> which have
<dtref ref="anyAtomicType"/> as their <phrase diff="del" dg="rq120">base
type</phrase><termref def="dt-basetype" diff="add" dg="rq120"></termref>.&nbsp;
All other &atomic_datatypes.x; are
<phrase diff="del" dg="rq120">derived by
restriction</phrase><phrase diff="add" dg="rq120"><termref def="dt-derived"/></phrase>
either from one of the
<phrase diff="del" dg="rq120">primitive</phrase><termref def="dt-primitive" diff="add" dg="rq120"></termref>
&atomic_datatypes.x; or from another
<phrase diff="del" dg="rq120">ordinary</phrase><termref def="dt-ordinary"/>
&atomic_datatype.x;.&nbsp; No
<phrase diff="del" dg="rq120">user-defined</phrase><termref def="dt-user-defined" diff="add" dg="rq120"/>
<phrase diff="add" dg="rq120">data</phrase>type may have <dtref ref="anyAtomicType"/> 
as its <phrase diff="del" dg="rq120">base
type</phrase><termref def="dt-basetype" diff="add" dg="rq120"/>.</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><phrase diff="del" dg="rq120"><termref def="dt-list"/></phrase><phrase diff="add" dg="rq120"><termref def="dt-list">List</termref></phrase> 
datatypes are always &constructed.x;<phrase diff="add" dg="rq120"> from
some other type; they are never <termref def="dt-primitive"/></phrase>.
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; <!--* <phrase dg="rq120" diff="add"><termref def="dt-lexical-representation">lexical 
representations</termref></phrase>  *-->
<phrase diff="del" dg="rq120">whose internal structure</phrase><phrase diff="add" dg="rq120">each
of which</phrase> 
is a space-separated sequence of
&literals;
<!--* <phrase dg="rq120" diff="add"><termref def="dt-lexical-representation">lexical
representations</termref></phrase> *-->
of the
<phrase diff="del" dg="rq120"><termref def="dt-atomic"/> datatype of the items in the
<termref def="dt-list"/></phrase><phrase diff="add" dg="rq120"><termref def="dt-itemType"/></phrase>.</p>

<p><termdef id="dt-itemType" term="item type">
The <termref def="dt-atomic"/> or <termref def="dt-union"/>
datatype that participates in the definition of a <termref def="dt-list"/> datatype
is <phrase dg="rq120" diff="del">known as </phrase>the 
<term dg="rq120" diff="del">itemType</term><term diff="add" dg="rq120">item type</term> 
of that <termref def="dt-list"/> datatype.</termdef><phrase dg="rq120" diff="add">&nbsp; If 
the <termref def="dt-itemType"/> is a <termref def="dt-union"/>, each of its 
<phrase diff="del" dg="b2044"><termref def="dt-memberTypes">member types</termref></phrase><phrase diff="add" dg="b2044"><termref def="dt-basicmember">basic members</termref></phrase> &must; be 
<termref def="dt-atomic"/>.</phrase></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" diff="del" dg="rq120"/><termref def="dt-constructed" diff="add" dg="rq120"/>
from an <phrase diff="add" dg="aatf">ordinary 
</phrase><phrase diff="add" dg="rq120o">or
<termref def="dt-primitive"/> </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.
<phrase diff="del" dg="rq120">In such a case,
regardless of the input, list
items will be separated at space 
boundaries.</phrase><phrase diff="add" dg="rq120">Since <termref def="dt-list"/>
items are separated at whitespace before the
<termref def="dt-lexical-representation">lexical representations</termref>
of the items are mapped to values, no whitespace will ever occur
in the <termref def="dt-lexical-representation"/>
of a <termref def="dt-list"/> item, even when the item
type would in principle allow it.&nbsp; 
<!--* For the same reason, when whitespace is
<emph>required</emph> in every <termref def="dt-lexical-representation"/> of a
value in the <termref def="dt-value-space"/> of the <termref def="dt-itemType"/>,
that value can never occur as an item of any of the
<termref def="dt-list">list&apos;s</termref> values</phrase>.
*-->
For the same reason, when every possible
<termref def="dt-lexical-representation"/> of a given
value in the <termref def="dt-value-space"/> of the <termref def="dt-itemType"/>
includes whitespace,
that value can never occur as an item in any value of the
<termref def="dt-list">list</termref> datatype.</phrase></p>
<!--* wouldn't 'value in the item type' be more concise? *-->

<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 built-in.xsd, so that the following can be auto-generated
  -->
<p>When a datatype is <termref def="dt-derived"/> 
<phrase diff="del" dg="rq120">from</phrase><phrase diff="add" dg="rq120">by 
<termref def="dt-fb-restriction">restricting</termref></phrase> a
<termref def="dt-list"/> datatype, the following
<termref def="dt-constraining-facet"/>s apply:
<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>&pattern.tc;</p></item>
<item><p><termref def="dt-whiteSpace"/></p></item>
</ulist>
</p>

<p>For each of <termref def="dt-length"/>, <termref def="dt-maxLength"/>
and <termref def="dt-minLength"/>, the 
<emph><phrase dg="rq120" diff="del">unit of </phrase>length</emph> is
measured in number 
of list 
items.&nbsp; The value of <termref def="dt-whiteSpace"/>
is fixed to the value <pt>collapse</pt>.</p>

<p>For <termref def="dt-list"/> datatypes the <termref def="dt-lexical-space"/>
is composed of space-separated
&literals;
of <phrase diff="del" dg="rq120">its</phrase><phrase diff="add" dg="rq120">the</phrase> 
<termref def="dt-itemType"/>.&nbsp; 
<!--* Hence, any
&pattern.tc; specified when a new datatype is
<termref def="dt-derived"/> from a <termref def="dt-list"/> datatype is matched against
<phrase diff="del" dg="rq120">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"/></phrase><phrase diff="add" dg="rq120">the 
<termref def="dt-lexical-representation">lexical
representations</termref> of the <termref def="dt-list"/> as a whole, 
not against the <termref def="dt-lexical-representation">lexical
representations</termref> of the individual list items</phrase>.
*-->
<phrase diff="del" dg="rq120">Hence, a</phrase><phrase diff="add" dg="rq120">A</phrase>ny 
&pattern.tc; specified when a new datatype is
<termref def="dt-derived"/> from a <termref def="dt-list"/> datatype 
<phrase diff="del" dg="rq120">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"/></phrase><phrase diff="add" dg="rq120">applies
to the members of the <termref def="dt-list"/> datatype's
&lexical_space;, not to the members of the &lexical_space;
of the &itemType;.</phrase></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 dg="rq120" diff="del">
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>

<p dg="rq120" diff="add">The <termref def="dt-canonical-mapping"/> of a 
<termref def="dt-list"/> datatype maps each value onto the 
space-separated concatenation of the 
<phrase diff="del" dg="rq120o"><termref def="dt-canonical-representation"/> 
of each item of the 
value</phrase><phrase diff="add" dg="rq120o"><termref def="dt-canonical-representation">canonical representations</termref> of all the items in the value</phrase>
(in order), using the <termref def="dt-canonical-mapping"/> of the 
<termref def="dt-itemType"/>.</p>
<!--* MSM finds this wordier, but not clearer or more precise.  Sigh. *-->

</div4>

<div4 role="1.0" id="union-datatypes">
<head>Union datatypes</head>

<p><phrase diff="del" dg="b2044">The <termref def="dt-value-space"/> 
and <termref def="dt-lexical-space"/>
of a <termref def="dt-union"/> datatype are the union of the
<phrase diff="del" dg="rq120"><termref def="dt-value-space"/>s and 
<termref def="dt-lexical-space"/>s
</phrase><phrase diff="add" dg="rq120"><termref def="dt-value-space">value 
spaces</termref> and <termref def="dt-lexical-space">lexical
spaces</termref> </phrase> of
its <termref def="dt-memberTypes"/>.</phrase>
<phrase diff="add" dg="b2044">Union types may be defined in either of
two ways.  When a union type is &constructed; by &union;, its
&value_space;, &lexical_space;, and &lexical_mapping; are the
<unusual>ordered unions</unusual> of the &value_spaces;,
&lexical_spaces;, and &lexical_mappings; of its <termref
def="dt-memberTypes"/>.
When a union type is defined by <termref
def="dt-fb-restriction">restricting</termref> another &union;, its
&value_space;, &lexical_space;, and &lexical_mapping; are subsets of
the &value_spaces;, &lexical_spaces;, and &lexical_mappings; of its
&basetype;.</phrase>
<termref def="dt-union">Union</termref> datatypes 
are always &constructed.x;<phrase diff="add" dg="rq120"><phrase diff="add" dg="rq120o">
from other datatypes</phrase>; they are never 
<termref def="dt-primitive"/></phrase>.
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 
<phrase diff="del" dg="rq120">1</phrase><phrase diff="add" dg="rq120">0</phrase>) 
<!--* !!! N.B. substantive change (perhaps should not be in rq120, but I'll
    * leave it here for now):  the rest of the spec does NOT say unions have
    * to have at least two members.  Me, I don't see why they should be
    * required to have any at all.  When the WG discusses rq120, this
    * substantive change should be called out.
    *-->
of <phrase diff="add" dg="aatf">ordinary
</phrase><phrase diff="add" dg="rq120o"> or
<termref def="dt-primitive"/> </phrase><phrase diff="del" dg="b2044"><termref def="dt-atomic"/> 
or <termref def="dt-list"/></phrase>
<phrase diff="del" dg="rq120"><termref def="dt-datatype"/>s 
</phrase><phrase diff="add" dg="rq120"><termref def="dt-datatype">datatypes</termref></phrase>
can participate in a <termref def="dt-union"/> type.</p>

<p><termdef id="dt-memberTypes" term="member types">
The datatypes that participate in the
definition of a <termref def="dt-union"/> datatype are known as the
<term dg="rq120" diff="del">memberTypes</term><term diff="add" dg="rq120">member types</term> 
of that <termref def="dt-union"/> datatype.</termdef></p>

<p diff="add" dg="b2044"><termdef id="dt-transitivemembership"
term="transitive membership">The <term>transitive membership</term>
of a &union; is the set of its own &member_types;, and the
&member_types; of its members, and so on. More formally, if
<var>U</var> is a &union;, then (a) its &member_types; are in the
transitive membership of <var>U</var>, and (b) for any datatypes
<var>T1</var> and <var>T2</var>, if <var>T1</var> is in the transitive
membership of <var>U</var> and <var>T2</var> is one of the
&member_types; of <var>T1</var>, then <var>T2</var> is also in the
transitive membership of <var>U</var>.</termdef></p>

<p diff="add" dg="b2044"><termdef id="dt-basicmember"
term="basic member">Those members of the <termref
def="dt-transitivemembership"/> of a &union; datatype <var>U</var>
which are themselves not &union; datatypes, but <termref
def="dt-atomic"/> or <termref def="dt-list"/> datatypes, are the
<term>basic members</term> of <var>U</var>.</termdef></p>

<ednote diff="add" dg="b2044">
<edtext>If <dtref ref="anySimpleType"/> is allowed as a member
of a &union;, the preceding definition will need to be revised
slightly to avoid the restriction to lists and atomics.</edtext>
</ednote>
<!--ednote><edtext>I hope to rewrite the following para somehow in terms of the 
STD itself rather than a schema document fragment.&emsp;&mdash;DP</edtext></ednote>
I hope to do better but the current fix below will do for now. -->

<p>The order in which the <termref def="dt-memberTypes"/> are specified in the
definition (that is, <phrase diff="add" dg="rq120">in the case of
datatypes defined in a schema document, </phrase>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 
<phrase dg="rq120" diff="del"><emph>memberTypes</emph>
</phrase><phrase dg="rq120" diff="add"><att>memberTypes</att>
</phrase> 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 dg="rq120" diff="del"> 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>
<p dg="rq120" diff="add">The <termref def="dt-canonical-mapping"/> of 
a <termref def="dt-union"/> datatype maps each value onto the 
<termref def="dt-canonical-representation"/> of that value obtained 
using the <termref def="dt-canonical-mapping"/> of the first 
<termref def="dt-memberTypes">member type</termref> in whose value space it lies.</p>
<!--* Longer, yes.  Clearer?  More precise? Oh, well. *-->

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

<div3 diff="add" dg="rq120c" id="specialOrdinary">
<head>Special vs. Ordinary Datatypes</head>

<p>Next, we distinguish between <termref def="dt-special"/> 
and <termref def="dt-ordinary"/> datatypes.</p>

<ulist>
<item>
<p><termdef id="rq120c-dt-special" term="special">The <term>special</term>
datatypes are <dtref ref="anySimpleType"/> and 
<dtref ref="anyAtomicType"/>.</termdef> They are special by virtue of their
position in the type hierarchy and by virtue of the fact that unlike
most other datatypes they have <termref def="dt-lexical-mapping">lexical 
mappings</termref> which are
relations, not functions:  the same lexical representation may
correspond to more than one value.</p>
</item>
  
<item diff="add" dg="rq120">
<p><termdef id="rq120c-dt-ordinary" term="ordinary"><term>Ordinary</term>
datatypes are all simple types other than the <termref def="dt-special"/> 
datatypes.</termdef>&nbsp; Only <termref def="dt-ordinary"/> datatypes
may be <termref def="dt-fb-restriction">restricted</termref> by
the use of <termref def="dt-constraining-facet">constraining
facets</termref>.</p>
</item>
</ulist>

</div3>

<!--* !!! this was not marked as deleted in WD of July 2004.
    * When fa1 is split, this is post-wd
    *-->
<div3 id="primitive-vs-derived">
<head><phrase diff="add" dg="rq120o">Special vs. </phrase>Primitive vs.
<phrase diff="del" dg="fa1.z">derived
datatypes</phrase><phrase diff="add" dg="fa1.z"><phrase diff="del" dg="rq120o">Constructed</phrase><phrase diff="add" dg="rq120o">Ordinary</phrase>
Datatypes</phrase></head>

<p diff="del" dg="rq120o">Next, we distinguish between 
<termref def="dt-primitive"/><phrase diff="add" dg="fa1.z"><phrase diff="del" dg="rq120">,</phrase>
<phrase diff="add" dg="rq120">and other <termref def="dt-ordinary"/> 
(</phrase><termref def="dt-constructed"/><phrase diff="add" dg="rq120">)</phrase><phrase diff="del" dg="rq120">,</phrase></phrase><phrase diff="del" dg="rq120"> and
<termref def="dt-derived"/></phrase> datatypes.</p>

<p diff="add" dg="rq120o">Next, we distinguish <termref def="dt-special"/>,
<termref def="dt-primitive"/>, and <termref def="dt-ordinary"/> 
(or <termref def="dt-constructed"/>) datatypes.</p>

<ulist>
<item diff="add" dg="rq120o">
<p><termdef id="dt-special" term="special">The <term>special</term>
datatypes are <dtref ref="anySimpleType"/> and 
<dtref ref="anyAtomicType"/>.</termdef> They are special by virtue of their
position in the type hierarchy<phrase diff="add" dg="lm.rel"> and by virtue of the fact that unlike
most other datatypes they have <termref def="dt-lexical-mapping">lexical 
mappings</termref> which are
relations, not functions:  the same lexical representation may
correspond to more than one value</phrase>.</p>
</item>

<item>
<p><termdef id="dt-primitive" term="primitive"><term>Primitive</term>
datatypes are those 
<phrase diff="add" dg="rq120"><phrase diff="del" dg="rq120o"><termref def="dt-ordinary"/>
</phrase>datatypes</phrase> that are not
<phrase diff="add" dg="rq120o"><termref def="dt-special"/> and are
not</phrase> defined in terms of other datatypes;
they exist <emph>ab initio</emph>.</termdef>
<phrase diff="add" dg="rq120">All <termref def="dt-primitive"/> datatypes have 
<dtref ref="anyAtomicType"/> as their
<termref def="dt-basetype"/>, but their <termref def="dt-value-space">value</termref>
and <termref def="dt-lexical-space">lexical spaces</termref>
must be given in prose; they cannot be described as 
<termref def="dt-fb-restriction">restrictions</termref> of
<dtref ref="anyAtomicType"/> by the application of particular 
<termref def="dt-constraining-facet">constraining facets</termref>.</phrase></p>
</item>

<item diff="add" dg="rq120o">
<p><termdef id="dt-ordinary" term="ordinary"><term>Ordinary</term>
datatypes are all datatypes other than the <termref def="dt-special"/> 
and <termref def="dt-primitive"/> datatypes.</termdef>&nbsp;
<!--* 'dt-constructed' used to be here. ... *-->
<termref def="dt-ordinary">Ordinary</termref> datatypes
can be understood fully in terms of their <compref ref="std"/> and 
the properties of the datatypes from which they are &constructed;.</p>
</item>

<item diff="del" dg="rq120o">
<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="del-pre120-dt-constructed" term="constructed"><term>Constructed</term> 
datatypes are 
those <phrase diff="add" dg="rq120"><termref def="dt-ordinary"/> datatypes</phrase> 
that are defined in terms of other 
datatypes<phrase diff="add" dg="rq120">, either by restricting 
the <termref def="dt-value-space"/> or <termref def="dt-lexical-space"/> 
of a base type using zero or more 
<termref def="dt-constraining-facet">constraining facets</termref>, or by using
a <termref def="dt-list"/> or <termref def="dt-union"/>
constructor</phrase>.</termdef>  
<termdef diff="add" dg="rq120" id="dt-onp" term="ordinary non-primitive"><termref def="dt-constructed">Constructed</termref>
datatypes may also be referred to as <term>ordinary non-primitive</term>
datatypes.</termdef></p>
</item>
</ulist>

<p>For example, in this specification, <dtref ref="float"/> is a 
<phrase diff="add" dg="rq120"><termref def="dt-primitive"/> datatype based on 
a </phrase>well-defined mathematical concept
<!-- find example other than float -->
<phrase diff="del" dg="rq120">that cannot be</phrase><phrase diff="add" dg="rq120">and
not</phrase> 
defined in terms of other datatypes, while<phrase diff="del" dg="rq120"> a</phrase>
<dtref ref="integer"/> is <phrase diff="del" dg="rq120">a special case
of</phrase><phrase diff="add" dg="rq120"><termref def="dt-constructed"/>
from</phrase> 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>

<ednote diff="add" dg="rq120">
<edtext>The definition of anySimpleType has not been deleted, only
moved to a more appropriate location.</edtext>
</ednote>
  
<p diff="del" dg="rq120"><termdef id="del-del-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>.&nbsp;
<phrase diff="del" dg="aatg"><term>anySimpleType</term> can be
considered as the <termref def="dt-basetype"/> of all <termref def="dt-primitive"/>
datatypes.&nbsp; </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 <termref diff="add" dg="rq120c" def="dt-ordinary"/> datatypes defined 
by this specification fall into 
<phrase diff="del" dg="rq120o">both
</phrase> the <phrase diff="add" dg="rq120o">categories
<termref def="dt-special"/>,</phrase>
<termref def="dt-primitive"/><phrase diff="add" dg="rq120o">,</phrase> and 
<termref diff="del" dg="rq120" def="dt-derived"/><phrase diff="del" dg="rq120o"><termref diff="add" dg="rq120" def="dt-constructed"/>
categories</phrase><phrase diff="add" dg="rq120o"><termref def="dt-ordinary"/></phrase>.&nbsp; It 
is felt that a judiciously chosen set of
<termref def="dt-primitive"/> datatypes will serve <phrase diff="del" dg="rq120">the 
widest possible</phrase><phrase diff="add" dg="rq120">a wide</phrase> audience by 
providing a set of convenient datatypes that
can be used as is, as well as providing a rich enough base from
which <phrase diff="del" dg="rq120">the</phrase><phrase diff="add" dg="rq120">a 
large</phrase> variety of datatypes needed by schema designers can be
&constructed.x;.</p>

<p diff="del" dg="rq120">
In the example above, <dtref ref="integer"/> is <termref def="dt-derived"/>
from <dtref ref="decimal"/>.
</p>
<!--* MSM reverted proposed change from 'derived' to 'constructed'.
Both are true as the terms are now defined, but for definitions which
derive by restriction we elsewhere prefer the term 'derived'. 
MSM then deleted it on the grounds that in the last three days alone
the paragraph has caused more trouble than it's worth. *-->

<note>
<p>A datatype which is <termref def="dt-primitive"/> in this specification
need not be a <unusual>primitive</unusual>
  datatype in any programming language used to
implement this specification.&nbsp; Likewise, a datatype which is
<termref diff="del" dg="rq120" def="dt-derived"/><termref diff="add" dg="rq120" def="dt-constructed"/>
in this specification <phrase diff="add" dg="rq120">from
some other datatype</phrase> need not be a <unusual>derived</unusual> 
datatype in any programming language used to implement
this specification.</p>
</note>

<!-- We just said what follows above; why repeat it?  We should get rid of
     the internal diffs; I don't want to deal with it now. -->
<p diff="del" dg="rq120">As described in more detail in <specref ref="xr-defn"/>,
each &user-defined.x; datatype <termref def="dt-must"/> be 
<phrase diff="del" dg="rq120">defined in terms
of</phrase><phrase diff="add" dg="rq120"><termref def="dt-constructed"/>
from</phrase> 
another datatype in one of three ways: 1) by assigning
<phrase diff="del" dg="rq120"><termref def="dt-constraining-facet"/>s which serve 
to</phrase><phrase diff="add" dg="rq120">zero or more 
<termref def="dt-constraining-facet">constraining facets</termref> which 
may</phrase> <emph>restrict</emph> the
<termref def="dt-value-space"/><phrase diff="add" dg="rq120"> or
<termref def="dt-lexical-space"/> (or both)</phrase> of the &user-defined.x;
datatype to <phrase diff="del" dg="rq120">a subset of 
that</phrase><phrase diff="add" dg="rq120">subsets of those</phrase> 
of the <termref def="dt-basetype"/><phrase diff="del" dg="rq120">;
</phrase><phrase diff="add" dg="rq120">, </phrase> 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"/><phrase diff="del" dg="rq120">;
</phrase><phrase diff="add" dg="rq120">,
</phrase> or 3) by creating a <termref def="dt-union"/>
datatype whose <termref def="dt-value-space"/> consists of the union of the
<phrase diff="del" dg="rq120"><termref def="dt-value-space"/>s
</phrase><phrase diff="add" dg="rq120"><termref def="dt-value-space">value spaces</termref>
</phrase> of its <termref def="dt-memberTypes"/>.</p>

<div4 role="1.0" id="restriction">
<head><phrase diff="del" dg="rq120">Derived by
restriction</phrase><phrase diff="add" dg="rq120">Facet-based Restriction</phrase></head>

<!--* 2006-01-08 del_dt-restriction does not work as ID here, because
    * it causes an ID of 'restriction' to be emitted in the HTML,
    * when dg rq120 is shown coloured.
    * del-dt-restriction doesn't work either because it causes an
    * ID of dt-restriction to be emitted.  Both are duplicate IDs.
    * This section is processed by dg.xsl in id-cleanup mode because
    * diff group trm1 (not approved) proposed to delete it, and has
    * show="pre".
    * A word to the wise.
    *-->
<p diff="del" dg="rq120"><termdef id="del-del-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 diff="add" dg="rq120"><termdef id="dt-fb-restriction" term="facet-based restriction">A 
datatype is defined by <term>facet-based restriction</term> of another datatype
(its <termref def="dt-basetype"/>),
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 the
<termref def="dt-basetype"/>.</termdef>
The <termref def="dt-basetype"/> of a <termref def="dt-fb-restriction"/>
&must; be a &primitive; or &ordinary; datatype.</p>
<!--* 
On the other hand, all datatypes except <dtref ref="anySimpleType"/>
are <termref def="dt-derived"/> by <term>restriction</term>, since no means
exists to expand the <termref def="dt-lexical-space"/> or
<termref def="dt-lexical-space"/> of a <termref def="dt-derived"/> datatype
over that of its <termref def="dt-basetype"/>.</termdef>&nbsp; All
<termref def="dt-ordinary"/> datatypes not explicitly <termref def="dt-constructed"/>
as a <termref def="dt-list"/> or <termref def="dt-union"/> are
<termref def="dt-constructed"/> as
<termref def="dt-restriction">restrictions</termref>.&nbsp;
Datatypes <termref def="dt-constructed"/> as
<termref def="dt-restriction">restrictions</termref>
do <emph>not</emph> have either <termref def="dt-special"/>
datatype as their <termref def="dt-basetype"/></p>
*-->

<p diff="del" dg="rq120"><termdef id="del-del1-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>

<!--* <termdef id="trm1-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> *-->

<!-- NO NO NO !!!  This definition says derivation by restriction is
     the same as derivation, period.  But elsewhere derivation by restriction
     is used to mean the same as derivation from ordinary (or primitive).
     This *must* be fixed.  I don't know how, offhand, but this is not
     acceptable. -->
<!--* dp deletes the following *-->

<!-- FOLLOWING STATEMENT IS FALSE.  derivation by restriction is
     by definition just derivation, and anySimpleType is not
     derived from itself. -->
<!--* Nice catch.  Let's make it true, then. *-->
<!--* dp deletes the following paragraph *-->
<!--*  *-->
<!--* *-->
</div4>

<div4 id="list">
<head><phrase diff="del" dg="rq120">Derived by 
list</phrase><phrase diff="add" dg="rq120">Construction by List</phrase></head>

<p>A <termref def="dt-list"/> datatype can be &constructed.x;
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"/>.
<phrase diff="add" dg="rq120">Datatypes so <termref def="dt-constructed"/>
have <dtref ref="anySimpleType"/> as their <termref def="dt-basetype"/>.
Note that since the &value_space; and &lexical_space; of any &list; 
datatype are necessarily subsets of the &value_space; and &lexical_space; of
<dtref ref="anySimpleType"/>, any datatype &constructed; as a &list; is a 
&restriction; of its base type.
</phrase></p>
</div4>

<div4 id="union">
<head><phrase diff="del" dg="rq120">Derived by
union</phrase><phrase diff="add" dg="rq120">Construction by Union</phrase></head>

<p>One datatype can be &constructed.x; from one or more 
<phrase diff="add" dg="rq120fix">other </phrase>datatypes
<phrase diff="add" dg="rq120fix">(its <termref def="dt-memberTypes"/>) </phrase>by
<phrase diff="del" dg="rq120"><termref def="dt-union"/>ing</phrase><phrase diff="add" dg="rq120">unioning</phrase>
their <phrase diff="del" dg="b2044"><termref def="dt-value-space"/>s</phrase><phrase diff="add" dg="b2044">&lexical_mappings;</phrase>
and<phrase diff="del" dg="rq120fix">, consequently, their</phrase>
<phrase diff="add" dg="b2044">&value_spaces; and</phrase>
<phrase diff="del" dg="rq120"><termref def="dt-lexical-space"/>s</phrase><phrase diff="add" dg="rq120"><termref def="dt-lexical-space">lexical
spaces</termref></phrase>.&nbsp;
<phrase diff="add" dg="rq120">Datatypes so <termref def="dt-constructed"/>
also have <dtref ref="anySimpleType"/> as their <termref def="dt-basetype"/>.
Note that since the &value_space; and &lexical_space; of any &union; 
datatype are necessarily subsets of the &value_space; and &lexical_space; of
<dtref ref="anySimpleType"/>, any datatype &constructed; as a &union; is a 
&restriction; of its base type.
</phrase></p>

</div4>
</div3>

<div3 diff="add" dg="rq120" id="derivation">
<head>Definition, Derivation, Restriction, and Construction</head>

<p>Definition, derivation, restriction, and construction
are conceptually distinct, although in practice
they are frequently performed by the same mechanisms.</p>

<p>By <mention>definition</mention> is meant the explicit
identification of the relevant properties of a datatype,
in particular its
<termref def="dt-value-space"/>,
<termref def="dt-lexical-space"/>, and
<termref def="dt-lexical-mapping"/>. 
</p>

<p>The properties of the <termref def="dt-special"/> and 
<termref def="dt-primitive"/> datatypes are defined by this 
specification.  A <compref ref="std"/> is present for each of these 
datatypes in every valid schema; it serves as a representation of the
datatype, but by itself it does not capture all the relevant 
information and does not suffice (without knowledge
of this specification) to <emph>define</emph> the datatype.</p>

<p>For all other datatypes, a <compref ref="std"/> does suffice.
The properties of an &ordinary.np; datatype can be inferred
from the datatype's <compref ref="std"/> and the properties of
the <termref def="dt-basetype"/>, <termref def="dt-itemType"/>
if any, and <termref def="dt-memberTypes"/> if any.
All &ordinary.np; datatypes can be defined in this way.</p>

<p>By <mention>derivation</mention> is meant the relation of
a datatype to its <termref def="dt-basetype"/>, or to the
<termref def="dt-basetype"/> of its <termref def="dt-basetype"/>,
and so on.</p>


<p><termdef id="dt-basetype" term="base type">Every datatype 
is associated with another datatype, its <term>base type</term>. 
<term>Base types</term> can be <termref def="dt-special"/>, 
<termref def="dt-primitive"/>, or 
<termref diff="del" dg="rq120o" def="dt-constructed"/><termref diff="add" dg="rq120o" def="dt-ordinary"/>.
</termdef>
</p>
<!--* ??? revisit; MSM leans toward keeping the definition of base type
    * where it was ??? *-->
<p><termdef id="dt-immediately-derived" term="derived">A datatype 
<var>T</var> is <term>immediately derived</term> from another datatype 
<var>X</var> if and only if <var>X</var> is the 
<termref def="dt-basetype"/> of <var>T</var>.</termdef>
</p>

<p>
More generally, 
<termdef id="dt-derived" term="derived">A datatype <var>R</var> 
is <term>derived</term> from another 
datatype <var>B</var> if and only if one of the following is true:
</termdef>
 <ulist>
<item>
<p><var>B</var> is the <termref def="dt-basetype"/> 
of <var>R</var>.
</p>
</item>
<item>
<p>There is some datatype <var>X</var>
such that <var>X</var> is the <termref def="dt-basetype"/> 
of <var>R</var>, and <var>X</var> is derived from
<var>B</var>.</p>
</item>
</ulist>
</p>
<!--* 
Since every <compref ref="std"/> has a <termref def="dt-basetype"/>,
it is a consequence of this definition fhat <emph>every</emph>
datatype defined by a <compref ref="std"/> is a 
<termref def="dt-derived"/> datatype.</p>
*-->
<p>It is a consequence of these definitions that
every datatype other than <dtref ref="anySimpleType"/> is 
<termref def="dt-derived"/> from <dtref ref="anySimpleType"/>.</p>

<p>Since each datatype has exactly one <termref def="dt-basetype"/>,
and every datatype is <termref def="dt-derived"/> directly or
indirectly from <dtref ref="anySimpleType"/>, it follows that
the <termref def="dt-basetype"/> relation arranges all
simple types into a tree structure, which is conventionally
referred to as the <emph>derivation hierarchy</emph>.</p>

<p>By <mention>restriction</mention> is meant the definition
of a datatype whose &value_space; and &lexical_space; are 
subsets of those of its <termref def="dt-basetype"/>.</p>

<p diff="add" dg="rq120">Formally,
<termdef id="dt-restriction" term="restriction">A datatype <var>R</var> 
is a <term>restriction</term> of another 
datatype <var>B</var> when</termdef>
 <ulist>
<item>
<p>the &value_space; of <var>R</var> is a subset of the &value_space;
of <var>B</var>, and 
</p>
</item>
<item>
<p>the &lexical_space; of <var>R</var> is a subset of the 
<phrase diff="del" dg="rec12-main">and </phrase>&lexical_space; of <var>B</var>.
</p>
</item>
</ulist>
</p>

<p>
Note that all three forms of datatype &construction; produce 
<termref def="dt-restriction">restrictions</termref> of the &basetype;:
<termref def="dt-fb-restriction"/> does so by means of 
<termref def="dt-constraining-facet">constraining facets</termref>, 
while &construction; by &list; or &union; does so because those 
<termref def="dt-constructed">constructions</termref> take 
<dtref ref="anySimpleType"/> as the &basetype;. It follows that all
datatypes are <termref def="dt-restriction">restrictions</termref> 
of <dtref ref="anySimpleType"/>.
This specification provides no means by which a datatype may be
defined so as to have a larger &lexical_space; or &value_space; 
than its &basetype;.
</p>

<!--* <p diff="add" dg="rec12-tt">[RQ-141b]</p> *-->
<p diff="add" dg="rq120"><phrase diff="del" dg="rec12-main">It is a 
consequence of this definition that
every datatype 
is a <termref def="dt-restriction"/> 
of <dtref ref="anySimpleType"/>.</phrase></p>

<p>By <mention>construction</mention> is meant the creation of a
datatype by defining it in terms of another.</p>

<!--* 
<p>Every definition of a datatype
as a <termref def="dt-fb-restriction"/> of another datatype,
every use of <termref def="dt-list"/>
<termref def="dt-constructed">construction</termref> to define a datatype 
in terms of a particular <termref def="dt-itemType"/>,
every use of <termref def="dt-union"/>
<termref def="dt-constructed">construction</termref> to define a datatype 
in terms of a particular set of <termref def="dt-memberTypes"/>,
may be said to <emph>construct</emph> a datatype.</p>
*-->
<p>
<termdef id="dt-constructed" term="constructed">All
<termref def="dt-ordinary"/> datatypes are defined in terms of, or
<term>constructed</term> from, other datatypes, either by 
<termref def="dt-fb-restriction">restricting</termref> the 
<termref def="dt-value-space"/> or <termref def="dt-lexical-space"/> 
of a <termref def="dt-basetype"/> using zero or more
<termref def="dt-constraining-facet">constraining facets</termref>
or by specifying the new datatype as a &list; of items of some
<termref def="dt-itemType"/>,
or by defining it as a &union; of some specified 
sequence of <termref def="dt-memberTypes"/>.</termdef>
These three forms of <termref def="dt-constructed">construction</termref>
are often called <quote><termref def="dt-fb-restriction"></termref></quote>,
<quote><termref def="dt-constructed">construction</termref> 
by &list;</quote>, and <quote>&construction; by 
&union;</quote>, respectively.
Datatypes so constructed may be understood fully (for
purposes of a type system) in terms of (a) the properties
of the datatype(s) from which they are constructed, and
(b) their <compref ref="std"/>.  This distinguishes
<phrase diff="del" dg="rq120o">datatypes so constructed
</phrase><phrase diff="add" dg="rq120o"><termref def="dt-ordinary"/>
datatypes</phrase>
from the <termref def="dt-special"/> and 
<termref def="dt-primitive"/> datatypes, which can be understood 
only in the light of documentation (namely, their descriptions 
elsewhere in this specification).
<phrase diff="add" dg="rq120o">All <termref def="dt-ordinary"/>
datatypes are <termref def="dt-constructed"/>, and all
<termref def="dt-constructed"/> datatypes are 
<termref def="dt-ordinary"/>.</phrase>
</p>

</div3>

<div3 role="1.0" id="built-in-vs-user-derived">
<head>Built-in vs. User-<phrase diff="del" dg="rq120">Derived</phrase><phrase diff="add" dg="rq120">Defined</phrase> 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<phrase diff="del" dg="rq120">,
and</phrase><phrase diff="add" dg="rq120">; they</phrase> can 
be <phrase diff="del" dg="rq120">either</phrase> 
<phrase diff="add" dg="rq120"><termref def="dt-special"/>,</phrase>
<termref def="dt-primitive"/><phrase diff="add" dg="rq120">,</phrase> or
&ordinary.d.onp;<phrase diff="add" dg="rq120"> datatypes
</phrase>.
</termdef>
</p>
</item>
<item>
<p diff="del" dg="rq120">
<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>
<p diff="add" dg="rq120">
<termdef id="dt-user-defined" term="user-defined">
<term>User-defined</term> datatypes are those 
datatypes that are defined by individual schema designers.
</termdef>
</p>
</item>
</ulist>
<p>
Conceptually there is no difference between the &ordinary.np;
<termref def="dt-built-in"/> <termref diff="del" dg="rq120" def="dt-derived"/> 
datatypes included in this specification and the &user-defined.x;
datatypes which will be created by individual schema designers.
The <termref def="dt-built-in"/> &constructed.x; 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
<phrase diff="del" dg="rq120"><unusual>reinventing</unusual></phrase><phrase diff="add" dg="rq120">reinventing</phrase> them.&nbsp; Furthermore, including these
&constructed.x; 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 
<phrase diff="del" dg="rq120"><unusual>built-in</unusual></phrase><phrase diff="add" dg="rq120">built-in</phrase>
datatype in any programming language used
to implement this specification.&nbsp; Likewise, a datatype which is
&user-defined.x; in this specification need not be a 
<phrase diff="del" dg="rq120"><unusual>user-derived</unusual></phrase><phrase diff="add" dg="rq120">user-defined</phrase> 
datatype in any programming language used to
implement this specification.
</p>
</note>
</div3>
</div2>


</div1>

<div1 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="rq120">Built-in datatypes</phrase><phrase diff="add" dg="rq120">Built-in Datatypes and Their Definitions</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 <phrase diff="del" dg="rq120">(both
<termref def="dt-primitive"/> and
<termref def="dt-derived"/>)</phrase> can be uniquely addressed via a
URI Reference constructed as follows:
<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>

<p>For example, to address the <dtref ref="int"/> datatype, the URI is:
<ulist>
<item><p><code>http://www.w3.org/2001/XMLSchema#int</code></p></item>
</ulist>
</p>

<p>Additionally, each facet definition element can be uniquely
addressed via a URI constructed as follows:
<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>

<p>For example, to address the maxInclusive facet, the URI is:
<ulist>
<item><p><code>http://www.w3.org/2001/XMLSchema#maxInclusive</code></p></item>
</ulist>
</p>

<!--* <p diff="add" dg="rec12-tt">[RQ-141b]</p> *-->
<p>Additionally, each facet usage in a built-in <phrase diff="del" dg="rec12-main">datatype
definition</phrase>
<phrase diff="add" dg="rec12-main"><compref ref="std"/></phrase>
can be uniquely addressed via a URI constructed as follows:
<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 
<phrase diff="del" dg="rec12-main">datatype</phrase><phrase diff="add" dg="rec12-main"><compref ref="std"/></phrase>, followed
by a period (".") followed by the name of the facet</p></item>
</olist>
</p>

<p>For example, to address the usage of the maxInclusive facet in
the definition of int, the URI is:
<ulist>
<item><p><code>http://www.w3.org/2001/XMLSchema#int.maxInclusive</code></p></item>
</ulist>
</p>

<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 <phrase diff="add" dg="dup-2214">non-<termref def="dt-special"/></phrase> <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 diff="del" dg="rq120">
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 diff="add" dg="rq120">
<phrase diff="del" dg="dup-2214">This applies to all <termref def="dt-built-in"/> datatypes,
whether <termref def="dt-special"/>,
<termref def="dt-primitive"/>, or
&ordinary.np;.</phrase></p>
<note diff="add" dg="dup-2214">
  <p>The use of the <code>XMLSchema-datatypes</code> namespace and the definitions therein are deprecated as of
XML Schema 1.1.</p>
 </note>
<p>
Each &user-defined.x; datatype is also associated with a
unique namespace.&nbsp; However, &user-defined.x; 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="rq120" diff="add">
<head>Special Built-in Datatypes</head>

<p>The two datatypes at the root of the hierarchy of simple
types are <dtref ref="anySimpleType"/> and <dtref ref="anyAtomicType"/>.</p>

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

<p><termdef id="dt-anySimpleType" term="anySimpleType" role="local">
The definition of <dtref ref="anySimpleType"/>
is a special &restriction; of
<dtref ref="anyType"/>.&nbsp;
<term>anySimpleType</term> has an unconstrained
<termref def="dt-lexical-space"/><phrase diff="add" dg="rq120">,</phrase>
<phrase diff="del" dg="rq120">and </phrase>a
<termref def="dt-value-space"/> consisting of the union of the
<termref def="dt-value-space">value spaces</termref> 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<phrase diff="add" dg="lm.rel">,
and a <termref def="dt-lexical-mapping">lexical mapping</termref> which
is the union of the lexical mappings of all 
<phrase diff="add" dg="rq120o"><termref def="dt-primitive"/> and
</phrase><termref def="dt-ordinary"/> 
simple types</phrase>.</termdef></p>

<!--* <p diff="add" dg="rec12-tt">[RQ-141b]</p> *-->
<p diff="add" dg="rec12-main">For further details of <dtref ref="anySimpleType"/>
and its representation as a <compref ref="std"/>, see
<specref ref="builtin-stds"/>.</p>

<div4 diff="del" dg="rec12-main"><head>Simple Type Definition of anySimpleType</head>

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

<!--* <ednote><edtext>The editors are still working on a mechanism to allow
'simple type definition' in text and 'Simple Type Definition' in titles
to both be autogenerated.</edtext></ednote> *-->

<schemaComp id="anySimpleType-def_old">
<head>Simple type definition of <code>anySimpleType</code></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>
<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 id="ast_radix_omnium_old">The 
<compref ref="std"/> of <dtref ref="anySimpleType"/>
is the root of the <compref ref="std"/>
hierarchy, and as such mediates between the other
<compref ref="std"/>s,
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"/>, which is
<emph>its</emph> <propref comp="std" prop="base type definition"/>.</p>

</div4>
<div4 diff="add" dg="rq21-specials-1909">
<head>Value space</head>
<p>The &value_space; of <dtref ref="anySimpleType"/> is the union of the
<termref def="dt-value-space">value spaces</termref> of all the
<termref def="dt-primitive"/> datatypes defined here, and of all sets
of lists formed from the members of the <termref def="dt-primitive"/>
datatypes.</p>
<p>At least in theory, the &value_space; of <dtref ref="anySimpleType"/> 
also includes all values of anything that might in future be added
to the set of <termref def="dt-primitive"/> datatypes, as well
as lists including those values.  That is,
users of the datatypes defined here &shouldnot; assume that 
the &value_space; of <dtref ref="anySimpleType"/> is limited to
values in the <termref def="dt-primitive"/> datatypes defined in
this version of this specification.  They might be values from
other datatypes not defined here.
</p>
</div4>
<div4 diff="add" dg="rq21-specials-1909">
<head>Lexical mapping</head>

<p>The &lexical_space; of <dtref ref="anySimpleType"/> is the set of
all 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"/>.  This is equivalent to the union of the 
<termref def="dt-lexical-space">lexical spaces</termref> of all 
&primitive; datatypes.
</p>

<p>The &lexical_mapping; of <dtref ref="anySimpleType"/> is the union
of the <termref def="dt-lexical-mapping">lexical mappings</termref> of
all <termref def="dt-primitive"/> datatypes and all list datatypes.
It will be noted that this mapping is not a function: a given
&literal; may map to one value or to several values of different
&primitive; datatypes, and it may be indeterminate which value is to
be preferred in a particular context.  When the datatypes defined here
are used in the context of <bibref ref="structural-schemas"/>, the
<att>xsi:type</att> attribute defined by that specification in section
<xspecref href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.html#xsi_type">xsi:type</xspecref> can be used
to indicate which value a &literal; which is the content of an element
should map to.  In other contexts, other rules (such as type coercion
rules) may be employed to determine which value is to be used.</p>

</div4>

<div4 diff="add" dg="rq21-specials-1909">
<head>Facets</head>
<p>When a new datatype is defined 
by <termref def="dt-fb-restriction"/>,
<dtref ref="anySimpleType"/> &mustnot; be used
as the <termref def="dt-basetype"/>.
So no 
<termref def="dt-constraining-facet">constraining facets</termref> are
directly applicable to <dtref ref="anySimpleType"/>.
</p>

</div4>
</div3>

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

<p><termdef id="dt-anyAtomicType" term="anyAtomicType" role="local">
<dtref ref="anyAtomicType"/>
is a special &restriction; of <dtref ref="anySimpleType"/>.
The <termref def="dt-value-space">value</termref>
and <termref def="dt-lexical-space">lexical spaces</termref> 
of <term>anyAtomicType</term> are the unions of the 
<termref def="dt-value-space">value</termref>
and <termref def="dt-lexical-space">lexical spaces</termref>
of all the <termref def="dt-primitive"/> datatypes, and
<term>anyAtomicType</term> is their <termref def="dt-basetype"/>.
</termdef>
</p>

<!--* <p diff="add" dg="rec12-tt">[RQ-141b]</p> *-->
<p diff="add" dg="rec12-main">For further details of <dtref ref="anyAtomicType"/>
and its representation as a <compref ref="std"/>, see
<specref ref="builtin-stds"/>.</p>

<div4 diff="del" dg="rec12-main"><head>Simple Type Definition of anyAtomicType</head>

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

<schemaComp id="anyAtomicType-def-del">
<head>Simple type definition of <code>anyAtomicType</code></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">anySimpleType</pvpair>
<pvpair comp="std" prop="final">The empty set</pvpair>
<pvpair comp="std" prop="variety"><pt diff="del" dg="rec12-main">absent</pt><pt diff="add" dg="rec12-main">atomic</pt></pvpair>
<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>

</div4>
<div4 diff="add" dg="rq21-specials-1909">
<head>Value space</head>
<p>The &value_space; of <dtref ref="anyAtomicType"/> is the union of the
<termref def="dt-value-space">value spaces</termref> of all the
<termref def="dt-primitive"/> datatypes defined here.</p>
<p>At least in theory, the &value_space; of <dtref ref="anyAtomicType"/> 
also includes all values of anything that might in future be added
to the set of <termref def="dt-primitive"/> datatypes.  That is,
users of the datatypes defined here &shouldnot; assume that 
the &value_space; of <dtref ref="anyAtomicType"/> is limited to
values in the <termref def="dt-primitive"/> datatypes defined in
this version of this specification.  They might be values from
other datatypes not defined here.
</p>
</div4>
<div4 diff="add" dg="rq21-specials-1909">
<head>Lexical mapping</head>

<p>The &lexical_space; of <dtref ref="anyAtomicType"/> is the set of
all 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"/>.  This is equivalent to the union of the 
<termref def="dt-lexical-space">lexical spaces</termref> of all 
&primitive; datatypes.
</p>

<p>The &lexical_mapping; of <dtref ref="anyAtomicType"/> is the union
of the <termref def="dt-lexical-mapping">lexical mappings</termref> of
all <termref def="dt-primitive"/> datatypes.
It will be noted that this mapping is not a function: a given
&literal; may map to one value or to several values of different
&primitive; datatypes, and it may be indeterminate which value is to
be preferred in a particular context.  When the datatypes defined here
are used in the context of <bibref ref="structural-schemas"/>, the
<att>xsi:type</att> attribute defined by that specification in section
<xspecref href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.html#xsi_type">xsi:type</xspecref> can be used
to indicate which value a &literal; which is the content of an element
should map to.  In other contexts, other rules (such as type coercion
rules) may be employed to determine which value is to be used.</p>

</div4>

<div4 diff="add" dg="rq21-specials-1909">
<head>Facets</head>
<p>When a new datatype is defined 
by <termref def="dt-fb-restriction"/>,
<dtref ref="anyAtomicType"/> &mustnot; be used
as the <termref def="dt-basetype"/>.
So no 
<termref def="dt-constraining-facet">constraining facets</termref> are
directly applicable to <dtref ref="anyAtomicType"/>.
</p>

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

<div2 role="1.0" id="built-in-primitive-datatypes">
<head>Primitive Datatypes</head>
<p>
The <termref def="dt-primitive"/> datatypes defined by this specification
are described below.&nbsp; For each datatype, the
<termref def="dt-value-space"/> 
<phrase diff="add" dg="b1902amend">is described;
</phrase><phrase diff="del" dg="b1902amend">and
</phrase><phrase diff="add" dg="b1902amend">the
</phrase><termref def="dt-lexical-space"/>
<phrase diff="del" dg="b1902amend">are</phrase><phrase diff="add" dg="b1902amend">is</phrase>
defined<phrase diff="del" dg="b1902amend">,</phrase> 
<phrase diff="add" dg="b1902amend">using
an extended Backus Naur Format grammar 
(and in most cases also a regular expression using the
regular expression language of 
<specref ref="regexs"/>);</phrase>
<termref def="dt-constraining-facet"/>s which apply
to the datatype are listed<phrase diff="add" dg="b1902amend">;</phrase> 
and any datatypes 
<termref def="dt-derived" diff="del" dg="rq120"/><termref def="dt-constructed" dg="rq120" diff="add"/>
from this datatype are specified.
</p>
<p>
<phrase diff="del" dg="rq120"><termref def="dt-primitive"/></phrase><phrase diff="add" dg="rq120"><termref def="dt-primitive">Primitive</termref></phrase> 
datatypes can only be added by revisions
to this specification.
</p>

<div3 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.
    *-->
<!-- And of course that insures it'll never get done.  :-(  -->
<!--* Up to you.  It's not hard to do the change for all types,
    * if one wants to do the change.
    *-->
<head>string</head>

<!--* Hmm.  Should the rq2-string deletion below really be labeled
    * rq21-string-hack?  The text is moved, not changed. *-->
<p><termdef id="dt-string" term="string" role="local">The <term>string</term> datatype
represents character strings in XML.<phrase diff="del" dg="rq21-string">&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.</phrase>
</termdef></p>

<note>
<p>Many human languages have writing systems that require
child elements for control of aspects such as bidirectional formatting 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"/>).&nbsp;
Thus, <term diff="del" dg="rq21-string">string</term><dtref ref="string" diff="add" dg="rq21-string"/>, 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 diff="del" dg="rq21-string-hack">
<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 diff="add" dg="rq21-string-hack"><head diff="add" dg="rq21-string">Value Space</head>
<!--* MSM munges the diff markup to avoid showing the old text 
    * which follows as old text.  rq21-string-hack should be rejected when
    * rq21-string is rejected, accepted when it is accepted.  But when
    * rq21-string is shown in color, rq21-string-hack should be accepted silently.
    *-->
<p>The <termref def="dt-value-space"/>
of <dtref ref="string"/> 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"/>.
<!--* herein called simply <quote>&strings;</quote>.&nbsp; *-->
<!--* MSM finds 'herein' awkward, and our usage of the term 'character
    * string' includes a lot of places where we do not want to be
    * making the commitment or claim that the things in question are to be
    * regarded as *values* in the value space of the string type.
    * Not because there is some magic distinction (we are talking
    * in any case about sequences of UCS characters), but because
    * our system neither relies on nor provides tools to exploit
    * the identity of the value and lexical spaces of xsd:string
    * with the set of literals that might represent values in
    * any arbitrary simple type.
    *-->
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 (UCS) code point, which is an integer.</p>

<p diff="add" dg="b1902amend">Equality for <dtref ref="string"/> is
identity.  No order is prescribed.</p>

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

<div4 id="string-lexical-mapping" diff="add" dg="rq21-string">
<head>Lexical Mapping</head>

<p>The &lexical_space; of <dtref ref="string"/> 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"/>.

<!--* <ednote>
<edtext>An alternative design would (a) change this
definition and that of the value space to read <quote>The xxx space of
<dtref ref="string"/> is the set of finite-length sequences of UCS
characters</quote> (i.e. drop the restriction to characters matching
the Char production of XML, thus aligning with the Infoset spec);
(b) add a Note saying <quote>When literals of
type <dtref ref="string"/> stem from an XML document or information
set, all characters in the string will match the <xnt href="&xmlspec;#NT-Char">Char</xnt> production of <bibref ref="XML"/>; not all UCS characters are allowed by the XML spec</quote>;
and
(c) change the initial description of the type to read
<quote>The string datatype represents strings of characters.</quote>
</edtext>
</ednote> *-->

<defset role="prod"><head>Lexical Space</head>
<prod id="nt-stringRep">
<lhs>stringRep</lhs>
<rhs><xnt href="&xmlspec;#NT-Char">Char</xnt>*&nbsp; <com>(as defined in <bibref ref="XML"/>)</com></rhs>
</prod>
</defset>

<phrase diff="del" dg="b1902amend">This is equivalent 
to the regular expression <string>(\s|\S)*</string>, which
allows zero or more occurrences of any character in class <code>s</code>
or not in class <code>s</code>, i.e. any spacing or non-spacing character.&nbsp;
(It is also equivalent to <string>(\c|\C)*</string> or to any similar
expression created using any regular expression and its complement.)
Note that the regular expression <string>.*</string> does not match
all strings, since <string>.</string> does not match newline or linefeed.
</phrase></p>

<p diff="del" dg="rq21-lexmaps">The lexical mapping and canonical mapping 
for <dtref ref="string"/> are each the identity function:
<defsetsum ref="defs-stringLexmap"/>
<defsetsum ref="defs-stringCanmap"/>
</p>
<p diff="add" dg="rq21-lexmaps">The lexical mapping 
for <dtref ref="string"/> is <pfref ref="f-stringLexmap"/>, and
the canonical mapping is <pfref ref="f-stringCanmap"/>;
each is a subset of the identity function.
</p>

</div4>

<div4 role="1.0" id="string-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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 id="boolean">
<head>boolean</head>

<p><termdef id="dt-boolean" term="boolean" role="local"><term>boolean</term>
<phrase diff="del" dg="rq21-boolean">has the
<termref def="dt-value-space"/> required to support the mathematical
concept of binary-valued logic: {true,
false}</phrase><phrase diff="add" dg="rq21-boolean">represents the 
values of two-valued logic</phrase>.</termdef></p>

<div4 diff="add" dg="rq21-boolean"><head>Value Space</head>

<p><dtref ref="boolean"/> has the <termref def="dt-value-space"/> of
two-valued logic:&nbsp; {<pt>true</pt>, <pt>false</pt>}.</p>
</div4>

<div4 id="boolean-lexical-representation" diff="del" dg="rq21-boolean">
<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 id="boolean-canonical-representation" diff="del" dg="rq21-boolean">
<head>Canonical representation</head>
<p>The canonical representation for <term>boolean</term> is the set of
literals {true, false}.</p>
</div4>

<div4 id="boolean-lexical-mapping" diff="add" dg="rq21-boolean">
<head>Lexical Mapping</head>

<p><dtref ref="boolean"/>'s lexical space is a set of four &strings;:

<defset role="prod"><head>Lexical Space</head>
<prod id="nt-booleanRep">
<lhs>booleanRep</lhs>
<rhs><string>true</string>&nbsp;| <string>false</string>&nbsp;|
<string>1</string>&nbsp;| <string>0</string></rhs>
</prod>
</defset>
<!--* This is equivalent to the regular expression <string>true|false|0|1</string>. *-->
</p>

<p diff="del" dg="rq21-lexmaps">The lexical mapping and canonical mapping 
for <dtref ref="boolean"/> are the following functions:

<defsetsum ref="defs-booleanLexmap"/>
<defsetsum ref="defs-booleanCanmap"/>
</p>
<p diff="add" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="boolean"/> is <pfref ref="f-booleanLexmap"/>;
the canonical mapping is <pfref ref="f-booleanCanmap"/>.
</p>

</div4>

<div4 role="1.0" id="boolean-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>
<facets/>
</div4>
</div3>

<div3 id="decimal">
<head>&Odec;</head>

<issue id="RQ-150i" role="1.1" diff="del" dg="decfix">
<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
<phrase diff="del" dg="decfix">a</phrase><phrase diff="add" dg="decfix">that</phrase>
subset of the real numbers<phrase diff="del" dg="decfix">,</phrase> which
can be represented by
<phrase diff="add" dg="decfix">(finite-length) </phrase>decimal numerals.
<!--* ah, how about "the subset of the real numbers which can
be represented by finite-length decimal numerals" ? *-->
<phrase diff="del" dg="decfix">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.</phrase></termdef></p>

<note diff="del" dg="partialfix">
<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 <compref ref="std"/> 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 id="decimal-value-space" diff="add" dg="decfix">
<head>Value Space</head>

<p>The <termref def="dt-value-space"/> of
<dtref ref="&odec;"/> is the set of numbers that can be obtained by 
dividing an integer by a non-negative
power of ten, i.e., expressible as&nbsp;
<var>i</var>&nbsp;/&nbsp;10<sup><var>n</var></sup>&nbsp;
where <var>i</var> and <var>n</var> are integers
and <var>n</var>&nbsp;&ge;&nbsp;0&nbsp;.&nbsp;
Precision is not reflected in this value space;
the number 2.0 is not distinct from the number 2.00.&nbsp;
(The datatype <dtref ref="&pD;"/> may be used
for values in which precision is significant.)</p>

<note diff="add" dg="partialfix">
 <p>See the conformance note in <specref ref="partial-implementation"/>, which
applies to this datatype.</p>
</note>

<p>The equality relation on <dtref ref="&odec;"/> is the identity.&nbsp;
The order relation is the usual order relation on real numbers, restricted
to this subset.</p>

</div4>

<div4 id="decimal-lexical-representation">
<head>Lexical
<phrase diff="del" dg="rq21-lexmaps">representation</phrase><phrase diff="add" dg="rq21-lexmaps">Mapping</phrase></head>

<p><phrase diff="del" dg="decfix"><term>&odec;</term></phrase><phrase diff="add" dg="decfix"><dtref ref="&odec;"/></phrase>
has a lexical representation
consisting of a finite-length sequence of decimal digits (#x30&ndash;#x39) separated
by a period as a decimal indicator.&nbsp;
An optional leading sign is allowed.&nbsp;
If the sign is omitted,
<phrase diff="del" dg="decfix">"+"</phrase><phrase diff="add" dg="decfix"><string>+</string></phrase>
is assumed.&nbsp; Leading and trailing zeroes are optional.&nbsp;
If the fractional part is zero, the period and following zero(es) can
be omitted.
For example:&nbsp;
<phrase diff="del" dg="decfix"><code>-1.23, 12678967.543233, +100000.00,
210</code></phrase><phrase diff="add" dg="decfix"><string>-1.23</string>,
<string>12678967.543233</string>, <string>+100000.00</string>,
<string>210</string></phrase>.
</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
<mention><phrase diff="del" dg="decfix"><code>-</code></phrase><phrase diff="add" dg="decfix"><code>(+|-)</code></phrase><code>?(([0-9]+(.[0-9]*)?)|(.[0-9]+))</code></mention>.
</p>

<p diff="del" dg="rq31m.add.rq21-lexmaps.del">
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>

<p diff="add" dg="rq21-lexmaps">
The mapping from lexical representations to values is the usual
one for decimal numerals; it is given formally in 
<pfref ref="f-&odec;Lexmap"/>.
</p>

<ednote diff="add" dg="decfix_movement"><edtext>The following paragraphs were
moved from the deleted section that follows into this one to align the
organization of this datatype description with that of others that are
newly rewritten for 1.1.</edtext></ednote>

<p diff="add" dg="decfix_movement">The canonical representation for
<term>&odec;</term> is defined by prohibiting certain options from the
<phrase diff="del" dg="decfix"><specref ref="decimal-lexical-representation"/></phrase><phrase diff="add" dg="decfix"><termref def="dt-lexical-representation"/></phrase>.&nbsp;
Specifically, the preceding optional 
<phrase diff="del" dg="decfix">"+"</phrase><phrase diff="add" dg="decfix"><string>+</string></phrase> 
sign is prohibited.&nbsp; The
decimal point is required.&nbsp; Leading and trailing zeroes are
prohibited subject to the following:&nbsp; there must be at least one
digit to the right and to the left of the decimal 
point<phrase diff="add" dg="decfix">,</phrase> which may be a zero.</p>

<p diff="add" dg="rq31m_decfix_movement">
The mapping from values to canonical representations 
is given formally in:
<defsetsum ref="defs-&odec;Canmap"/>
</p>
<p diff="add" dg="rq21-lexmaps">
The mapping from values to canonical representations 
is given formally in 
<pfref ref="f-&odec;Canmap"/>.
</p>
</div4>

<div4 role="1.0" id="decimal-canonical-representation" diff="del" dg="decfix">
<head>Canonical representation</head>

<p>The canonical representation for <term>&odec;</term> is defined by
prohibiting certain options from the 
<phrase diff="del" dg="decfix"><specref ref="decimal-lexical-representation"/></phrase><phrase diff="add" dg="decfix"><termref def="dt-lexical-representation"/></phrase>.&nbsp;
Specifically, the preceding optional 
<phrase diff="del" dg="decfix">"+"</phrase><phrase diff="add" dg="decfix"><string>+</string></phrase> 
sign is prohibited.&nbsp; The decimal point is required.&nbsp; Leading 
and trailing zeroes are prohibited subject to the following:&nbsp; there 
must be at least one digit to the right and to the left of the decimal 
point<phrase diff="add" dg="decfix">,</phrase> which may be a zero.</p>

<p diff="del" dg="rq31m.add.rq21-lexmaps.del">
The mapping from values to canonical representations 
is given formally in:
<defsetsum ref="defs-&odec;Canmap"/>
</p>

<p diff="add" dg="rq21-lexmaps">
The mapping from values to canonical representations 
is given formally in 
<pfref ref="f-&odec;Canmap"/>.
</p>

</div4>

<div4 diff="add" dg="decfix"><head/>
<div5 diff="del" dg="rec12-tableaux"><head>Simple Type Definition for &odec;</head>
<p>The <compref ref="std"/> of <dtref ref="&odec;"/> is present in every
schema.&nbsp; It has the following properties:</p>

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

<pvlist>
<pvpair comp="std" prop="name"><string>&odec;</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="&odec;"/></pvpair>
<pvpair comp="std" prop="facets">{a <compref ref="f-w"/> facet with 
<propref comp="f-w" prop="value"/> = <pt>collapse</pt>}</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></div5>
</div4>

<div4 id="decimal-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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>

<p diff="add" dg="rq150c">All <termref def="dt-minimally-conforming"/> processors
&must; support all <dtref ref="&pD;"/> values 
<!--* which would be allowed by any  *-->
in the &value_space; of the
otherwise unconstrained
<termref def="dt-derived"/> datatype for which
<compref ref="f-td"/> is set to sixteen, <compref ref="f-ms"/> to 369,
and <compref ref="f-mns"/> to &minus;398.</p>

<!--* note 2005-12-08 in Edinburgh the WG instructed the editors to make
    * some specific amendments here (made) and correct the numbers.
    * I believe we have found good numbers since Edinburgh, but in
    * processing the Edinburgh decision today I have NOT found them and
    * put them in.  If you come in here with better numbers and are
    * surprised to find these, it's probably because they are wrong.
    * And possibly because you are right, although that's less certain.
    * -MSM
    *-->
<!--* Edinburgh minutes say -369 to 398, -6111 to 6176 *-->

<note>
<p>Note: The conformance limits given in the text correspond to those
of the decimal64 type defined in the current draft of IEEE 754R, which
can be stored in a 64-bit field. The XML Schema Working Group
recommends that implementors support limits corresponding to those of
the decimal128 type. This entails supporting the values in the value
space of the otherwise unconstrained datatype for which 
<compref ref="f-td"/> is set to 34, <compref ref="f-ms"/> to 6176,
and <compref ref="f-mns"/> to &minus;6111.
</p>
</note>
<note>
<p>The XML Schema Working Group requests feedback from implementors
and users of XML Schema concerning the minimum and recommended
implementation limits for <dtref ref="precisionDecimal"/>. If other
limits, larger or smaller, would make this dataytpe more attractive to
users or implementors, please let us know. </p>
</note>

<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>.<phrase diff="del" dg="lexMapFacet-1912">&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.</phrase>

<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="del" dg="rq31fix.add.rq21-lexmaps.del">The lexical mapping and canonical mapping 
for <dtref ref="&pD;"/> are the following functions:

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

</p>

<p diff="add" dg="rq21-lexmaps">The lexical mapping for
<dtref ref="&pD;"/> is <pfref ref="f-precDecLexmap"/>. The
canonical mapping is <pfref ref="f-precDecCanmap"/>.
</p>
</div4>

<div4 diff="del" dg="rec12-tableaux"><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 diff="del" dg="lexMapFacet-1912">
<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><phrase diff="del" dg="rec12-tableaux">&CFacet;s</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>
<facets/>
</div4>
</div3>

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

<issue id="RQ-1i" role="1.1" diff="del" dg="flfix">
<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" diff="del" dg="flfix">
<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"><phrase diff="add" dg="flfix">The
</phrase><term>float</term><phrase diff="add" dg="flfix"> datatype</phrase>
is<phrase diff="del" dg="flfix"> patterned after</phrase> the IEEE 
single-precision 32-bit floating point <phrase diff="add" dg="flfix">data</phrase>type
<bibref ref="ieee754"/><phrase diff="add" dg="flfix"> with the minor exception
noted below</phrase>.<phrase diff="del" dg="flfix">&nbsp; The
basic <phrase diff="del" dg="rq140"><termref def="dt-value-space"/> of
<term>float</term> consists of the values
<emph role="eq">m &times; 2^e</emph></phrase><phrase diff="add" dg="rq140">values
of <term>float</term> are the non-zero numbers
<var>m</var> &times; 2<sup><var>e</var></sup></phrase>, 
where <var>m</var>
is an integer whose absolute value is less than
<phrase diff="del" dg="rq140"><emph role="eq">2^24</emph></phrase><phrase diff="add" dg="rq140">2<sup>24</sup></phrase>, and <var>e</var> is an integer
between -149 and 104, inclusive.&nbsp; In addition to the basic
<phrase diff="del" dg="rq140"><termref def="dt-value-space"/></phrase><phrase diff="add" dg="rq140">values</phrase> described above, the
<termref def="dt-value-space"/> of <term>float</term> also contains the
following <phrase diff="del" dg="rq140">three</phrase> 
<emph>special values</emph>: <phrase diff="add" dg="rq140">positive and negative zero,</phrase>
positive and negative infinity<phrase diff="add" dg="rq140">,</phrase> 
and not-a-number (NaN).&nbsp;
<phrase diff="del" dg="rq140">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 <var>x</var> and <var>y</var> in the value space.</phrase>
<phrase diff="add" dg="rq140">For the basic values, the order relation
on <term>float</term> is the usual one for rational numbers.</phrase>
Positive infinity is greater than all other non-NaN 
values<phrase diff="del" dg="rq140">.</phrase><phrase diff="add" dg="rq140">;
negative infinity is less than all other non-NaN values.</phrase>
NaN equals itself but is incomparable with (neither greater than nor less than)
any other value in the <termref def="dt-value-space"/>.
<phrase diff="add" dg="rq140">Positive and negative zero are greater than
all the negative numbers among the basic values and less than all the
positive numbers.  They are distinct values
which compare equal. (They are thus distinct for purposes of enumerations
and identity constraints, and equal for purposes of minimum and maximum
values.)</phrase></phrase></termdef><phrase diff="add" dg="flfix">&nbsp;
Floating point numbers are certain subsets of the rational numbers, and are often used to 
approximate arbitrary real numbers.</phrase></p>

<note diff="del" dg="flfix">
<p diff="del" dg="rq140">
"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<phrase diff="del" dg="rq140"> and only one zero</phrase>. 
This makes the equality and ordering of values in the data
space differ from that of <bibref ref="ieee754"/> <phrase diff="del" dg="rq140">only</phrase>
in that for schema purposes NaN = NaN.
</p>
</note>

<p dg="flfix" diff="del">
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 dg="flfix" diff="add"><head>Value Space</head>

<p>The <termref def="dt-value-space"/> of <dtref ref="float"/> contains the
non-zero numbers&nbsp; <var>m</var>&nbsp;&times;&nbsp;2<sup><var>e</var></sup>&nbsp;,
where <var>m</var> is an integer whose absolute value is less than 2<sup>24</sup>,
and <var>e</var> is an integer between &minus;149 and 104, inclusive.&nbsp; In addition to
these values, the <termref def="dt-value-space"/> of <dtref ref="float"/> also contains
the following <emph>special values</emph>:&nbsp; <pt>positiveZero</pt>,
<pt>negativeZero</pt>, <pt>positiveInfinity</pt>,
<pt>negativeInfinity</pt>, and <pt>notANumber</pt>.</p>

<note>
<p>As explained below, the <termref def="dt-lexical-mapping"/> of the <dtref ref="float"/>
value <pt>notANumber</pt> is <string>NaN</string>.&nbsp; Accordingly, in English
text we generally 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
values <pt>positiveInfinity</pt> and <pt>negativeInfinity</pt>,
and <mention>0</mention> and <mention>&minus;0</mention> to refer to
<pt>positiveZero</pt> and <pt>negativeZero</pt>.</p></note>

<p>Equality and order for <dtref ref="float"/> are defined as follows:
<ulist>
<item>
<p>Equality is identity, except that&nbsp; 0&nbsp;=&nbsp;&minus;0&nbsp; (although
they are not identical) and&nbsp; NaN&nbsp;&ne;&nbsp;NaN&nbsp; 
(although NaN is of course identical to itself).</p>

<p>0 and &minus;0 are thus distinct for purposes of enumerations and
identity constraints, but equal for purposes of minimum and maximum values.</p></item>
<item>
<p>For the basic values, the order relation
on float is the order relation for rational numbers.&nbsp; INF is greater
than all other non-NaN values; &minus;INF is less than all other non-NaN
values.&nbsp; NaN is <termref def="dt-incomparable"/> with any value
in the <termref def="dt-value-space"/> including itself.&nbsp; 0 and &minus;0
are greater than all the negative numbers and less than all the positive
numbers.</p></item>
</ulist>
</p>

<note>
<p>Any value <termref def="dt-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"/>.&nbsp;
In particular, when NaN is used as a facet value for a bounding facet, since no
<dtref ref="float"/> values are <termref def="dt-incomparable">comparable</termref>
with it, the result is a <termref def="dt-value-space"/> that is empty.&nbsp;
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 (which may be derived
by an enumeration).</p></note>

<note>
<p>The Schema 1.0 version of this datatype did not differentiate between
0 and &minus;0 and NaN was equal to itself.&nbsp; The changes were
made to make the datatype more closely mirror <bibref ref="ieee754"/>.</p></note>
</div4>

<div4 role="1.0" id="float-lexical-representation" dg="flfix" diff="del">
<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" dg="flfix" diff="del">
<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 dg="flfix" diff="add"><head>Lexical Mapping</head>

<p>The <termref def="dt-lexical-space"/> of <dtref ref="float"/> is
the set of all decimal numerals with or without a decimal
point, numerals in scientific (exponential) notation, and
the <termref def="dt-literal">literals</termref> <string>INF</string>,
<string>-INF</string>, and <string>NaN</string>

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

The <nt def="nt-floatRep"/> production is equivalent to this regular expression:

<display><code>(-|+)?(([0-9]+(.[0-9]*)?)|(.[0-9]+))((e|E)(-|+)?[0-9]+)?|-?INF|NaN</code></display></p>

<p>The <dtref ref="float"/> datatype is designed to implement for schema
processing the single-precision floating-point datatype of
<bibref ref="ieee754"/>.&nbsp; That specification does not specify specific
<termref def="dt-lexical-representation">lexical representations</termref>,
but does prescribe requirements on any <termref def="dt-lexical-mapping"/>
used.&nbsp; Any <termref def="dt-lexical-mapping"/>
that maps the <termref def="dt-lexical-space"/> just described onto the
<termref def="dt-value-space"/>, satisfies the requirements of
<bibref ref="ieee754"/>, and correctly handles the special values
(<nt def="nt-numSpecReps"/> <termref def="dt-literal">literals</termref>),
satisfies the conformance requirements of this specification.</p>

<p>Since IEEE allows some variation in rounding of values, processors
conforming to this specification may exhibit some variation in their
<termref def="dt-lexical-mapping">lexical mappings</termref>.</p>

<p>The <termref def="dt-lexical-mapping"/> <pfref ref="f-floatLexmap"/> is 
provided as an example of a simple algorithm that yields a conformant mapping,
and that provides the most accurate rounding possible&mdash;and is thus useful
for insuring inter-implementation reproducibility and inter-implementation
round-tripping.&nbsp; The simple rounding
algorithm used in <pfref ref="f-floatLexmap"/> may be more efficiently
implemented using the algorithms of <bibref ref="clinger1990"/>.</p>

<note>
<p>The Schema 1.0 version of this datatype did not permit rounding
algorithms whose results differed from <bibref ref="clinger1990"/>.</p>
</note>

<p>The <termref def="dt-canonical-mapping"/> <pfref ref="f-floatCanmap"/> is 
provided as an example of a mapping that does not produce unnecessarily long
<termref def="dt-canonical-representation">canonical representations</termref>.&nbsp;
Other algorithms which do not yield identical results for mapping from float
values to character strings are permitted by <bibref ref="ieee754"/>.</p>

</div4>

<!-- The Simple Type definition for float was never accepted, so we don't need HT's
cute <head/> trickery to remove it.  I'm commenting it out to eliminate the spurious
empty Division (number w/o head) that otherwise results.  -DP 051016

<div4 dg="flfix" diff="add"><head/>
<div5 diff="del" dg="rec12-tableaux"><head>Simple Type Definition for float</head>
<p>The <compref ref="std"/> of <dtref ref="float"/> is present in every
schema.&nbsp; It has the following properties:</p>

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

<pvlist>
<pvpair comp="std" prop="name"><string>float</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="float"/></pvpair>
<pvpair comp="std" prop="facets">{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>}
</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>true</pt></p></item>
<item><p>a <compref ref="ff-c"/> facet
with <propref comp="ff-c" prop="value"/> = <pt>finite</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>
</div5></div4>
-->

<div4 id="float-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>
<facets/>
</div4>
</div3>

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

<p>
<termdef id="dt-double" term="double" role="local">The <term>double</term>
datatype is<phrase diff="del" dg="flfix"> patterned after</phrase> the
IEEE double-precision 64-bit floating point <phrase diff="add" dg="flfix">data</phrase>type
<bibref ref="ieee754"/><phrase diff="add" dg="flfix"> with the minor exception
noted below</phrase>.<phrase diff="del" dg="flfix">&nbsp; 
<phrase diff="del" dg="rq140">The basic <termref def="dt-value-space"/>
of <term>double</term> consists of the values
<emph role="eq">m &times; 2^e</emph>, </phrase><phrase diff="add" dg="rq140">The
basic values of <term>double</term> are the non-zero numbers
<var>m</var> &times; 2<sup><var>e</var></sup>, </phrase>
where <emph role="eq">m</emph>
is an integer whose absolute value is less than
2<sup>53</sup>, and <var>e</var> is an
integer between -1075 and 970, inclusive.&nbsp; In addition to the basic
<phrase diff="del" dg="rq140"><termref def="dt-value-space"/></phrase><phrase diff="add" dg="rq140">values</phrase> described above, the
<termref def="dt-value-space"/> of <term>double</term> also contains
the following
<phrase diff="del" dg="rq140">three</phrase>
<emph>special values</emph>:
<phrase diff="add" dg="rq140">positive and negative zero,</phrase>
positive and negative infinity<phrase diff="add" dg="rq140">,</phrase>
and not-a-number
(NaN).
<phrase diff="del" dg="rq140">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.</phrase>
<phrase diff="add" dg="rq140">For the basic values, the order relation
on <term>double</term> is the usual one for rational numbers.</phrase>
Positive infinity is greater than all other non-NaN 
values<phrase diff="del" dg="rq140">.</phrase><phrase diff="add" dg="rq140">;
negative infinity is less than all other non-NaN values.</phrase>
NaN equals itself but is incomparable with (neither greater than nor less than)
any other value in the <termref def="dt-value-space"/>.
<phrase diff="add" dg="rq140">Positive and negative zero are greater than
all the negative numbers among the basic values and less than all the
positive numbers.  They are distinct values
which compare equal. (They are thus distinct for purposes of enumerations
and identity constraints, and equal for purposes of minimum and maximum
values.)</phrase></phrase></termdef><phrase diff="add" dg="flfix">&nbsp;
Floating point numbers are certain subsets of the rational numbers, and are often used to 
approximate arbitrary real numbers.</phrase></p>

<note diff="add" dg="flfix"><p>The only significant differences between float and double are
the three defining constants 53 (vs 24), &minus;1074 (vs &minus;149),
and 971 (vs 104).</p></note>

<note diff="del" dg="flfix">
<p diff="del" dg="rq140">
"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<phrase diff="del" dg="rq140"> and only one
zero</phrase>. This makes the equality and ordering of values in the
data space differ from that of <bibref ref="ieee754"/> 
<phrase diff="del" dg="rq140">only</phrase> in that for schema purposes 
NaN = NaN.
</p>
</note>
<p diff="del" dg="flfix">
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 dg="flfix" diff="add"><head>Value Space</head>

<p>The <termref def="dt-value-space"/> of <dtref ref="double"/> contains the
non-zero numbers&nbsp; <var>m</var>&nbsp;&times;&nbsp;2<sup><var>e</var></sup>&nbsp;,
where <var>m</var> is an integer whose absolute value is less than <phrase diff="del" dg="b2642">2<sup>57</sup></phrase><phrase diff="add" dg="b2642">2<sup>53</sup></phrase>,
and <var>e</var> is an integer between &minus;1074 and 971, inclusive.&nbsp; In addition to
these values, the <termref def="dt-value-space"/> of <dtref ref="double"/> also contains
the following <emph>special values</emph>:&nbsp; <pt>positiveZero</pt>,
<pt>negativeZero</pt>, <pt>positiveInfinity</pt>,
<pt>negativeInfinity</pt>, and <pt>notANumber</pt>.</p>

<note>
<p>As explained below, the <termref def="dt-lexical-mapping"/> of the <dtref ref="double"/>
value <pt>notANumber</pt> is <string>NaN</string>.&nbsp; Accordingly, in English
text we generally 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
values <pt>positiveInfinity</pt> and <pt>negativeInfinity</pt>,
and <mention>0</mention> and <mention>&minus;0</mention> to refer to
<pt>positiveZero</pt> and <pt>negativeZero</pt>.</p></note>

<p>Equality and order for <dtref ref="double"/> are defined as follows:
<ulist>
<item>
<p>Equality is identity, except that&nbsp; 0&nbsp;=&nbsp;&minus;0&nbsp; (although
they are not identical) and&nbsp; NaN&nbsp;&ne;&nbsp;NaN&nbsp; 
(although NaN is of course identical to itself).</p>

<p>0 and &minus;0 are thus distinct for purposes of enumerations and
identity constraints, but equal for purposes of minimum and maximum values.</p></item>
<item>
<p>For the basic values, the order relation
on double is the order relation for rational numbers.&nbsp; INF is greater
than all other non-NaN values; &minus;INF is less than all other non-NaN
values.&nbsp; NaN is <termref def="dt-incomparable"/> with any value
in the <termref def="dt-value-space"/> including itself.&nbsp; 0 and &minus;0
are greater than all the negative numbers and less than all the positive
numbers.</p></item>
</ulist>
</p>

<note>
<p>Any value <termref def="dt-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"/>.&nbsp;
In particular, when NaN is used as a facet value for a bounding facet, since no
<dtref ref="double"/> values are <termref def="dt-incomparable">comparable</termref>
with it, the result is a <termref def="dt-value-space"/> that is empty.&nbsp;
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 (which may be derived
by an enumeration).</p></note>

<note>
<p>The Schema 1.0 version of this datatype did not differentiate between
0 and &minus;0 and NaN was equal to itself.&nbsp; The changes were
made to make the datatype more closely mirror <bibref ref="ieee754"/>.</p></note>
</div4>

<div4 role="1.0" id="double-lexical-representation" diff="del" dg="flfix">
<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 id="double-canonical-representation" diff="del" dg="flfix">
<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 dg="flfix" diff="add"><head>Lexical Mapping</head>

<p>The <termref def="dt-lexical-space"/> of <dtref ref="double"/> is
the set of all decimal numerals with or without a decimal
point, numerals in scientific (exponential) notation, and
the <termref def="dt-literal">literals</termref> <string>INF</string>,
<string>-INF</string>, and <string>NaN</string>

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

The <nt def="nt-doubleRep"/> production is equivalent to this regular expression:

<display><code>(-|+)?(([0-9]+(.[0-9]*)?)|(.[0-9]+))((e|E)(-|+)?[0-9]+)?|-?INF|NaN</code></display></p>

<p>The <dtref ref="double"/> datatype is designed to implement for schema
processing the double-precision floating-point datatype of
<bibref ref="ieee754"/>.&nbsp; That specification does not specify specific
<termref def="dt-lexical-representation">lexical representations</termref>,
but does prescribe requirements on any <termref def="dt-lexical-mapping"/>
used.&nbsp; Any <termref def="dt-lexical-mapping"/>
that maps the <termref def="dt-lexical-space"/> just described onto the
<termref def="dt-value-space"/>, satisfies the requirements of
<bibref ref="ieee754"/>, and correctly handles the special values
(<nt def="nt-numSpecReps"/> <termref def="dt-literal">literals</termref>),
satisfies the conformance requirements of this specification.</p>

<p>Since IEEE allows some variation in rounding of values, processors
conforming to this specification may exhibit some variation in their
<termref def="dt-lexical-mapping">lexical mappings</termref>.</p>

<p>The <termref def="dt-lexical-mapping"/> <pfref ref="f-doubleLexmap"/> is 
provided as an example of a simple algorithm that yields a conformant mapping,
and that provides the most accurate rounding possible&mdash;and is thus useful
for insuring inter-implementation reproducibility and inter-implementation
round-tripping.&nbsp; The simple rounding
algorithm used in <pfref ref="f-doubleLexmap"/> may be more efficiently
implemented using the algorithms of <bibref ref="clinger1990"/>.</p>

<note>
<p>The Schema 1.0 version of this datatype did not permit rounding
algorithms whose results differed from <bibref ref="clinger1990"/>.</p>
</note>

<p>The <termref def="dt-canonical-mapping"/> <pfref ref="f-doubleCanmap"/> is 
provided as an example of a mapping that does not produce unnecessarily long
<termref def="dt-canonical-representation">canonical representations</termref>.&nbsp;
Other algorithms which do not yield identical results for mapping from float values
to character strings are permitted by <bibref ref="ieee754"/>.</p>

</div4>

<!-- The Simple Type definition for float was never accepted, so we don't need HT's
cute <head/> trickery to remove it.  I'm commenting it out to eliminate the spurious
empty Division (number w/o head) that otherwise results.  -DP 051016

<div4 dg="flfix" diff="add"><head/>
<div5 diff="del" dg="rec12-tableaux"><head>Simple Type Definition for double</head>
<p>The <compref ref="std"/> of <dtref ref="double"/> is present in every
schema.&nbsp; It has the following properties:</p>

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

<pvlist>
<pvpair comp="std" prop="name"><string>double</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="double"/></pvpair>
<pvpair comp="std" prop="facets">{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>}
</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>true</pt></p></item>
<item><p>a <compref ref="ff-c"/> facet
with <propref comp="ff-c" prop="value"/> = <pt>finite</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>

</div5></div4>
-->

<div4 id="double-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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>

<!--* !!! this note was not expressly deleted by du0 as approved 19 Dec 2003
    * http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2003Dec/att-0042/durationsProposal3.html
    * but also not shown as retained.
    *-->
<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>&nbsp; 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 <phrase diff="del" dg="dudt">and 
subtraction from </phrase><dtref ref="dateTime"/>
is required for XML Schema processing and is
defined <phrase diff="del" dg="dudt">in
<specref ref="adding-durations-to-dateTimes"/></phrase><phrase diff="add" dg="dudt">in
the function <pfref ref="vp-dt-dateTimePlusDuration"/></phrase>.</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>
<!--* !!! this paragraph is not quite the same as was adopted by the WG in
    * December 2003; editorial changes have been made.
    *-->
<p><phrase diff="del" dg="wd17">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.</phrase>
<phrase diff="add" dg="wd17">Duration values can be modelled as
two-property tuples.  Each value consists of an integer number of
months and a decimal number of seconds.  The 
<vpropref ref="vp-du-second"/> value &mustnot; be negative if the 
<vpropref ref="vp-du-month"/> value is positive and &mustnot; be 
positive if the <vpropref ref="vp-du-month"/> is negative.</phrase>

<!--* !!! n.b. the display of this material is not, in the status quo document,
    * the same as in the proposal adopted by the WG in December 2003.
    * It is the same as was published as SQ text in July 2004.
    *-->
<defset><head>Properties of <dtref ref="duration"/> Values</head>
<vpropdef><name id="vp-du-month">months</name>
<limits diff="add" dg="wd17"><dtref ref="integer"/></limits>
</vpropdef>
<vpropdef><name id="vp-du-second">seconds</name>
<limits>a <dtref ref="&pD;"/> value;
<phrase diff="del" dg="wd17"><termref def="dt-must">Must</termref> 
not</phrase><phrase diff="add" dg="wd17">&mustnot;</phrase> 
be negative if <vpropref ref="vp-du-month"/> is positive, and 
<phrase diff="del" dg="wd17"><termref def="dt-must"/>
not</phrase><phrase diff="add" dg="wd17">&mustnot;</phrase>
be positive if <vpropref ref="vp-du-month"/> is negative.</limits>
</vpropdef>
</defset>

<dtref ref="duration"/> is partially ordered.&nbsp; 
<phrase diff="del" dg="wd17">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</phrase><phrase diff="add" dg="wd17">Equality of <dtref ref="duration"/> 
is defined in terms of equality of <dtref ref="dateTime"/>;  order for 
<dtref ref="duration"/> is defined in terms of the order of 
<dtref ref="dateTime"/>.  Specifically, the equality or order of 
two <dtref ref="duration"/> values is determined by adding each 
<dtref ref="duration"/> in the pair to each of</phrase> 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 <termref def="dt-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 
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<phrase diff="del" dg="noleap">, 
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</phrase>.&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<phrase diff="del" dg="noleap"> not 
within a leap-second</phrase>.</p>

<p diff="del" dg="noleap">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><phrase diff="del" dg="noleap">It turns out that 
u</phrase><phrase diff="add" dg="noleap">U</phrase>nder 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" dg="errata-2e">unsigned</phrase> 
integer<phrase diff="add" dg="errata-2e">, 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" dg="errata-2e">unsigned</phrase> decimal.
<phrase diff="add" dg="errata-2e">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" dg="errata-2e">must</phrase><phrase diff="del" dg="errata-2e">shall</phrase>
be absent if <phrase diff="add" dg="errata-2e">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"/> 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>
<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>

</defset>

<defset><head>Lexical Representation</head>
<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>
</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 diff="del" dg="rq20">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="rq20">The language accepted by the <nt def="nt-durationRep"/> 
production is the set of strings which satisfy all of the following
three regular expressions:
<ulist>
<item><p>The expression 
<string>-?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?(T([0-9]+H)?([0-9]+M)?((([0-9]+(.[0-9]*)?)|(.[0-9]+))S)?)?</string> matches only strings in which the fields occur in the proper order.</p>
</item>
<item><p>The expression <string>.*[YMDHS].*</string> matches only
strings in which at least one field occurs.</p>
</item>
<item><p>The expression <string>.*[^T]</string> matches
only strings in which <string>T</string> is not the final character, so that
if <string>T</string> appears, something follows it.  The first rule
ensures that what follows <string>T</string> will be an hour,
minute, or second field.</p>
</item>
</ulist>
The intersection of these three regular expressions is equivalent to
the following (after removal of the white space inserted here for
legibility):
<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>
</p>
<!--* !!! The text following the regex is not exactly what was approved
    * by the WG in December 2003.  It is the same as appeared in the draft
    * of July 2004.
    *-->

<!--* !!! The following paragraph was approved by the WG in December 2003
    * as part of the same proposal as the paragraph above.  It's not
    * clear why they are marked with different diff groups.
    *-->
<!--* du0_prodigal2 has not yet been considered by the WG, so unlike
    * the other diff groups where additions are changed by rq21-lexmaps,
    * it doesn't get reversed from an add to an del. MSM 2005-08-25
    * Correction 2006-01-10: approved as part of RQ-20 proposal
    * on 18 Dec 2003.
    *-->
<p diff="add" dg="du0_prodigal2.add.rq21-lexmaps.del">The 
<termref def="dt-lexical-mapping"/> 
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>

<p diff="add" dg="du0_prodigal2.add.rq21-lexmaps.add">The
lexical mapping for <dtref ref="duration"/> is <pfref ref="f-durationMap"/>.
</p>

<!--* !!! The following note and paragraph were not part of the proposal approved 
    * by the WG in December 2003.  At the moment, it's not clear whether 
    * or when it has been considered by the WG.
    * The note appeared, marked as non-status-quo text, in July 2004.
    *-->
<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 
<phrase diff="del" dg="rec12-main">datatype definitions</phrase>
<phrase diff="add" dg="rec12-main">datatypes</phrase> who may find them useful, 
and for other specifications
which might find it useful to reference them normatively.</p>
</note>

<!--* changed the following from du1 to du0, 2005-04-28.  The assignment
    * to du1 was added in 1.7.2.98, for which the comment says that some
    * things that depend on du1 were marked as du1.  I infer now that
    * this was mis-identified as dependent on the preceding paragraph.
    * In reality, a full description of the canonical mapping was part of
    * the wording approved 18 Dec 2003 (proposal for rq-20).
    *-->
<p diff="del" dg="du0_prodigal.add.rq21-lexmaps.del"
><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>

<p diff="add" dg="du0_prodigal.add.rq21-lexmaps.add"><termref role="the" def="dt-canonical-mapping">The canonical
mapping</termref> for <dtref ref="duration"/>
is <pfref ref="f-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.  <phrase diff="del" dg="noleap">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.</phrase>
</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="f-mii"/>,  <compref ref="f-mie"/>,
<compref ref="f-mai"/> and <compref ref="f-mae"/> facet values,
indeterminate comparisons should be considered as "false".
</p>
<!--* 
<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>

<!--* The following section was shown as deleted by the proposal 
    * approved by the WG in December 2003.  It was restored in
    * version 1.7.2.140 as part of making a more complete diff
    * against 1.0, but was erroneously not marked deleted.
    * As a result, it was wrongly included without diff coloring
    * in the Working Draft of 24 February 2005.
    *-->
<div4 id="total-order-durations" diff="del" dg="du0">
<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><phrase diff="del" dg="rec12-tableaux">&CFacet;s</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>
<facets/>
</div4>

<div4 role="1.0" id="duration-derived-types" diff="add" dg="rq20">
<head>Related Datatypes</head>
<subtypes/>
</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<phrase diff="del" dg="noleap">
as modified for leap-seconds</phrase>.
The timeOnTimeline values form two related
"timelines", one for timezoned
values and one for non-timezoned values.
Each timeline is a copy of the <termref def="dt-value-space"/>
of <dtref ref="decimal"/>,
with integers given units of seconds.
</termdef></p>
<!--* MSM reverted from &pD; to decimal 3ll up, since paragraph is now gone anyway.
    * If change appeared in Feb WD we'll need to mark it as a change, but for now
    * I'm busy rechecking against 1.0, not the WD yet. *-->

<!--*
<ednote><edtext>I'm not sure how UTC and TAI are handled&mdash;as
termrefs or just plain text.  Michael, please fix appropriately
once we converge</edtext></ednote>
*-->

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

<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"/>, 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"/> 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"/>
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 <phrase diff="del" dg="partialfix"><specref ref="year-sec-conformance"/></phrase><phrase diff="add" dg="partialfix"><specref ref="partial-implementation"/></phrase>
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"/>.</p>

<!--* This note duplicates on in the appendix; see that they remain in synch. *-->
<note diff="add" dg="rq123">
<p>In version 1.0 of this specification, the 
<pfref ref="vp-dt-year"/> property was not permitted to have the value
zero. The year 1 BCE was represented by a 
<pfref ref="vp-dt-year"/> value of &minus;1, 2 BCE by &minus;2, and so
forth. In this version of this specification,
two changes are made in order to agree with existing usage. 
First, <pfref ref="vp-dt-year"/> is permitted to have the value zero.
Second, the interpretation of
<pfref ref="vp-dt-year"/> values is changed accordingly: a <pfref ref="vp-dt-year"/> value of zero represents 1 BCE, &minus;1
represents 2 BCE, etc. This representation simplifies interval
arithmetic and leap-year calculation for dates before the common era.
</p>
<p>
Note that 1 BCE, 5 BCE, and so on (years 0000, -0004, etc. in the
lexical representation defined here) are leap years in the proleptic
Gregorian calendar used for the date/time datatypes defined here.
Version 1.0 of this specification was unclear about the treatment of
leap years before the common era; caution should be used if existing
schemas or data specify dates of 29 February for any years before the
common era.  With that possible exception, schemas and data valid
under the old interpretation remain valid under the new.
</p>
</note>

<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" diff="del" dg="noleap">
<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 dateTime
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 
<phrase diff="del" dg="partialfix"><specref ref="year-sec-conformance"/></phrase><phrase diff="add" dg="partialfix"><specref ref="partial-implementation"/></phrase>
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"/> 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"/>.).</p></item>
 </ulist>
</p>
</div4>

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

<!--
<p diff="add" dg="rq123">
Informally, the &lexical_space; of <dtref ref="dateTime"/> consists of
literals of the form:
<code>'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?</code>,
where 
</p>
<ulist diff="add" dg="rq123">
  <item><p><code>'-'? yyyy</code> denotes the year. There must
be at least four digits; leading zeroes are prohibited if the numeral
is more than four digits long, and non-positive numbers represent
years before the common era (<string>0000</string> represents the
year 1 BCE, <string>-0001</string> is 2 BCE, etc.); no plus sign is
permitted.</p>
<note>
<p>Version 1.0 of this specification described a different
interpretation of negative years, in which 1 BCE was
represented <string>-0001</string>, etc.  That interpretation
however, is inconsistent with existing established usage of
negative year numbers.  Note that existing schemas and XML data valid
under the old interpretation remain valid under the new.</p>
</note>
</item>
  <item><p><code>'-' mm '-' dd</code> represents the month and day
of the month; both <var>mm</var> and <var>dd</var> are two-digit
numerals.</p></item>
  <item><p><string>T</string> is a separator indicating that 
time-of-day follows.</p></item>
  <item><p><string>hh ':' mm ':' ss ('.' s+)?</string> denotes
the time of day.  <var>hh</var> is a two-digit numeral
representing the hour. <var>hh</var> may be
<string>24</string> if and only if <var>hh</var>
and <var>mm</var> are each <string>00</string>;
the <dtref ref="dateTime"/> value so represented is the first 
instant of the following day. <var>mm</var> and <var>ss</var> 
are two-digit numerals representing the minute and the
integral number of seconds, respectively; the <string>.</string>
and trailing <var>s</var> digits (if any) represent fractional
seconds.</p></item>
  <item><p><string>zzzzzz</string> (if present) represents
the timezone either as <string>Z</string> or
in the format <code>('+'|'-') hh ':' mm</code>,
giving the offset from UTC in hours and minutes.</p></item>
</ulist>

<p diff="add" dg="rq123">
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>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" diff="del" dg="noleap"/>
</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" diff="del" dg="noleap">
<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>

<phrase diff="add" dg="rq123">In such representations:</phrase>
<ulist diff="add" dg="rq123">
<item>
<p><nt def="nt-yrFrag"/> is a numeral consisting
of at least four decimal digits, optionally preceded by a minus sign;
leading <string>0</string> digits are prohibited except to bring the
digit count up to four.&nbsp;
It represents the <pfref ref="vp-dt-year"/> value.</p></item>
<item>
<p>Subsequent <string>-</string>, <string>T</string>, and
<string>:</string>, separate the various numerals.</p></item>
<item>
<p><nt def="nt-moFrag"/>, <nt def="nt-daFrag"/>, <nt def="nt-hrFrag"/>,
and <nt def="nt-miFrag"/> are numerals consisting
of exactly two decimal digits.&nbsp;
They represent<phrase diff="del" dg="rq123">s</phrase> 
the <pfref ref="vp-dt-month"/>, <pfref ref="vp-dt-day"/>,
<pfref ref="vp-dt-hour"/>, and <pfref ref="vp-dt-minute"/> values
respectively.</p></item>
<item>
<p><nt def="nt-daFrag"/> is a numeral consisting
of exactly two decimal digits, or two decimal digits,
a decimal point, and one or more trailing digits.&nbsp;
It represents the <pfref ref="vp-dt-second"/> value.</p></item>
<item>
<p>Alternatively, <nt def="nt-eodFrag"/> combines the <nt def="nt-hrFrag"/>,
<nt def="nt-miFrag"/>, <nt def="nt-miFrag"/>, and their separators to
represent midnight of the day, which is the first moment of the next
day.</p></item>
<item>
<p><nt def="nt-tzFrag"/>, if present, specifies the timezone in which
the moment occurs.&nbsp; Timezones are a count of minutes (expressed in
<nt def="nt-tzFrag"/> as a count of hours and minutes) that are added
or subtracted from UTC time to get the <unusual>local</unusual> time.&nbsp;
<string>Z</string> is an alternative representation of the timzone of
UTC, which is, of course, zero minutes from UTC.</p>

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

<p>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>
<!--* year  *-->\-?([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9])<!--*
    * month *-->\-(0[1-9])|(1[0-2])<!--*
    * day   *-->\-(0[1-9])([12][0-9])|(3[01])<br/>
<!--* Time  *-->&nbsp;T<!--*
    * hour  *-->(([01][0-9])|(2[0-3])<!--*
    * min   *-->:[0-5][0-9]<!--*
    * sec   *-->:<phrase diff="add" dg="dt3">(<!--*
    *   normal *--><phrase diff="del" dg="rq122a_sg">(</phrase></phrase><!--* 
    *     tens *-->[0-<!--* 
    *          *--><phrase diff="del" dg="dt3">6</phrase><!--*
    *          *--><phrase diff="add" dg="dt3">5</phrase>]<!--* 
    *     ones *-->[0-9]<phrase diff="add" dg="dt3"><!--* 
    *          *--><phrase diff="del" dg="rq122a_sg">)<!--*
    * sec = 60 *-->|(60)</phrase><!--* 
    *          *-->)<!--*
    * secfrag  *-->(<phrase diff="add" dg="rq122a_sg">\</phrase>.[0-9]+)?)</phrase><!--*
    * eodfrag  *-->|(24:00:00<!--*
    * eodsecfrag *--><phrase diff="add" dg="dt3">(<phrase diff="add" dg="rq122a_sg">\</phrase>.<!--* 
    *            *--><phrase diff="del" dg="rq122a_sg">[0-9]</phrase><!--* 
    *            *--><phrase diff="add" dg="rq122a_sg">0</phrase>+)?</phrase>)<br/><!--*
    * timezone *-->&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 constraint<phrase diff="del" dg="noleap">s</phrase>
<phrase diff="add" dg="dt3">on <nt def="nt-dateTimeRep"/> </phrase>given above.</p>

<p diff="del" dg="rq21-lexmaps">The lexical mapping and canonical mapping 
for <dtref ref="dateTime"/> are the following functions:

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

<p diff="add" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="dateTime"/> is <pfref ref="vp-dateTimeLexRep"/>.
The canonical mapping is <pfref ref="vp-dateTimeCanRep"/>.
</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"/>; 'Z' is its canonical
representation.</p>

<p>
When a timezone is added to a <termref def="dt-utc"/>
<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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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 <phrase diff="del" dg="partialfix"><specref ref="year-sec-conformance"/></phrase><phrase diff="add" dg="partialfix"><specref ref="partial-implementation"/></phrase>
which applies to <phrase diff="del" dg="partialfixfix">the seconds part 
of </phrase>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"/>.</p>

<constraintnote id="con-time-leapSecondValue" type="value" diff="del" dg="noleap">
<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"/></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 
<phrase diff="del" dg="partialfix"><specref ref="year-sec-conformance"/></phrase><phrase diff="add" dg="partialfix"><specref ref="partial-implementation"/></phrase>
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"/> 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"/>): *--></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"/> 
in the same way as in 1.0, since a time 
in a timezone may convert to 
a <termref def="dt-utc"/> 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"/>),
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"/>) 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" diff="del" dg="noleap"/>
</prod></defset>

<constraintnote id="con-time-leapSec" type="lexical" diff="del" dg="noleap">
<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" diff="del" dg="rq122a_sg"><code><!--* 
 * normal time *-->(<!--* 
 * hour *-->([01][0-9])|(2[0-3])<!--* 
 * min  *-->:[0-5][0-9]<!--* 
 * sec  *-->:[0-6][0-9]<!--* 
 * /normal     *-->)<!--*
 * eodfrag     *-->|(24:00:00)<br/><!--* 
 * xxx? *-->(<!--* 
 *    hour *-->([01][0-9])|(2[0-3])<!--* 
 *    min  *-->:[0-5][0-9]<!--* 
 *    sec  *-->:<phrase diff="add" dg="dt3">(<!--*
 *    normal *-->(<!--*
 *      tens *--></phrase>[0-<!--*
 *      ...  *--><phrase diff="del" dg="dt3">6</phrase><phrase diff="add" dg="dt3">5</phrase>]<!--*
 *      ones *-->[0-9]<phrase diff="add" dg="dt3"><!--*
 *           *-->)<!--*
 *   sec=60  *-->|(60)<!--*
 *           *-->)<!--*
 * secfrag   *-->(.[0-9]+)?)</phrase><!--*
 * eodfrag   *-->|(24:00:00<phrase diff="add" dg="dt3">(.[0-9]+)?</phrase>)<br/><!--*
 *           *-->&nbsp;&nbsp;&nbsp;<!--*
 * tz   *-->([+\-](0[0-9])|(1[0-4]):[0-5][0-9])?</code></display>
<display diff="add" dg="rq122a_sg"><code>
(((([01][0-9])|(2[0-3])):([0-5][0-9]):(([0-5][0-9])(\.[0-9]+)?))<br/>
&nbsp;&nbsp;|(24:00:00(\.0+)?))<br/>
(Z|((+|-)(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 diff="del" dg="rq21-lexmaps">The lexical mapping and canonical mapping
for <dtref ref="time"/> are the following functions:

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

<p diff="add" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="time"/> is
<pfref ref="vp-timeLexRep"/>; the canonical mapping is
<pfref ref="vp-timeCanRep"/>.
</p>
</div4>

<div4 id="time-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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"/> 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"/>) 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"/>.&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>

<!--* strictly speaking, dt2 didn't delete this, just moved it into
    * the new section immediately following.  (Silently at first;
    * I found it missing when I collated 1.0 against a reconstruction
    * of 1.0 based on our diff markup, 26 August 2005.)
    * We could hack around this the way we do in rq21-string-hack,
    * but it's late, I'm tired, and I won't do it tonight.
    *-->
<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 as well.</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"/>.</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 
<phrase diff="del" dg="partialfix"><specref ref="year-sec-conformance"/></phrase><phrase diff="add" dg="partialfix"><specref ref="partial-implementation"/></phrase>
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"/> 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 diff="del" dg="rq21-lexmaps">The lexical mapping and canonical mapping
for <dtref ref="date"/> are the following functions:

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

<p diff="add" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="date"/> is <pfref ref="vp-dateLexRep"/>.
The canonical mapping is <pfref ref="vp-dateCanRep"/>.
</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 
<phrase diff="del" dg="partialfix"><specref ref="year-sec-conformance"/></phrase><phrase diff="add" dg="partialfix"><specref ref="partial-implementation"/></phrase>
which applies to the year part of this datatype as well.</p>
</note>

<div4 id="gYearMonth-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"/>.</p>

<note>
<p>See the conformance note in 
<phrase diff="del" dg="partialfix"><specref ref="year-sec-conformance"/></phrase><phrase diff="add" dg="partialfix"><specref ref="partial-implementation"/></phrase>
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"/>
 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="del" dg="dt3.add.rq21-lexmaps.del">The 
lexical mapping and canonical mapping 
for <dtref ref="gYearMonth"/> are the following functions:

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

<p diff="add" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="gYearMonth"/> is <pfref ref="vp-gYearMonthLexRep"/>.
The canonical mapping is <pfref ref="vp-gYearMonthCanRep"/>.
</p>
</div4>

<div4 id="gYearMonth-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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="gYear-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"/>.</p>

<note>
<p>See the conformance note in 
<phrase diff="del" dg="partialfix"><specref ref="year-sec-conformance"/></phrase><phrase diff="add" dg="partialfix"><specref ref="partial-implementation"/></phrase>
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"/>
 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="del" dg="dt3.add.rq21-lexmaps.del">The lexical mapping 
and canonical mapping 
for <dtref ref="gYear"/> are the following functions:

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

</p>


<p diff="add" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="gYear"/> is <pfref ref="vp-gYearLexRep"/>.
The canonical mapping
is <pfref ref="vp-gYearCanRep"/>.
</p>
</div4>

<div4 id="gYear-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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"/>.</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"/> 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="del" dg="dt3.add.rq21-lexmaps.del">The 
lexical mapping and canonical mapping 
for <dtref ref="gMonthDay"/> are the following functions:

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

</p>

<p diff="add" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="gMonthDay"/> is <pfref ref="vp-gMonthDayLexRep"/>.
The canonical mapping is <pfref ref="vp-gMonthDayCanRep"/>.
</p>

</div4>

<div4 id="gMonthDay-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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"/> 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 diff="del" dg="rq21-lexmaps">The lexical mapping and canonical mapping for <dtref ref="gDay"/> are defined as follows:

<defsetsum ref="defs-gDayLexmap"/>
<defsetsum ref="defs-gDayCanmap"/>
</p>

<p diff="add" dg="rq21-lexmaps">The lexical mapping 
for <dtref ref="gDay"/> is <pfref ref="vp-gDayLexRep"/>.
The canonical mapping is <pfref ref="vp-gDayCanRep"/>.
</p>
</div4>

<div4 id="gDay-facets">
<head><phrase diff="del" dg="rec12-tableaux">&CFacet;s</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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"/>.</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"/> 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="del" dg="dt3.add.rq21-lexmaps.del">The 
lexical mapping and canonical mapping
for <dtref ref="gMonth"/> are defined as follows:

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

</p>

<p diff="add" dg="rq21-lexmaps">
The lexical mapping for <dtref ref="gMonth"/> is <pfref ref="vp-gMonthLexRep"/>.
The canonical mapping is <pfref ref="vp-gMonthCanRep"/>.
</p>
</div4>

<div4 id="gMonth-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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
<phrase diff="del" dg="wd-19">Alphabet in
<bibref ref="RFC2045"/></phrase><phrase diff="add" dg="wd-19">Encoding
defined in <bibref ref="RFC3548"/>, which is derived from the
encoding described in <bibref ref="RFC2045"/></phrase>.
</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" diff="del" dg="wd-19"/><bibref ref="RFC3548" diff="add" dg="wd-19"/>, 
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 <phrase diff="add" dg="wd-19">required by
<bibref ref="RFC3548"/> and is not</phrase>
mandated in the lexical forms of <term>base64Binary</term>
data<phrase diff="del" dg="wd-19"> and </phrase><phrase diff="add" dg="wd-19">. It</phrase>
<phrase diff="del" dg="wd-19">must not</phrase><phrase diff="add" dg="wd-19">&mustnot;</phrase> 
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 &mdash; 
<phrase diff="add" dg="wd-19">and less restrictive than <bibref ref="RFC3548"/>.</phrase>
<phrase diff="del" dg="wd-19">this</phrase><phrase diff="add" dg="wd-19">This</phrase> 
is not an issue in practice.&nbsp; Any string compatible with <phrase diff="del" dg="wd-19">the</phrase><phrase diff="add" dg="wd-19">either</phrase> 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.
<phrase diff="add" dg="wd-19">The possibility of ignoring whitespace
in base64 data is foreseen in clause 2.3 of <bibref ref="RFC3548"/>, but
for the reasons given there this specification does not allow implementations
to ignore non-whitespace characters which are not in the Base64 Alphabet.</phrase></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.
<phrase diff="add" dg="wd-19">It does conform with
<bibref ref="RFC3548"/>.</phrase></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"/> <phrase diff="add" dg="wd-19">and
<bibref ref="RFC3548"/></phrase> explicitly 
reference<phrase diff="del" dg="wd-19">s</phrase> 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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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 <phrase diff="del" dg="wd25">a 
Uniform Resource Identifier Reference
(URI)</phrase><phrase diff="add" dg="wd25">an
Internationalized Resource Identifier Reference
(IRI)</phrase>.&nbsp; An <term>anyURI</term> value can be absolute or relative, and may
have an optional fragment identifier (i.e., it may be 
<phrase diff="del" dg="wd25">a URI</phrase><phrase diff="add" dg="wd25">an
IRI</phrase> Reference).&nbsp; This type should be used 
<phrase diff="del" dg="wd25">to specify the intention 
that</phrase><phrase diff="add" dg="wd25">when</phrase> 
the value fulfills the role of 
<phrase diff="del" dg="wd25">a URI as defined by <bibref ref="RFC2396"/>, as amended by
<bibref ref="RFC2732"/></phrase><phrase diff="add" dg="wd25">an IRI,
as defined in <bibref ref="RFC3987"/> or its successor(s) in the IETF
Standards Track</phrase>.
</termdef>
</p>
<note>
<p><phrase diff="add" dg="wd25">IRIs may be used to locate resources
or simply to identify them. In the case where they are used to locate
resources using a URI, applications should use
the</phrase><phrase diff="del" dg="wd25">The</phrase> mapping from <term>anyURI</term> 
values to URIs 
<phrase diff="del" dg="wd25">is as defined</phrase><phrase diff="add" dg="wd25">given</phrase> 
by the URI reference escaping procedure defined in
<phrase diff="del" dg="wd25">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"/>)</phrase><phrase diff="add" dg="wd25">Section 
3.1 <xspecref href="http://www.ietf.org/rfc/rfc3987.txt">Mapping
of IRIs to URIs</xspecref> of <bibref ref="RFC3987"/>
or its successor(s) in the IETF Standards Track</phrase>.&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 
<phrase diff="del" dg="wd25"><bibref ref="RFC2396"/>, as amended by <bibref ref="RFC2732"/>, 
where appropriate to identify 
resources</phrase><phrase diff="add" dg="wd25"><bibref ref="RFC3986"/>
and its successor(s)</phrase>.</p>
</note>

<note diff="del" dg="wd25">
<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 diff="del" dg="wd25">
<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 <phrase diff="del" dg="wd25">representation</phrase><phrase diff="add" dg="wd25">mapping</phrase></head>
<p>
The <termref def="dt-lexical-space"/> of <term>anyURI</term> is
finite-length 
character sequences<phrase diff="del" dg="wd25"> 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"/></phrase>.</p>

<note diff="add" dg="wd25">
<p>For an <dtref ref="anyURI"/> value to be 
usable in practice as an IRI, the result of applying to it 
the algorithm defined in Section 3.1 of <bibref ref="RFC3987"/>
should <!--* NOT &should;, this is not a conformance criterion *-->
be a string which is a legal URI according
to <bibref ref="RFC3986"/>. (This is true at the time this document is published;
if in the future 
<bibref ref="RFC3987"/> and <bibref ref="RFC3986"/> are replaced by other specifications
in the IETF Standards Track, the relevant constraints will be those
imposed by those successor specifications.)</p>
<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, 
neither the syntactic constraints defined by the definitions of individual
schemes nor the generic syntactic constraints defined by
<bibref ref="RFC3987"/> and <bibref ref="RFC3986"/> and their
successors are part of this datatype as defined here.
Applications which depend on <dtref ref="anyURI"/> values
being legal according to the rules of 
<!--* <bibref ref="RFC3987"/>, <bibref ref="RFC3986"/> and their
successor(s) *-->
the relevant specifications <!--* ? check with NM *-->
should make arrangements to check values against the appropriate 
definitions of IRI, URI, and specific schemes.
</p>
</note>
<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 <string>%20</string>).
</p>
</note>
<p diff="add" dg="wd25">The lexical mapping for <dtref ref="anyURI"/> is
the identity mapping.</p>
<note diff="add" dg="wd25"><p>The definitions of URI in the current
IETF specifications define certain URIs as equivalent to each other.
Those equivalences are not part of this datatype as defined here:
if two <unusual>equivalent</unusual> URIs or IRIs are different character
sequences, they map to different values in this datatype.</p>
</note>
</div4>

<div4 role="1.0" id="anyURI-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>
<facets/>
</div4>
</div3>

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

<p><termdef id="dt-QName" term="QName" role="local">
<term>QName</term> represents
<xspecref href="&xmlnsspec;#dt-qualname">XML qualified
names</xspecref><phrase diff="del" dg="context">.
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</phrase><phrase diff="add" dg="context"> as defined
in</phrase> <bibref ref="XMLNS"/>.</termdef></p>

<note diff="del" dg="context">
<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>
<p diff="add" dg="wd-21">Because the lexical representations available for
any value of type <dtref ref="QName"/> vary with context, no canonical
representation is defined for QName in this specification.</p>
</note>

<div4 diff="add" dg="context">
<head>Value Space</head>

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

<vpropdef><name id="vp-qn-nSName">namespaceName</name>
<limits>an <dtref ref="anyURI"/> value</limits></vpropdef>

<vpropdef><name id="vp-qn-localPart">localPart</name>
<limits>a <xspecref href="&xmlnsspec;#NT-NCName">NCName</xspecref>&emsp;
(from <bibref ref="XMLNS"/>)</limits></vpropdef>
</defset>

<constraintnote id="con-QName-context" type="value">
<head>Prefix Context</head>
<p>The <vpropref ref="vp-qn-nSName"/> is limited to those
<dtref ref="anyURI"/> values whose corresponding URI
can be associated with an appropriate
<xspecref href="&xmlnsspec;#NT-NCName">Prefix</xspecref>
(from <bibref ref="XMLNS"/>).</p>
</constraintnote>

The content of the <termref def="dt-value-space"/> is
thus context dependent.&nbsp; An implementation is obligated to
deal with this dependency, especially in the implementation
of the <termref def="dt-lexical-mapping"/>.</p>

<p></p>

</div4>

<div4 diff="add" dg="context">
<head>Lexical Mapping</head>

<p>The <termref def="dt-lexical-space"/> of <dtref ref="QName"/> is the set
of &strings; that <termref def="dt-match"/> the
<xspecref role="nt" href="&xmlnsspec;#NT-QName">QName</xspecref>
production of <bibref ref="XMLNS"/>, provided they are in a context
where the
<xspecref role="nt" href="&xmlnsspec;#NT-Prefix">Prefix</xspecref> of the
<xspecref role="nt" href="&xmlnsspec;#NT-QName">QName</xspecref>
is properly associated with a namespace URL.</p>

<p diff="del" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="QName"/> is the following function:

<defsetsum ref="defs-QNameLexmap"/>

</p>

<p diff="add" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="QName"/> is <pfref ref="f-QNameLexmap"/>.
</p>

<note diff="add" dg="wd-21">
<p>Because the
<termref def="dt-lexical-representation">lexical representations</termref>
available for any value of type <dtref ref="QName"/> vary with context, no
<termref def="dt-canonical-representation"/> is defined for
<dtref ref="QName"/> in this specification.</p>
</note>

</div4>

<div4 dg="context" diff="add"><head/>
<div5 diff="del" dg="rec12-tableaux"><head>Simple Type Definition for QName</head>
<p>The <compref ref="std"/> of <dtref ref="QName"/> is present in every
schema.&nbsp; It has the following properties:</p>

<schemaComp id="QName-def">
<head alt="Simple Type Definition of QName"><compref ref="std"/> of 
<dtref ref="QName"/></head>
<pvlist>
<pvpair comp="std" prop="name"><string>QName</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="QName"/></pvpair>
<pvpair comp="std" prop="facets">{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>}
</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>false</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>
</div5></div4>

<div4 id="QName-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>
<facets/>

<p>The use of <termref def="dt-length"/>, <termref def="dt-minLength"/> and
<termref def="dt-maxLength"/>
on <phrase diff="add" dg="rq120"><dtref ref="QName"/> or</phrase>
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 id="NOTATION">
<head>NOTATION</head>
<p><termdef id="dt-NOTATION" term="NOTATION" role="local"><term>NOTATION</term>
represents the <xnt role="nt" href="&xmlspec;#NT-NotationType">NOTATION</xnt>
attribute
type from <bibref ref="XML"/>.<phrase diff="del" dg="context">
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).</phrase></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><phrase diff="del" dg="context">For compatibility (see <specref ref="terminology"/>)
<term>NOTATION</term></phrase><phrase diff="add" dg="context"><termref def="dt-compatibility">For
compatibility</termref> <dtref ref="NOTATION"/></phrase>
should be used only on attributes
and should only be used in schemas with no
target namespace.</p>

<p diff="del" dg="context">
<note diff="add" dg="wd-21">
<p>Because the lexical representations available for any given value
of <dtref ref="NOTATION"/> vary with context, this specification defines
no canonical representation for <dtref ref="NOTATION"/> values.</p>
</note>
</p>

<div4 diff="add" dg="context">
<head>Value Space</head>

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

<vpropdef><name id="vp-n-nSName">namespaceName</name>
<limits>an <dtref ref="anyURI"/> value</limits></vpropdef>

<vpropdef><name id="vp-n-localPart">localPart</name>
<limits>a <xspecref href="&xmlnsspec;#NT-NCName">NCName</xspecref>&emsp;
(from <bibref ref="XMLNS"/>)</limits></vpropdef>
</defset>

<constraintnote id="con-NOTATION-PrefixContext" type="value">
<head>NOTATION Prefix Context</head>
<p>The <vpropref ref="vp-n-nSName"/> is limited to those
<dtref ref="anyURI"/> values whose corresponding URI
can be associated with an appropriate
<xspecref href="&xmlnsspec;#NT-NCName">Prefix</xspecref>
(from <bibref ref="XMLNS"/>).</p>
</constraintnote>

<constraintnote id="con-NOTATION-SchemaContext" type="value">
<head>NOTATION Schema Context</head>
<p>The <vpropref ref="vp-n-nSName"/> and <vpropref ref="vp-n-localPart"/>
must match the corresponding properties of some
<phrase role="UNSURE">notation declaration component</phrase>
in the schema.</p>
</constraintnote>

The content of the <termref def="dt-value-space"/> is
thus context dependent.&nbsp; An implementation is obligated to
deal with this dependency, especially in the implementation
of the <termref def="dt-lexical-mapping"/>.</p>

</div4>

<div4 diff="add" dg="context">
<head>Lexical Mapping</head>

<p>The <termref def="dt-lexical-space"/> of <dtref ref="NOTATION"/> is the set
of &strings; that <termref def="dt-match"/> the
<xspecref role="nt" href="&xmlnsspec;#NT-NOTATION">NOTATION</xspecref>
production of <bibref ref="XMLNS"/>, provided they are in a context
where the
<xspecref role="nt" href="&xmlnsspec;#NT-Prefix">Prefix</xspecref> of the
<xspecref role="nt" href="&xmlnsspec;#NT-NOTATION">NOTATION</xspecref>
is properly associated with a namespace URL.</p>

<p diff="del" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="NOTATION"/> is the following function:

<defsetsum ref="defs-NOTATIONLexmap"/>

</p>

<p diff="add" dg="rq21-lexmaps">The lexical mapping
for <dtref ref="NOTATION"/> is <pfref ref="f-NOTATIONLexmap"/>.
</p>

<note diff="add" dg="wd-21">
<p>Because the
<termref def="dt-lexical-representation">lexical representations</termref>
available for any value of type <dtref ref="NOTATION"/> vary with context, no
<termref def="dt-canonical-representation"/> is defined for
<dtref ref="NOTATION"/> in this specification.</p>
</note>

</div4>

<div4 dg="context" diff="add"><head/>
<div5 diff="del" dg="rec12-tableaux"><head>Simple Type Definition for NOTATION</head>
<p>The <compref ref="std"/> of <dtref ref="NOTATION"/> is present in every
schema.&nbsp; It has the following properties:</p>

<schemaComp id="NOTATION-def">
<head alt="Simple Type Definition of NOTATION"><compref ref="std"/> of 
<dtref ref="NOTATION"/></head>
<pvlist>
<pvpair comp="std" prop="name"><string>NOTATION</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="NOTATION"/></pvpair>
<pvpair comp="std" prop="facets">{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>}
</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>false</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>
</div5></div4>



<div4 id="NOTATION-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>
<facets/>
<p>

The use of <termref def="dt-length"/>, <termref def="dt-minLength"/> and <termref def="dt-maxLength"/>
on <phrase diff="add" dg="rq120"><dtref ref="NOTATION"/> or</phrase>
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="rq120">Derived datatypes</phrase><phrase diff="add" dg="rq120">Other Built-in Datatypes</phrase></head>
<p>
This section gives conceptual definitions for all
<termref def="dt-built-in"/> &ordinary.d.onp;
datatypes defined by this specification. The XML representation used to define
<termref diff="del" dg="rq120" def="dt-derived"/> datatypes (whether
<termref def="dt-built-in"/> or &user-defined.x;) is
given in <phrase diff="del" dg="rq120">section </phrase><specref ref="xr-defn"/> 
and the complete
definitions of the <termref def="dt-built-in"/> &ordinary.d.onp;
datatypes are provided in <phrase diff="del" dg="rq120">Appendix A</phrase><phrase diff="add" dg="rq120">the appendix</phrase> <specref ref="schema"/>.
<!--* MSM reverts a change here.  I'd recast to avoid the point of
    * disagreement, but I don't see how.  But the specref without
    * introductory words 'the appendix' reads more awkwardly than
    * I'm willing to let stand.
    *-->
</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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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 <phrase diff="add" dg="rq100">formal</phrase> 
natural language identifiers<phrase diff="add" dg="rq100">,</phrase> 
as defined 
by <bibref ref="RFC3066"/><phrase diff="add" dg="rq100">or its
successor(s) in the IETF Standards Track</phrase>.
</termdef>
<phrase diff="del" dg="rq100">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"/>.  </phrase>The 
<phrase diff="add" dg="rq100"><termref def="dt-value-space"/>
and </phrase><termref def="dt-lexical-space"/> of
<term>language</term> 
<phrase diff="del" dg="rq100">is</phrase><phrase diff="add" dg="rq100">are</phrase> 
the set of all strings that conform to the pattern 
<display><code>[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*</code></display>
<phrase diff="add" dg="rq100">,
This is the set of strings accepted by the grammar given in
<bibref ref="RFC3066"/></phrase>.
The <termref def="dt-basetype"/> of <term>language</term> is <baseref/>.
<!--* MSM moved end of termdef away from here because termdef cannot
contain a 'display' element.  That may have been The Wrong Thing;
if anyone thinks so, let us discuss it. *--></p>


<note diff="add" dg="rq100">
<p>The regular expression above provides the only normative
  constraint on the lexical and value spaces of this type.  The
  additional constraints imposed on language identifiers by <bibref ref="RFC3066"/>
  and its successor(s), and in particular their requirement that language
  codes be registered with IANA or ISO if not given in ISO 639, are 
  not part of this datatype as defined here.</p>
</note>

<!--* (sniff)

<note diff="add" dg="rq100">
<p><bibref ref="RFC3066"/> imposes additional constraints on language codes
  which are not part of this datatype as defined here.  In particular,
  as defined here this datatype does not require that values not given 
  in ISO 639 be registered with the Internet Assigned Numbers Authority (IANA).
  Applications with that requirement should make appropriate arrangements
  at the application level.
</p>
</note>

*-->

<note diff="add" dg="rq100">
<p><bibref ref="RFC3066"/> specifies that
language codes <quote>are to be treated as case insensitive; there
exist conventions for capitalization of some of them, but these should
not be taken to carry meaning.  For instance, [ISO 3166] recommends
that country codes are capitalized (MN Mongolia), while [ISO 639]
recommends that language codes are written in lower case (mn
Mongolian).</quote> Since the <dtref ref="language"/> datatype is
derived from <dtref ref="string"/>, it inherits from 
<dtref ref="string"/> a one-to-one mapping from lexical
representations to values. The literals <string>MN</string> and
<string>mn</string> therefore correspond to distinct values and
have distinct canonical forms.  Users of this specification should be
aware of this fact, the consequence of which is that the
case-insensitive treatment of language values prescribed by 
<bibref ref="RFC3066"/> does not follow from the definition of
this datatype given here; applications which require
case-sensitivity should make appropriate adjustments.</p>
</note>

<div4 role="1.0" id="language-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>
<facets/>
</div4>

<div4 role="1.0" id="NMTOKEN-derived-types">
<head><phrase diff="del" dg="rq120">Derived</phrase><phrase diff="add" dg="rq120">Related</phrase> 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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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>
<note diff="add" dg="rec12-main">
<!--* <p diff="add" dg="rec12-tt">[RQ-141b]</p> *-->
<p>Uniqueness of items validated as <dtref ref="ID"/> is not
part of this datatype as defined here.  
When this specification is used in conjunction with
<bibref ref="structural-schemas"/>, uniqueness is enforced at a
different level, not as part of datatype validity;
see <xspecref href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.html#cvc-id">Validation Rule: Validation Root Valid (ID/IDREF)</xspecref> 
in <bibref ref="structural-schemas"/>.</p>
</note>

<div4 role="1.0" id="ID-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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>
<note diff="add" dg="rec12-main">
<!--* <p diff="add" dg="rec12-tt">[RQ-141b]</p> *-->
<p>Existence of referents for items validated as 
<dtref ref="IDREF"/> is not part of this
datatype as defined here.
When this specification is used in conjunction with
<bibref ref="structural-schemas"/>, referential integrity is enforced at a
different level, not as part of datatype validity;
see <xspecref href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.html#cvc-id">Validation Rule: Validation
Root Valid (ID/IDREF)</xspecref> in <bibref ref="structural-schemas"/>.</p>
 </note>

<div4 role="1.0" id="IDREF-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>
<facets/>
</div4>

<div4 role="1.0" id="IDREF-derived-types">
<head><phrase diff="del" dg="rq120">Derived</phrase><phrase diff="add" dg="rq120">Related</phrase> 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>
<note diff="add" dg="rec12-main">
<!--* <p diff="add" dg="rec12-tt">[RQ-141b]</p> *-->
<p>Existence of referents for items validated as 
<dtref ref="IDREFS"/> is not
part of this datatype as defined here.  
When this specification is used in conjunction with
<bibref ref="structural-schemas"/>, referential integrity is enforced at a
different level, not as part of datatype validity;
see <xspecref href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.html#cvc-id">Validation Rule: 
Validation Root Valid (ID/IDREF)</xspecref> in <bibref ref="structural-schemas"/>.</p>
 </note>

<div4 role="1.0" id="IDREFS-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>
<facets/>
</div4>

<div4 role="1.0" id="ENTITY-derived-types">
<head><phrase diff="del" dg="rq120">Derived</phrase><phrase diff="add" dg="rq120">Related</phrase> 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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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="unsignedShort-facets">
<head><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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><phrase diff="del" dg="rec12-tableaux">Constraining facets</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></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"/> 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"/>, 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><phrase diff="del" dg="rq20">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"/>.
</phrase><phrase diff="add" dg="rq20">The lexical 
space of <dtref ref="yearMonthDuration"/> consists of
strings which match the regular expression
<string>-?P((([0-9]+Y)([0-9]+M)?)|([0-9]+M))</string> or the
expression <string>-?P[0-9]+(Y([0-9]+M)?|M)</string>, but the
formal definition of <dtref ref="yearMonthDuration"/> uses a
simpler regular expression in its &pattern.tc;
facet: <string>[^DT]*</string>.  This pattern matches only 
strings of characters which contain no <mention>D</mention>
and no <mention>T</mention>, thus restricting the &lexical_space;
of <dtref ref="duration"/> to strings with no day, hour,
minute, or seconds fields.</phrase>

<defsetsum diff="add" dg="du1" ref="defs-yearMonthDurationLexmap"/>
</p>

<!--* <p diff="add" dg="rec12-tt">[RQ-141b]</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 <phrase diff="del" dg="rec12-main">datatype definitions</phrase>
<phrase diff="add" dg="rec12-main">datatypes</phrase> 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"/> is that of <dtref ref="duration"/> restricted in its 
range to the <termref def="dt-lexical-space"/> (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"/> in this datatype since its
<termref def="dt-canonical-representation"/> in <dtref ref="duration"/> (<string>PT0S</string>)
 is not in the 
<termref def="dt-lexical-space"/> of <dtref ref="yearMonthDuration"/>.</p>
</note>

</div4>

<div4 id="YearMonthDuration-facets">
<head><phrase diff="del" dg="rec12-tableaux">&CFacet;s</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>

<facets/>

</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"/> 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"/>, 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><phrase diff="del" dg="rq20">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"/>.
</phrase><phrase diff="add" dg="rq20">The lexical space of 
<dtref ref="dayTimeDuration"/> consists of
strings in the &lexical_space; of <dtref ref="duration"/> which 
<!--* match the regular expression <string>[^YM]*(T.*)?</string>; *-->
match the regular expression <string>[^YM]*[DT].*</string>;
this pattern eliminates all durations with year or month fields,
leaving only those with day, hour, minutes, and/or seconds
fields.</phrase>

<defsetsum diff="add" dg="du1" ref="defs-dayTimeDurationLexmap"/>
</p>

<!--* <p diff="add" dg="rec12-tt">[RQ-141b]</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 <phrase diff="del" dg="rec12-main">datatype definitions</phrase>
<phrase diff="add" dg="rec12-main">datatypes</phrase> 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"/> is that of <dtref ref="duration"/> restricted 
<phrase diff="del" dg="du2">in its 
range to the <termref def="dt-lexical-space"/> (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><phrase diff="del" dg="rec12-tableaux">&CFacet;s</phrase>
<phrase diff="add" dg="rec12-tableaux">Facets</phrase></head>

<facets/>

</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 diff="add" dg="rec12-tt">[RQ-141b]</p> *-->
<p diff="add" dg="rec12-main">The preceding sections of this
specification have described datatypes in a way largely 
independent of their use in the particular context of 
<xtermref href="&xsdl;#key-va">schema-aware processing</xtermref> as 
defined in <bibref ref="structural-schemas"/>.</p>

<p diff="add" dg="rec12-main">
This section presents the mechanisms necessary to integrate datatypes into 
the context of <bibref ref="structural-schemas"/>, mostly in terms of
the <xtermref href="&xsdl;#key-component">Schema Component</xtermref>
abstraction introduced there.  The account of datatypes given in this
specification is also intended to be useful in other contexts.
Any specification or other formal system intending to use datatypes as
defined above, particularly if definition of new datatypes via
facet-based restriction is envisaged, will need to provide analogous
mechanisms for some, but not necessarily all, of what follows below.
For example, the <propref comp="std" prop="target namespace"/> and
<propref comp="std" prop="final"/> properties are required because of
particular aspects of <bibref ref="structural-schemas"/> which are not
in principle necessary for the use of datatypes as defined here.</p>

<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 <phrase diff="del" dg="rec12-main">datatype (</phrase>schema<phrase diff="del" dg="rec12-main">)</phrase> components,
see <xspecref href="&xsdl;#components">Schema Component Details</xspecref>
of <bibref ref="structural-schemas"/>.
</p>
 
 <p><termdef term="owner" id="dt-owner" diff="add" dg="pattern-1929">A
component may be referred to as the <term>owner</term> of its properties, and of the values of
those properties.</termdef></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"/> datatypes, 
identifying a datatype with its definition in this specification.</p></item>
<item><p>In the case of <termref def="dt-constructed"/> 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" showAKO="false"/> 
<microCompdef name="Scope" abbrev="sc_s" diff="add" dg="ep01-p2.add.context-2337.del"/>
<!--* diff group changed from diff='del' dg='context-2337'.
    * context-2337 cannot delete something that has never been status-quo.
    * -MSM
    *-->
<!--* <p diff="add" dg="rec12-tt">[RQ-141b]</p> *-->
<p>
<phrase diff="del" dg="rec12-main">Datatypes</phrase><phrase diff="add" dg="rec12-main">Simple type definitions</phrase> are
identified by their <propref comp="std" prop="name"/> and <propref comp="std" prop="target namespace"/>.&nbsp; Except for
anonymous <phrase diff="del" dg="rec12-main">datatypes</phrase><phrase diff="add" dg="rec12-main"><compref ref="std"/>s</phrase> (those
with no
<propref comp="std" prop="name"/>), <phrase diff="del" dg="rec12-main">datatype definitions</phrase><phrase diff="add" dg="rec12-main"><compref ref="std"/>s</phrase> <phrase diff="del" dg="rec12-main"><termref def="dt-must"/></phrase><phrase diff="add" dg="rec12-main">&must;</phrase> be uniquely identified within a
schema.
<phrase diff="add" dg="rec12-main">Within a valid schema, 
each <compref ref="std"/> uniquely determines
one datatype.  The &value_space;, &lexical_space;,
&lexical_mapping;, etc., of a <compref ref="std"/>
are the &value_space;, &lexical_space;, etc., of the datatype
uniquely determined (or <unusual>defined</unusual>) 
by that <compref ref="std"/>.</phrase>
</p>
<p>
If <propref comp="std" prop="variety"/> is <termref def="dt-atomic"/>
then the <termref def="dt-value-space"/> of the datatype 
<!--* MSM notes that value space and lexical space are 
    * characteristic of datatypes; it was to be able to
    * talk about them extensionally (as here) that the 
    * current definition of 'datatype' was introduced.
    *
    * On the other hand, this graf would be much knarlier
    * if we forced ourselves not to say 'the value space of
    * the {base type definition}, insisting instead on
    * 'the value space of the datatype uniquely identified
    * by the {base type definition} in the context of a given
    * valid schema'.
    * To license the usage here, a paragraph was added to
    * section 2 after the definition of '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<phrase diff="add" dg="rec12-map-eff">s</phrase> 
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<phrase diff="add" dg="b2044"> a subset
(possibly an improper subset) of</phrase> 
the union of the <termref def="dt-value-space"/>s 
of each 
<phrase diff="del" dg="rec12-main">datatype</phrase><phrase diff="add" dg="rec12-main"><compref ref="std"/></phrase> 
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"/><phrase diff="add" dg="rec12-main">,
unless the <propref comp="std" prop="base type definition"/>
is <dtref ref="anySimpleType"/></phrase>.
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"/><phrase diff="add" dg="b2044">, and if <propref comp="std" prop="item type definition"/> is &union;
then all its <termref def="dt-basicmember">basic members</termref>
&must; be <termref def="dt-atomic"/></phrase>.
If <propref comp="std" prop="variety"/> is <termref def="dt-union"/>
then
<propref comp="std" prop="member type definitions"/> must be a list of <phrase diff="del" dg="rec12-main">datatype definitions</phrase><phrase diff="add" dg="rec12-main"><compref ref="std"/>s</phrase>.</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 diff="add" dg="rec12-tt">[RQ-141b]</p> *-->
<p diff="del" dg="rec12-main">The value of <propref comp="std" prop="facets"/> consists of the set of
<phrase diff="del" dg="fa1.z"><termref def="del-dt-facet"/>s</phrase><phrase diff="add" dg="fa1.z"><phrase diff="del" dg="wd-11"><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 diff="del" dg="rec12-main">
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 diff="add" dg="rec12-main">The <propref comp="std" prop="facets"/> property
determines the &value_space; and &lexical_space; of the datatype
being defined by imposing constraints which must be satisfied by values and
<termref def="dt-lexical-representation">lexical representations</termref>.
</p>

<p diff="add" dg="rec12-main">
The <propref comp="std" prop="fundamental facets"/> property provides some
basic information about the datatype being defined: its cardinality,
whether an ordering is defined for it by this specification,
whether it has upper and lower bounds, and whether it is numeric.
</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 <pt>restriction</pt>,
<pt>list</pt> and <pt>union</pt> prevent further derivations<phrase diff="add" dg="rec12-main"> of <compref ref="std"/>s</phrase>
by &fb-restriction.xr;, <termref def="dt-list"/> and
<termref def="dt-union"/> respectively<phrase diff="del" dg="rec12-main">.</phrase><phrase diff="add" dg="rec12-main">; the explicit value <pt>extension</pt> prevents any derivation of <compref ref="ctd" name="Complex Type Definitions"/> by extension.</phrase>
<!--* Problem: ctd is not an ID in this document, so we can't use 
    * <compref ref="ctd"/>, which would be the normal thing :-( (HST)
    *--> 
</p>
 <p diff="add" dg="context-2337">The <propref comp="std" prop="context"/>
property is only relevant for anonymous type definitions, for which its value
is the component in which this type definition appears as the value of a
property, e.g. <propref comp="std" prop="item type definition"/> or <propref comp="std" prop="base type definition"/>.</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" type="simpleType" diff="add" dg="rec12-map"/>
 <reprelt eltname="old-simpleType" diff="del" dg="rec12-map"/>
 <reprelt eltname="restriction" diff="add" dg="rec12-map"/>
 <reprelt eltname="list" diff="add" dg="rec12-map"/>
 <reprelt eltname="union" diff="add" dg="rec12-map"/>
<reprcomp abstract="Simple Type Definition" ref="dc-defn">
<propmap comp="std" prop="name">
The &v-value; of the 
<phrase diff="del" dg="rec12-map"><code>name</code></phrase><phrase diff="add" dg="rec12-map"><att>name</att></phrase> &i-attribute;, if 
present<phrase diff="add" dg="rec12-map"> on the <eltref ref="simpleType"/> element</phrase>,
otherwise <xtermref href="&xsdl;#key-null"><phrase diff="del" dg="rec12-map">null</phrase><phrase diff="add" dg="rec12-map">absent</phrase></xtermref>
</propmap>
 <propmap comp="std" prop="target namespace">
The &v-value; of the 
<phrase diff="del" dg="rec12-map"><code>targetNamespace</code></phrase><phrase diff="add" dg="rec12-map"><att>targetNamespace</att></phrase> &i-attribute;
of the parent <phrase diff="del" dg="rec12-map"><code>schema</code></phrase><phrase diff="add" dg="rec12-map"><el>schema</el></phrase> element information 
item<phrase diff="add" dg="rec12-map">, if present,
otherwise <xtermref href="&xsdl;#key-null">absent</xtermref></phrase>.</propmap>
<propmap comp="std" prop="base type definition" diff="add" dg="rec12-map">
<olist role="Caseval">
<item>
<p role="if">the <eltref ref="restriction"/> alternative is chosen</p>
<p role="then">the type definition <xtermref href="&xsdl;#src-resolve">resolved</xtermref> to by the
&v-value; of the <code>base</code> &i-attribute; of <eltref ref="restriction"/>, 
if present, otherwise the
type definition corresponding to the <eltref ref="simpleType"/> among
the &i-children; of <eltref ref="restriction"/>.</p>
</item>
<item>
<p role="if">the <eltref ref="list"/> or <eltref ref="union"/> alternative is chosen</p>
<p role="then"><termref def="anySimpleType-def">anySimpleType</termref>.</p>
</item>
</olist>
</propmap>
<propmap comp="std" prop="final" diff="del" dg="rec12-map">
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 diff="del" dg="dpno">
       <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>
<!--* 2005-08-27: the following Note was marked diff="add" dg="wdd",
    * but that appears to be in error: the movement of the note
    * from inside the list above, and its rephrasing, were part of
    * the newOrg material, as is clear in 1.7.2.94.  When I
    * fixed a validity error here in v.95, I mislabeled this
    * duplicate note as wdd instead of dpno. -MSM
    *-->
<note diff="add" dg="dpno">
<p>Although the <att>finalDefault</att> attribute of a <el>schema</el> 
may include &strings; 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="final" diff="add" dg="rec12-map">
A subset of 
<code>{</code><pt>restriction</pt>, <pt>extension</pt>, <pt>list</pt>,
<pt>union</pt><code>}</code>, determined as follows.
<termdef role="local" term="FS" id="lt-vs">Let
<term>FS</term> be
the &v-value; of the
<att>final</att> &i-attribute;, 
if present, otherwise the &v-value; of the
<att>finalDefault</att> &i-attribute; of the ancestor
<el>schema</el> element, 
if present, otherwise the empty string.</termdef>  Then the property value is
<olist role="caseval">
    <item>
     <p role="if"><termref def="lt-vs">FS</termref> is the empty string</p>
     <p role="then">the empty set;</p>
    </item>
    <item>
     <p role="if"><termref def="lt-vs">FS</termref> is <string>#all</string></p>
     <p role="then"><code>{</code><pt>restriction</pt>, <pt>extension</pt>, <pt>list</pt>,
<pt>union</pt><code>}</code>;</p>
    </item>
    <item>
     <p role="otherwise">Consider <termref def="lt-vs">FS</termref> as
a space-separated list, and include <pt>restriction</pt> if
<string>restriction</string> is in that list, and similarly for
<pt>extension</pt>, <pt>list</pt> and <pt>union</pt>.
</p>
      <!-- HST doesn't think this is actually true <p>Although the <att>finalDefault</att> &i-attribute; of
       <el>schema</el> may include other values,
       those values
       &must; be ignored in the determination of <propref comp="std" prop="final"/>
       </p> -->
</item>
</olist>
</propmap>
 <propmap comp="std" prop="context" diff="add" dg="context-2337">
  <olist role="Caseval">
   <item>
    <p role="if">the
<att>name</att> &i-attribute; is present</p>
    <p role="then"><xtermref href="&xsdl;#key-null">absent</xtermref></p>
   </item>
   <item>
    <p role="otherwise">
     <olist role="caseval">
     <item>
    <p role="if">the parent element information item is <eltref ref="attribute"/></p>
    <p role="then">the corresponding <compref name="Attribute Declaration" ref="ad"/></p>
   </item>
   <item>
    <p role="if">the parent element information item is <eltref ref="element"/></p>
    <p role="then">the corresponding <compref name="Element Declaration" ref="ed"/></p>
   </item>
   <item>
    <p role="if">the parent element information item is <eltref ref="list"/> or <eltref ref="union"/></p>
    <p role="then">the <compref name="Simple Type Definition" ref="std"/>
corresponding to the grandparent <eltref ref="simpleType"/> element information item</p>
   </item>
      <item>
    <p role="otherwise">(the parent element information item is <eltref ref="restriction"/>), 
     <olist role="caseval">
      <item>
       <p role="if">the grandparent element information item is <eltref ref="simpleType"/></p>
       <p role="then">the <compref name="Simple Type Definition" ref="std"/>
corresponding to the grandparent</p>
      </item>
      <item>
       <p role="otherwise">(the grandparent element information item is <eltref ref="simpleContent"/>), 
     the <compref name="Simple Type Definition" ref="std"/> which is the
<xpropref href="http://www.w3.org/TR/2005/WD-xmlschema11-1-20050224/structures.html#ctd-content_type" role="comp">content type</xpropref> of the <compref name="Complex Type Definition" ref="ctd"/>
corresponding to the great-grandparent <eltref ref="complexType"/> element information item.</p>
      </item>
     </olist>
    </p>
   </item>
    </olist>
    </p>
   </item>
  </olist>
 </propmap>
<propmap comp="std" prop="variety" diff="add" dg="rec12-map">If 
the <eltref ref="list"/> alternative is chosen,
then <pt>list</pt>, otherwise if the <eltref ref="union"/> alternative is
chosen, then <pt>union</pt>, otherwise (the <eltref ref="restriction"/>
alternative is chosen)<phrase diff="del" dg="rec12-map-eff">, then</phrase> the <propref comp="std" prop="variety"/>
of the <propref comp="std" prop="base type definition"/>.</propmap>
<propmap comp="std" prop="annotations" diff="del" dg="rec12-map">
<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 
&absent.pt.x;</phrase>
</propmap>
   <propmap comp="std" prop="facets" diff="add" dg="rec12-map">
    <olist role="Caseval">
     <item>
<p role="if">the <eltref ref="restriction"/> alternative is chosen</p>
<p role="then">a set of <compref ref="f"/> components <xtermref href="&xsdl;#key-facets-restriction">constituting a restriction</xtermref>
of the <propref comp="std" prop="facets"/> of the
<propref comp="std" prop="base type definition"/> with respect to a
set of <compref ref="f"/> components corresponding to the appropriate element information items among the
&i-children; of <eltref ref="restriction"/> (i.e. those which specify facets, if any), as
defined in <xspecref href="&xsdl;#st-restrict-facets">Schema Component Constraint: Simple Type Restriction (Facets)
</xspecref>.</p></item>
     <item diff="add" dg="rec12-map-eff">
      <p role="if">the <eltref ref="list"/> alternative is chosen</p>
      <p role="then">a set with one member, 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 role="otherwise">the empty set</p></item></olist>
</propmap>
<propmap comp="std" prop="annotations" diff="add" dg="rec12-map">
A sequence of <compref ref="a" name="Annotation"/> components corresponding to
<olist>
  <item><p>
 the <eltref ref="annotation"/>
element information item in the &i-children;, if present;</p></item>
  <item><p>If the <eltref ref="restriction"/> alternative is chosen,
then
 the <eltref ref="annotation"/>
element information item in the &i-children; of the <eltref ref="restriction"/>, if present;</p></item>
  <item><p>If the <eltref ref="list"/> alternative is chosen,
then
 the <eltref ref="annotation"/>
element information item in the &i-children; of the <eltref ref="list"/>,
 if present;</p></item>
  <item><p>If the <eltref ref="union"/> alternative is chosen,
then
 the <eltref ref="annotation"/>
element information item in the &i-children; of the <eltref ref="union"/>,
 if present.</p></item>
</olist>
<!--* MSM notes a certain amount of inconsistency and uncertainty
    * about tagging things 'el' or 'eltref' or ... 
    * HST observes that 'el' is for when the thing is not defined in part
    * 2, 'eltref' otherwise.
    *-->
</propmap>
</reprcomp>
<p diff="add" dg="rec12-map"><termdef term="derived from" id="derived2" diff="del" dg="rec12-map-1853">A <compref ref="std"/>
<var>R</var> is <term>derived from</term> another <compref ref="std"/>
<var>B</var> if and only if <var>R</var> and <var>B</var> are the same
<compref ref="td" name="type definition"/> or <var>R</var>'s 
<propref comp="std" prop="base type definition"/> is 
<termref def="derived2">derived from</termref> <var>B</var>.</termdef>
<termdef term="ancestor" id="std-ancestor" diff="add" dg="rec12-map-1853">The
<term>ancestors</term> of a 
<xtermref href="&xsdl;#key-typeDefn">type definition</xtermref> are its 
<propref comp="std" prop="base type definition"/> and the 
<termref def="std-ancestor">ancestors</termref> of its 
<propref comp="std" prop="base type definition"/>.</termdef>
<phrase diff="add" dg="rec12-map-1853">(The ancestors of a 
<compref ref="std"/> <var>T</var> in the type hierarchy are themselves
<xtermref href="&xsdl;#key-typeDefn">type definitions</xtermref>; they are distinct from
the XML elements which may be ancestors, in the XML document
hierarchy, of the <eltref ref="simpleType"/> element which 
declares <var>T</var>.)
</phrase></p>

<p diff="add" dg="rec12-map">If the <propref comp="std" prop="variety"/> is <pt>atomic</pt>, the following additional property
<phrase diff="del" dg="rec12-map">mappings also apply</phrase><phrase diff="add" dg="rec12-map">mapping also applies</phrase>:</p>

  <reprcomp abstract="Atomic Simple Type Definition" ref="xr-defn" diff="add" dg="rec12-map">
   <propmap comp="std" prop="primitive type definition"><phrase diff="del" dg="sfs-1933">If the
corresponding <compref ref="std"/> is 
<termref def="dt-special">special</termref> or 
<termref def="dt-primitive">primitive</termref>, then as specified in 
<specref ref="builtin-stds"/>, </phrase><phrase diff="del" dg="rec12-map-eff">otherwise the <compref ref="std"/> among 
<phrase diff="del" dg="rec12-map-1853">those from which 
the</phrase><phrase diff="add" dg="rec12-map-1853">the 
<termref def="std-ancestor">ancestors</termref> of the</phrase> containing
<compref ref="std"/><phrase diff="del" dg="rec12-map-1853"> is
<termref def="derived2">derived</termref></phrase> which corresponds
to a <termref def="dt-primitive">primitive</termref>
datatype</phrase><phrase diff="add" dg="rec12-map-eff"><phrase diff="del" dg="sfs-1933">otherwise, among</phrase><phrase diff="add" dg="sfs-1933">From among</phrase> the <termref def="std-ancestor">ancestors</termref> of this <compref ref="std"/>, that <compref ref="std"/> which corresponds to a <termref def="dt-primitive">primitive</termref> datatype</phrase>.</propmap>
</reprcomp>

<note role="example" diff="add" dg="rec12-map">
<p>
An electronic commerce schema might define a datatype called
<emph diff="del" dg="rq120">Sku</emph><phrase diff="add" dg="rq120"><string>SKU</string></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 &pattern.tc; facet.
</p>
<eg>&lt;simpleType name='<phrase diff="del" dg="rq120">Sku</phrase><phrase diff="add" dg="rq120">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, <emph diff="del" dg="rq120">Sku</emph><phrase diff="add" dg="rq120"><string>SKU</string></phrase> is the name of the new
&user-defined.x; 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">&pattern.tc; 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>
  <p diff="add" dg="rec12-map">If the <propref comp="std" prop="variety"/> is <pt>list</pt>, the following
additional property mappings also apply:</p>
  <reprcomp abstract="List Simple Type Definition" ref="xr-defn" diff="add" dg="rec12-map">
   <propmap comp="std" prop="item type definition">
    <olist role="Caseval">
     <item diff="del" dg="rec12-map-eff">
      <p role="if">the <eltref ref="list"/> alternative is chosen</p>

      <p role="then">the <compref ref="std"/> &resolved..x; to by the
&v-value; of the <code>itemType</code> &i-attribute; of <eltref ref="list"/>, if present, otherwise the
<compref ref="std"/> corresponding to the <eltref ref="simpleType"/> among
the &i-children; of <eltref ref="list"/>.</p>
     </item>
     <item diff="add" dg="rec12-map-eff">
      <p role="if">the <propref comp="std" prop="base type definition"/> is <termref def="anySimpleType-def">anySimpleType</termref></p>

      <p role="then">the <compref ref="std"/> (a) &resolved..x; to by the
&v-value; of the <code>itemType</code> &i-attribute; of <eltref ref="list"/>,
or (b) <!--* , MSM silently deletes stray comma inserted by mistake in WG-approved text *-->
corresponding to the <eltref ref="simpleType"/> among
the &i-children; of <eltref ref="list"/>, whichever is present.
      <note>
<p><phrase diff="del" dg="rec12-map-eff-pentimenti">A</phrase><phrase diff="add" dg="rec12-map-eff-pentimenti">In this
case, a</phrase> <eltref ref="list"/> element will invariably be present; it will
invariably have either an <code>itemType</code> &i-attribute; or a <eltref ref="simpleType"/> &i-child;, but not both.</p>
</note>
      </p>
     </item>
     <item diff="del" dg="rec12-map-eff">
      <p role="if">the <eltref ref="restriction"/> <phrase diff="del" dg="rec12-map-eff">option</phrase><phrase diff="add" dg="rec12-map-eff">alternative</phrase> is chosen</p>
      <p role="then">the <propref comp="std" prop="item type definition"/> of the <propref comp="std" prop="base type definition"/>.</p>
     </item>
     <item diff="add" dg="rec12-map-eff">
      <p role="otherwise">(that is, the <propref comp="std" prop="base type definition"/> is not <termref def="anySimpleType-def">anySimpleType</termref>), the <propref comp="std" prop="item type definition"/> of the <propref comp="std" prop="base type definition"/>.
<note diff="add" dg="edinburgh.refuses.to.die">
<p>In this case, a <eltref ref="restriction"/> element will invariably be present.</p>
</note></p>
     </item>
    </olist>
   </propmap>
</reprcomp>
<note role="example" diff="add" dg="rec12-map">
<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
&user-defined.x; datatype, <dtref ref="float"/> is its
<termref def="dt-itemType"/> and <termref def="dt-list"/> is the
derivation method.
</p>
</note>
<p diff="add" dg="rec12-map">If the <propref comp="std" prop="variety"/> is 
<pt>union</pt>, the following
additional property mappings also apply:</p>
  <reprcomp abstract="Union Simple Type Definition" ref="xr-defn" diff="add" dg="rec12-map">
   <propmap comp="std" prop="member type definitions">
    <olist role="Caseval">
     <item diff="del" dg="rec12-map-eff">
      <p role="if">the <eltref ref="union"/> alternative is chosen</p>
      <p role="then"><termdef id="key-exm-old" term="explicit members" role="local">define the
<term>explicit members</term> as</termdef> the <compref ref="std"/>s &resolved..x; to by the
items in the &v-value; of the <code>memberTypes</code>
&i-attribute;, if any, followed by the
<compref ref="std"/>s corresponding to the <eltref ref="simpleType"/>s among the
&i-children; of <eltref ref="union"/>, if any.  The actual value is
then formed by replacing any <pt>union</pt> <compref ref="std"/>s
in the <termref def="key-exm">explicit members</termref> with the members of
their <propref comp="std" prop="member type definitions"/>, in order.</p>
     </item>
     <item diff="add" dg="rec12-map-eff">
      <p role="if">the <propref comp="std" prop="base type definition"/> is <termref def="anySimpleType-def">anySimpleType</termref></p>
      <p role="then"><phrase diff="del" dg="b2044"><termdef id="key-exm" term="explicit members" role="local">define the
<term>explicit members</term> as
<!--* MSM move termdef end-tag from here, where it seems to make no sense ... *-->
a sequence of 
<phrase diff="add" dg="rec12-map-eff-pentimenti">(a)</phrase>
the <compref ref="std"/>s <phrase diff="del" dg="rec12-map-eff-pentimenti">(a) 
</phrase>&resolved..x; to by the items in the
&v-value; of the <code>memberTypes</code> &i-attribute; of <eltref ref="union"/>,
if any<phrase diff="add" dg="rec12-map-eff-pentimenti">,</phrase> and 
(b)<phrase diff="del" dg="rec12-map-eff-pentimenti">,</phrase> 
<phrase diff="add" dg="rec12-map-eff-pentimenti">those</phrase>
corresponding to the <eltref ref="simpleType"/>s among
the &i-children; of <eltref ref="union"/>, if any, in order.  
</termdef></phrase><!--* ... to here, where it does make sense, and appears to be valid. *--><phrase diff="add" dg="b2044">the sequence of 
(a) the <compref ref="std"/>s (a) &resolved; to by the items in the
&v-value; of the <code>memberTypes</code> &i-attribute; of <eltref ref="union"/>,
if any, and 
(b) 
those corresponding to the <eltref ref="simpleType"/>s among
the &i-children; of <eltref ref="union"/>, if any, in order.  
</phrase>
<phrase diff="del" dg="b2044">The actual value is
then formed by replacing any <pt>union</pt> <compref ref="std"/>s
in the <termref def="key-exm">explicit members</termref> with the members of
their <propref comp="std" prop="member type definitions"/>, in order.</phrase>
      <note>
<p><phrase diff="del" dg="rec12-map-eff-pentimenti">A</phrase><phrase diff="add" dg="rec12-map-eff-pentimenti">In this
case, a</phrase> <eltref ref="union"/> element will invariably be present; it will
invariably have either a <code>memberTypes</code> &i-attribute; or one or more <eltref ref="simpleType"/> &i-children;, or both.</p>
</note>
      </p>
     </item>
     <item diff="del" dg="rec12-map-eff">
      <p role="if">the <eltref ref="restriction"/> <phrase diff="del" dg="rec12-map-eff">option</phrase><phrase diff="add" dg="rec12-map-eff">alternative</phrase> is chosen</p>
      <p role="then">the <propref comp="std" prop="member type definitions"/> of the <propref comp="std" prop="base type definition"/>.</p>
     </item>
     <item diff="add" dg="rec12-map-eff">
      <p role="otherwise">(that is, the <propref comp="std" prop="base type definition"/> is not <termref def="anySimpleType-def">anySimpleType</termref>), the <propref comp="std" prop="member type definitions"/> of the <propref comp="std" prop="base type definition"/>.
<note diff="add" dg="edinburgh.refuses.to.die">
<p>In this case, a <eltref ref="restriction"/> element will invariably be present.</p>
</note></p>
     </item>
    </olist>
   </propmap>
</reprcomp>
<note role="example" diff="add" dg="rec12-map">
<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"/>
<phrase diff="del" dg="rq120">type definition</phrase><compref ref="std"/>
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>
</reprdef>
<!--* MSM untags the following div4 2005-08-27 in the belief that it's
    * artefactual, a hack to work around the deficiencies of our diff
    * markup.  MSM substitutes a different hack, making the diff groups
    * on all the following paragraphs into portmanteaus.
    *-->
<!--* <div4 diff="del" dg="rec12-map"><head>missing</head> *-->
<p diff="del" dg="dpno.del.rec12-map.del">
A <termref diff="del" dg="rq120" def="dt-derived"/> datatype can be 
&constructed.x; 
from <phrase diff="del" dg="rq120c">a <termref def="dt-primitive"/> datatype or 
<phrase diff="del" dg="rq120o">another
<termref def="dt-derived"/></phrase></phrase><phrase diff="add" dg="rq120">an
<termref def="dt-ordinary"/></phrase> datatype by one of three means:
by <emph><phrase diff="del" dg="rq120">restriction</phrase><phrase diff="add" dg="rq120"><termref def="dt-fb-restriction"/></phrase></emph>, 
by <emph><phrase diff="del" dg="rq120">list</phrase><phrase diff="add" dg="rq120">&list;</phrase></emph> 
or by 
<emph><phrase diff="del" dg="rq120">union</phrase><phrase diff="add" dg="rq120">&union;</phrase></emph>.</p>

<p diff="add" dg="dpno.add.rec12-map.del">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.add.rec12-map.del">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> *-->

<div4 role="1.0" id="derivation-by-restriction" diff="del" dg="rec12-map">
<head><phrase diff="del" dg="rq120">Derivation by restriction</phrase><phrase diff="add" dg="rq120">Facet-based Restriction</phrase></head>
<reprdef>
<reprelt eltname="del-restriction"/>
<reprcomp abstract="Simple Type Definition" ref="dc-defn">
<propmap comp="std" prop="variety">
The 
<phrase diff="del" 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 <phrase diff="del" dg="wd-11">union of the </phrase>set of 
<phrase diff="del" dg="fa1"><specref ref="del.facets"/></phrase><phrase diff="add" dg="fa1"><phrase diff="del" dg="wd-11"><termref def="dt-fundamental-facet">fundamental facets</termref> and</phrase> 
<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..x; 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" diff="del" dg="rec12-map">
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
<emph diff="del" dg="rq120">Sku</emph><phrase diff="add" dg="rq120"><string>SKU</string></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 &pattern.tc; facet.
</p>
<eg>&lt;simpleType name='<phrase diff="del" dg="rq120">Sku</phrase><phrase diff="add" dg="rq120">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, <emph diff="del" dg="rq120">Sku</emph><phrase diff="add" dg="rq120"><string>SKU</string></phrase> is the name of the new
&user-defined.x; 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">&pattern.tc; 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="construction-by-list" diff="del" dg="rec12-map">
<head><phrase diff="del" dg="rq120">Derivation by list</phrase><phrase diff="add" dg="rq120">Construction by List</phrase></head>
<reprdef>
 <reprelt eltname="old-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..x; 
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 &constructed.x;
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
&user-defined.x; 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<phrase diff="add" dg="rq120"> 
by <termref def="dt-fb-restriction"/></phrase>, 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>&pattern.tc;</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="construction-by-union" diff="del" dg="rec12-map">
<head><phrase diff="del" dg="rq120">Derivation by
union</phrase><phrase diff="add" dg="rq120">Construction
by Union</phrase></head>
<reprdef>
<reprelt eltname="old-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..x; 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..x; 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..x; 
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 &constructed.x;
from one or more 
<phrase diff="add" dg="rq120o"><termref def="dt-primitive"/> or
</phrase><phrase diff="add" dg="aatf"><phrase diff="del" dg="rq120">ordinary
</phrase><phrase diff="add" dg="rq120"><termref def="dt-ordinary"/>
</phrase></phrase><termref def="dt-atomic"/>,
<termref def="dt-list"/><phrase diff="add" dg="rq120">,</phrase> 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"/>
<phrase diff="del" dg="rq120">type definition</phrase><compref ref="std"/>
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<phrase diff="add" dg="rq120"> 
by <termref def="dt-fb-restriction"/></phrase>, 
<phrase diff="del" dg="rq120">the </phrase>only <phrase diff="add" dg="rq120">the</phrase> 
following<phrase diff="del" dg="rq120">
<termref def="dt-constraining-facet"/>s</phrase><phrase diff="add" dg="rq120">
<termref def="dt-constraining-facet">constraining facets</termref></phrase>
can be used:
<ulist>
<item><p>&pattern.tc;</p></item>
<item><p><termref def="dt-enumeration"/></p></item>
</ulist>
</p>

<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<phrase diff="add" dg="rec12-main-excepted">
(non-normative)</phrase></head>

<constraintnote type="src" id="src-single-facet-value">
<head>Single Facet Value</head>
<p>
Unless otherwise specifically allowed by this specification<phrase diff="add" 
dg="pattern-1929-fix">,</phrase>
<phrase diff="del" dg="pattern-1929-fix">(<specref ref="src-multiple-patterns"/> and
<specref ref="src-multiple-enumerations"/>)</phrase> 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 <phrase diff="del" dg="rec12-main-excepted">string</phrase><phrase diff="add" dg="rec12-main-excepted">&literal;</phrase> 
is datatype-valid with respect to a 
<phrase diff="del" dg="rec12-main-excepted">datatype definition</phrase> 
<phrase diff="add" dg="rec12-main-excepted"><compref ref="std"/></phrase> 
if<phrase diff="add" dg="iff"> and only if</phrase>:

</p>
<olist>
<item>
<p>
it <termref def="dt-match">matches</termref> a &literal; in the
<termref def="dt-lexical-space"/> of the<phrase diff="add" dg="rec12-main-excepted"> 
corresponding</phrase> datatype, determined as follows:
</p>
<olist>
<item>
<p>
if &pattern.tc; is a member of <propref comp="std" prop="facets"/>,
then the string must be <specref ref="cvc-pattern-valid"/>;
</p>
</item>
<item diff="del" dg="rec12-main-excepted">
<p>
if &pattern.tc; 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>
<item diff="add" dg="rec12-main-excepted">
<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 diff="add" dg="rec12-main-excepted">
<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 diff="add" dg="rec12-main-excepted">
<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>
<item>
<p>
the value denoted by the &literal; <termref def="dt-match">matched</termref> 
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 &pattern.tc;).
</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"/> 
<phrase diff="del" dg="wd-23">are dependent on
<propref comp="std" prop="base type definition"/> 
as specified in the following 
table</phrase><phrase diff="add" dg="wd-23">depend on the
<propref comp="std" prop="variety"/> and
<propref comp="std" prop="primitive type definition"/> of the
type, as follows</phrase>:
</p>
<applicable-facets/>
</constraintnote>

<constraintnote type="cos" id="cos-list-of-atomic" diff="del" dg="rec12-main-excepted">
<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" diff="del" dg="rec12-main-excepted">
<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 dg="rq120" diff="del">The definition of <dtref ref="anySimpleType"/> is
present in every schema.&nbsp; It has the following properties:</p>

<schemaComp id="del-anySimpleType-def" diff="del" dg="rq120">
<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>
<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 diff="add" dg="rec12-main-excepted">The <compref ref="std"/> of <dtref ref="anySimpleType"/> is
present in every schema.&nbsp; It has the following properties:</p>

<schemaComp id="anySimpleType-def" diff="add" dg="rec12-main">
<head>Simple type definition of <code>anySimpleType</code></head>
<pvlist>
<pvpair comp="std" prop="name"><string>anySimpleType</string></pvpair>
<pvpair comp="std" prop="target namespace"><string>http://www.w3.org/2001/XMLSchema</string></pvpair>
<pvpair comp="std" prop="final">The empty set</pvpair>
<pvpair comp="std" prop="scope" diff="del" dg="context-2337"><pt>global</pt></pvpair>
<pvpair comp="std" prop="context" diff="add" dg="context-2337"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="base type definition"><xtermref href="&xsdl;#ur-type-itself">anyType</xtermref></pvpair>
<pvpair comp="std" prop="facets">The empty set</pvpair>
<pvpair comp="std" prop="fundamental facets">The empty set</pvpair>
<pvpair comp="std" prop="variety"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="primitive type definition"><pt>absent</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 id="ast_radix_omnium">The 
definition of <dtref ref="anySimpleType"/>
is the root of the Simple Type Definition
hierarchy<phrase diff="del" dg="b2603">, and </phrase><phrase diff="add" dg="b2603">;</phrase>
as such<phrase diff="add" dg="b2603"> it</phrase> 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<phrase diff="del" dg="b2603"> thus to</phrase> the 
definition of <dtref ref="anyType"/>, 
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="del-anyAtomicType-def" diff="del" dg="rq120">
<!--* 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 diff="add" dg="rec12-main">The <compref ref="std"/> of <dtref ref="anyAtomicType"/> is
present in every schema.&nbsp; It has the following properties:</p>

<schemaComp id="anyAtomicType-def" diff="add" dg="rec12-main">
<head>Simple type definition of <code>anyAtomicType</code></head>
<pvlist>
<pvpair comp="std" prop="name"><string>anyAtomicType</string></pvpair>
<pvpair comp="std" prop="target namespace"><string>http://www.w3.org/2001/XMLSchema</string></pvpair>
<pvpair comp="std" prop="final">The empty set</pvpair>
<pvpair comp="std" prop="scope" diff="del" dg="context-2337"><pt>global</pt></pvpair>
<pvpair comp="std" prop="context" diff="add" dg="context-2337"><pt>absent</pt></pvpair>
<pvpair comp="std" prop="base type definition"><dtref ref="anySimpleType"/></pvpair>
<pvpair comp="std" prop="facets">The empty set</pvpair>
<pvpair comp="std" prop="fundamental facets">The empty set</pvpair>
<pvpair comp="std" prop="variety"><pt diff="del" dg="rec12-main">absent</pt><pt diff="add" dg="rec12-main">atomic</pt></pvpair>
<pvpair comp="std" prop="primitive type definition"><pt>absent</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 <phrase diff="del" dg="rec12-tableaux">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"/></phrase><phrase diff="add" dg="rec12-tableaux">have a very similar structure, with only the <propref comp="std" prop="name"/>, the <propref comp="std" prop="base type
definition"/> (which is self-referential), the <propref comp="std" prop="fundamental facets"/> and in one case the <propref comp="std" prop="facets"/> varying from one to the next:</phrase></p>

<schemaComp id="dummy-def" diff="add" dg="rec12-tableaux">
<head alt="Simple Type Definition corresponding to the built-in primitive datatypes"><compref ref="std"/> corresponding to the built-in primitive datatypes</head>

<pvlist>
<pvpair comp="std" prop="name">[as appropriate]</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">[this <compref ref="std"/> 
itself]</pvpair>
<pvpair comp="std" prop="facets">{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> in all cases except
<dtref ref="string"/>, which has <propref comp="f-w" prop="value"/> =
<pt>preserve</pt> and <propref comp="f-w" prop="fixed"/> = <pt>false</pt>}</pvpair>
<pvpair comp="std" prop="fundamental facets">[as appropriate]<!--{<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>}-->
</pvpair>
<pvpair comp="std" prop="scope" diff="del" dg="context-2337"><pt>global</pt></pvpair>
<pvpair comp="std" prop="context" diff="add" dg="context-2337"><pt>absent</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>Similarly, <compref ref="std"/>s 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>

<!--* 2005-08-27: MSM deletes this div2 and move the
    * (deleted) section on equality into the new
    * 'fundamental facets' section.  I have not reconstructed
    * the process by which we came to delete a section and
    * then create a section with the same name adjacent to it,
    * and move all but one of the old subsections into the new
    * section.  It presumably made sense at the time, and I don't
    * dispute that.  I only note that with the document in its
    * current state it makes no sense and can be reverted.
    *-->
<!--* <div2 id="del-rf-fund-facets" diff="del" dg="fa1"> *-->
<!--* <head>Fundamental Facets</head> *-->
<!--* div3 for 'equal' used to be here *-->
<!--* </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">
<!--* MSM deletes <phrase diff="add" dg="fa1"> around the termref, 2005-08-27.
    * Then MSM deletes the termref: it seems remarkably silly to have a 
    * hyperlink from the heading of a section to its first paragraph.
    * That's too high a price for the privilege of saying "all occurrences of
    * the string 'fundamental facet' are hyperlinked to the definition".
    * MSM also doubts that any reader expects hyperlinks from section titles.
    * If anyone does want to go back, at least tag the heading as shown in the
    * comment below, not the way it used to be, which messes up our diffs.

      <head alt="Fundamental Facets">
        <phrase diff="del" dg="fa1">Fundamental Facets</phrase>
        <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>

    * If we ever want to reconstruct the first public working draft, this
    * will need work; it appeared as "Information Facets" there.  But at
    * the moment, we don't have any such commitment.  So I'm leaving this 
    * simple for now.
    *-->
<head alt="Fundamental Facets">Fundamental Facets</head>

<issue id="RQ-24-1i" role="1.1">
<p><loc href="&reqs;#fundamentals" target="reqs">RQ-24 (systematic approach to facets)</loc></p>
<p>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"/>
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"/>
(<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="ep01-part2">The term
<compdef name="Fundamental Facet" abbrev="ff" role="termdef">
 refers to any of the components defined in this section.</compdef></p>

<p diff="add" dg="fa1">A <termref def="dt-fundamental-facet"/> 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"/> components
occur.&nbsp; <termdef term="owner" id="dt-info-facet-parent" role="local" diff="del" dg="pattern-1929"><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"/> 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"/> component occurs is that
component&apos;s <term>owner</term>.</phrase></termdef>&nbsp; Each kind of <termref def="dt-fundamental-facet"/>
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"/> component can always
be calculated from other properties of its <termref def="dt-owner"/>.&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="equal" diff="del" dg="fa1">
<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 &fb-restriction.xr; 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 &fb-restriction.xr; 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>

<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 