Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XPath filters equivalence [Thread Next] Re: XPath filters equivalenceTo: 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 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
