Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Typed datas in XPath2

Reply
Thread Tools

Typed datas in XPath2

 
 
Philippe Poulard
Guest
Posts: n/a
 
      01-09-2008
hi,

consider this :
<foo bar="false"/>

in XPath2
/foo[@bar]
returns my foo element since the bar attribute exists

but if the bar attribute has the type xs:boolean (and that the parser
validates with the appropriate schema and that PSVI augmentation was
set), does the predicate return true() or false() ?

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
-----------------------------
http://reflex.gforge.inria.fr/
Have the RefleX !
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      01-09-2008
Philippe Poulard wrote:

> consider this :
> <foo bar="false"/>
>
> in XPath2
> /foo[@bar]
> returns my foo element since the bar attribute exists
>
> but if the bar attribute has the type xs:boolean (and that the parser
> validates with the appropriate schema and that PSVI augmentation was
> set), does the predicate return true() or false() ?


The "effective boolean value" of @bar with an existing attribute named
'bar' is true, that does not depend on any schema type being available,
that solely depends on whether @bar is an empty sequence or a sequence
where the first item is a node. See
<URL:http://www.w3.org/TR/xpath20/#id-ebv>.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
Philippe Poulard
Guest
Posts: n/a
 
      01-09-2008
Martin Honnen a écrit :
> Philippe Poulard wrote:
>
>> consider this :
>> <foo bar="false"/>
>>
>> in XPath2
>> /foo[@bar]
>> returns my foo element since the bar attribute exists
>>
>> but if the bar attribute has the type xs:boolean (and that the parser
>> validates with the appropriate schema and that PSVI augmentation was
>> set), does the predicate return true() or false() ?

>
> The "effective boolean value" of @bar with an existing attribute named
> 'bar' is true, that does not depend on any schema type being available,
> that solely depends on whether @bar is an empty sequence or a sequence
> where the first item is a node. See
> <URL:http://www.w3.org/TR/xpath20/#id-ebv>.


Hi Martin,

I'm afraid that a typed value can't be tested in an intuitive way :
/foo[boolean(@bar)] doesn't work either with the typed value, but with
the EBV rules

What about :
/foo[@bar!=false()]
/foo[@bar!='false']
/foo[data(@bar)]
?

I think the former predicate returns true for the same reason you mentioned
the 2nd returns false since the string value is involved
the latter returns false since the typed value is involved

Right ?

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
-----------------------------
http://reflex.gforge.inria.fr/
Have the RefleX !
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"." versus ".." in XPath2.0 Ian Clifton XML 9 12-11-2010 02:09 PM
state of XSLT2/XPath2 or XQuery in CPython Christof Hoeke Python 2 12-26-2007 10:04 PM
XPATH2.0 fn:matches() can somebody confirm if my understanding is OK RolfK XML 7 12-18-2007 04:45 PM
How do I add an Xpath2.0 function to Xalan2.6? hicks@bigmailbox.net XML 1 10-05-2005 11:34 AM
How can I add a row from a typed datatable to another instance of that typed datatable? Ersin Gençtürk ASP .Net 1 10-06-2004 01:11 PM



Advertisments