<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>1292</bug_id>
          
          <creation_ts>2005-05-03 13:19:37 +0000</creation_ts>
          <short_desc>[F&amp;O]  Cast xs:duration to xs:string</short_desc>
          <delta_ts>2005-09-29 10:43:30 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Functions and Operators 1.0</component>
          <version>Last Call drafts</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joanne Tong">joannet</reporter>
          <assigned_to name="Ashok Malhotra">ashok.malhotra</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>3594</commentid>
    <comment_count>0</comment_count>
    <who name="Joanne Tong">joannet</who>
    <bug_when>2005-05-03 13:19:37 +0000</bug_when>
    <thetext>According to section 17.1.2 &quot;Casting to xs:string and xdt:untypedAtomic&quot; of the 
F&amp;O spec, if a datatype is not listed in this section, and it does not have a 
canonical representation defined in Schema (which is the case for xs:duration), 
then an &quot;implementation dependent canonical representation may be used&quot;.  

According to schema 1.0, &quot;The value space of duration is a six-dimensional 
space&quot;
According to schema 1.1, &quot;Durations can be modeled in at least two ways: as six-
property tuples (...) or as two-property tuples&quot; 

For example:  cast xs:duration(&apos;P1Y13M40DT1H 61M1S&apos;) to xs:string
An implementation would likely produce one of the following results:

1. six-property model = P1Y13M40DT1H 61M1S  (no change)
2. two-property model = P25MT3463261S (months and seconds)
3. normalize based on xdt:yearMonthDuration and xdt:dayTimeDuration = 
P2Y1M40DT2H1M1S

Since xs:duration is a built-in type and casting to string is a common 
operation, casting from xs:duration to xs:string or xdt:untypedAtomic should 
not be implementation dependent.

Suggested Resolution:  3. normalize based on xdt:yearMonthDuration and 
xdt:dayTimeDuration

New bullet in section 17.1.2 Casting to xs:string and xdt:untypedAtomic

If ST is xs:duration, then let SYM be SV cast as xdt:yearMonthDuration, and let 
SDT be SV cast as xdt:dayTimeDuration;  Then the next intermediate value, TYM, 
be SYM cast as TT, and let TDT be SDT cast as TT.  If TYM is &quot;P0M&quot;, then TV is 
TDT.  Otherwise, TYM and TDT are merged according to the following rules:
	1.  If TDT is &quot;PT0S&quot;, then TV is TYM
	2.  Otherwise, TV is the concatenation of all characters in TYM and all 
characters except the first &quot;P&quot; and the optional negative sign in TDT.


Joanne
[on behalf of XTTF]</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>