[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xdt:yearMonthDuration eq xs:duration

Subject: RE: xdt:yearMonthDuration eq xs:duration
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 1 Feb 2006 03:33:20 -0000
xml xs duration
Very good point. At one time we didn't allow an equality comparison between
durations, largely because of concerns about how it should be defined, given
the XML schema definition of a duration as a 6-tuple (is P1Y equal to
P12M?). In the end we did introduce this notion, partly to ensure that every
document is deep-equal to itself. I think you are right to observe that this
makes the equality operators on the subtypes redundant, and that it also
means equality between duration and one of its subtypes should be
well-defined.

Can I suggest you raise this on the W3C bugzilla?

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: Frans Englich [mailto:frans.englich@xxxxxxxxx] 
> Sent: 01 February 2006 01:05
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  xdt:yearMonthDuration eq xs:duration
> 
> 
> 
> Saxon 8.6 fails this expression with XPTY0004, "Cannot compare 
> xdt:yearMonthDuration to xs:duration":
> 
> xdt:yearMonthDuration("P200Y2M") eq xs:duration("P200Y2M")
> 
> 
> The XPath 2.0 book specifies these operators:
> 
> A eq B  xdt:yearMonthDuration     xdt:yearMonthDuration  
> A eq B  xdt:dayTimeDuration  	  xdt:dayTimeDuration  
> A eq B  xs:duration               xs:duration
> 
> It also says this:
> 
> <quote>
> Any operator listed in the operator mapping tables may be 
> validly applied to 
> an operand of type AT if the table calls for an operand of 
> type ET and 
> type-matches(ET, AT) is true (see 2.5.4 SequenceType 
> Matching). For example, 
> a table entry indicates that the gt operator may be applied 
> to two xs:date 
> operands, returning xs:boolean. Therefore, the gt operator 
> may also be 
> applied to two (possibly different) subtypes of xs:date, also 
> returning 
> xs:boolean.
> </quote>
> 
> Doesn't type-matches(xs:duration, xdt:yearMonthDuration) hold 
> true? My point 
> being that the expression should succeed because 
> xdt:yearMonthDuration is a 
> subtype of xs:duration and that the xs:duration-eq operator 
> therefore can be 
> applied. If that is the case, which I doubt, the eq/ne 
> operators for the two 
> XDT durations are redudant, since the xs:duration-eq/ne 
> operators covers 
> them.
> 
> What clause in any of the specifications disallow the above operand 
> combination? (and the others variations by the same principle)
> 
> 
> Thanks in advance,
> 
> 		Frans

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.