Multiple predicates

Andrew
2009-07-02
2013-04-30
  • Andrew

    Andrew - 2009-07-02

    I realise there hasn't been any updates to TinyXPath since 2007, but thought I would post this anyway.

    Here's a test xml:

    <root>
        <item name="item1" />
        <item name="item2" />
        <item name="item3" type="special" />
        <item name="item4" type="special" />
    </root>

    I'm trying to use two consecutive predicates in an expression...

    /root/item[@type='special'][1]/@name

    ...which I believe SHOULD return me the name of the 1st node that has the type 'special' (in this case 'item3'). However, instead it returns me the first node ('item1'), as though its ignoring the first [@type='special'] predicate completely.

    So, a few questions:
    1) Is this expected behaviour, or is it a bug?
    2) Is there anyone still around who is familiar with the TinyXPath codebase?
    3) Has anyone else encountered this problem before and fixed it?

     
  • Anonymous - 2009-10-29

    if exp is
    /root/item/@name

    may get item4 why?
    i think it is bug .

     
  • karsten

    karsten - 2012-09-11

    I tested it with xqilla, and it got the result
       name="item3"
    so your query seems correct to me.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks