Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XPath filters equivalence

From: David Carlisle <david-news@---------.-----.--.-->
To: NULL
Date: 10/7/2007 12:53:00 AM

Altu wrote:
> Hi,
> 
> Is [p1][p2][p3] the same as [p1 AND p2 and p3] in XPath?

as others have said [][] isn't the same as and if any of the predicates 
use last() or position()
> 
> Also if I have a predicate that starts with "/" or "//", does it
> matter where in the XPath expression it is?
> 
> For example, are these equal:
> 
> /a[/a/b]/c/d
> /a/c[/a/b]/d
> /a/c/d[/a/b]
> 

If a b and c are just element names then the above are all equal and 
equivalent to the xpath2
if(/a/b) then /a/c/d else ()
but if a b c d are standing for arbitrary XPath steps then these may not 
be equivalent as / depends on the current context as it means the 
document node ancestor of the _current node_.
so for example the xpath2
/a[/a/b]/doc('c'xml')/d
the predicate [/a/b] tests in the current docuement
/a/doc('c'xml')[/a/b]/d
here [/a/b] tests in c.xml

David



> or these three:
> 
> /a[//a/b]/c/d
> /a/c/[//a/b]/d
> /a/c/d[//a/b]
> 
> Thanks in advance,
> Al
> 


-- 
http://dpcarlisle.blogspot.com


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent