Typed datas in XPath2

Discussion in 'XML' started by Philippe Poulard, Jan 9, 2008.

  1. 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 !
     
    Philippe Poulard, Jan 9, 2008
    #1
    1. Advertising

  2. 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/
     
    Martin Honnen, Jan 9, 2008
    #2
    1. Advertising

  3. 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 !
     
    Philippe Poulard, Jan 9, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ersin Gençtürk
    Replies:
    1
    Views:
    3,489
    Ersin Gençtürk
    Oct 6, 2004
  2. Replies:
    1
    Views:
    1,724
    Martin Honnen
    Oct 5, 2005
  3. RolfK
    Replies:
    7
    Views:
    1,443
    Martin Honnen
    Dec 18, 2007
  4. Christof Hoeke

    state of XSLT2/XPath2 or XQuery in CPython

    Christof Hoeke, Dec 26, 2007, in forum: Python
    Replies:
    2
    Views:
    316
    Christof Hoeke
    Dec 26, 2007
  5. Ian Clifton

    "." versus ".." in XPath2.0

    Ian Clifton, Dec 2, 2010, in forum: XML
    Replies:
    9
    Views:
    1,092
    Martin Honnen
    Dec 11, 2010
Loading...

Share This Page