Altova Mailing List Archives>Archive Index >xsl-list Archive Home >Recent entries >Thread Prev - RE: [xsl] Schema aware XPath 2.0 doubt [Thread Next] Re: [xsl] Schema aware XPath 2.0 doubtTo: xsl-list@-----.------------.--- Date: 5/11/2009 9:56:00 AM This is one of the good reasons to use general comparisons (">" rather
than "gt"). A general comparison will also succeed in comparing the
value from a document that hasn't been schema validated. In that case
the atomic value extracted from the XML document will have a type of
xs:untypedAtomic, which the general comparison will automatically cast
to the type of the other value compared - in this case an xs:date.
John
Michael Kay wrote:
> Yes, this would succeed if element x were validated as an element of type
> xs:date.
>
> The reason is that operators like "gt" that expect an atomic value, if given
> a node as an argument, will automatically "atomize" the node. This extracts
> the typed value, which in this case is an atomic value of type xs:date.
>
> Michael Kay
> http://www.saxonica.com/
>
>> -----Original Message-----
>> From: Mukul Gandhi [mailto:gandhi.mukul@g...]
>> Sent: 09 May 2009 05:38
>> To: xsl-list@l...
>> Subject: [xsl] Schema aware XPath 2.0 doubt
>>
>> Hi all,
>> Let's say, I have following XML document:
>>
>> <x>2008-12-01</x>
>>
>> And the following XPath 2.0 expression,
>>
>> [1]
>> x gt xs:date('2007-12-01')
>>
>> The evaluation of this expression fails, with non schema
>> aware XSLT 2.0/XPath 2.0 system (as x is not of type xs:date.
>> it's actually an element).
>>
>> But if we had a Schema aware XSLT 2.0/XPath 2.0 system, and
>> the above XML document was validated with a Schema (with
>> element x being assigned a Schema type xs:date), would the
>> above XPath 2.0 expression succeed in this case (i.e., with a
>> Schema aware XPath 2.0 system)?
>>
>> The XPath 2.0 specification for operator, op:date-greater-than (ref,
>> http://www.w3.org/TR/xpath-functions/#func-date-greater-than)
>> specifies:
>>
>> op:date-greater-than($arg1 as xs:date, $arg2 as xs:date) as xs:boolean
>>
>> which makes me think that, both arguments to the operator
>> 'gt' must be of type xs:date. So the XPath 2.0 expression [1]
>> would fail in case of Schema aware system also.
>>
>> Could somebody please clarify this to me.
>>
>>
>> --
>> Regards,
>> Mukul Gandhi
>>
>> --~------------------------------------------------------------------
>> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>> or e-mail: <mailto:xsl-list-unsubscribe@l...>
>> --~--
>>
>
>
> --~------------------------------------------------------------------
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail: <mailto:xsl-list-unsubscribe@l...>
> --~--
>
--
John Snelson, Oracle Corporation http://snelson.org.uk/john
Berkeley DB XML: http://oracle.com/database/berkeley-db/xml
XQilla: http://xqilla.sourceforge.net
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@l...>
--~--
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
