-
Bug
-
Resolution: Done
-
Critical
-
1.0.0.Final
-
None
-
Workaround Exists
-
-
Medium
An XPath query such as the following:
//NodeA[@foo:bar='value']
does not find nodes that are immediately under the root, but it does find nodes that match that criteria in any location other than right under the root. However, the following query:
//NodeA
does work correctly (because it is translated into different criteria that uses a name match, where the first query results in a path constraint, namely "...PATH(nodeSet) LIKE '%/NodeA'...").
There are several simple workarounds (depending upon the exact situation):
1) When nodes exist right under the root (and nowhere else), the query can be constrained a bit more (resulting in different constraints that are processed correctly for all nodes):
/jcr:root/odl:odelia-technologies[@odl:url='http://www.odelia-technologies.com']
2) In the case where the location of the nodes is more variable (or unknown) but you know the name, you can use the 'element(name)' function to constrain the name of the node:
//element(odl:odelia-technologies)[@odl:url='http://www.odelia-technologies.com']