[
https://issues.apache.org/jira/browse/JCR-2797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Klimetschek updated JCR-2797:
---------------------------------------
Description:
A pure descendant-or-self axis "//" does not work, albeit it is defined in JCR
1.0, section 6.6.4.6. Running this query
/jcr:root/content//
returns an error:
Encountered "$" at line 1, column 38. Was expecting one of: "or" ... "and" ...
"div" ... "idiv" ... "mod" ... "*" ... "return" ... "to" ... "where" ...
"intersect" ... "union" ... "except" ... ... ... "/" ... "//" ... "=" ... "is"
... "!=" ... "<=" ... "<<" ... ">=" ... ">>" ... "eq" ... "ne" ... "gt" ...
"ge" ... "lt" ... "le" ... "<" ... ">" ... "-" ... "+" ... "|" ... "[" ... ...
... ... ... "," ... ... ... for statement: for $v in /jcr:root/content// return
$v
It only works in combination with another location step, like
/jcr:root/content//* or /jcr:root/content//test. Tested this on a 2.2 snapshot,
but I think it was actually never supported so far.
The use case comes up when searching for a property in a subtree of a certain
node, where you want to include a property on that node directly as well, eg.
/jcr:root/content//[...@my:prop = 'value']
was:
The descendant-or-self axis "//" with a generic node() step afterwards does not
work, albeit it is defined in JCR 1.0, section 6.6.4.6. Running this query
/jcr:root/content//node()
returns all nodes below /content, but not /content itself.
The use case comes up when searching for a property in a subtree of a certain
node, where you want to include a property on that node directly as well, eg.
/jcr:root/content//node()[...@my:prop = 'value']
Summary: Xpath: pure descendant-or-self axis does not work (was:
Xpath: descendant-or-self:node() does not include self node in result)
Ah, no, node() is wrong, it only selects child nodes then. (But I know that
this is supported by Xpath, why else would you have a descendant-or-self axis?)
Going back to original title & description and investigating further.
> Xpath: pure descendant-or-self axis does not work
> -------------------------------------------------
>
> Key: JCR-2797
> URL: https://issues.apache.org/jira/browse/JCR-2797
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core, xpath
> Reporter: Alexander Klimetschek
>
> A pure descendant-or-self axis "//" does not work, albeit it is defined in
> JCR 1.0, section 6.6.4.6. Running this query
> /jcr:root/content//
> returns an error:
> Encountered "$" at line 1, column 38. Was expecting one of: "or" ... "and"
> ... "div" ... "idiv" ... "mod" ... "*" ... "return" ... "to" ... "where" ...
> "intersect" ... "union" ... "except" ... ... ... "/" ... "//" ... "=" ...
> "is" ... "!=" ... "<=" ... "<<" ... ">=" ... ">>" ... "eq" ... "ne" ... "gt"
> ... "ge" ... "lt" ... "le" ... "<" ... ">" ... "-" ... "+" ... "|" ... "["
> ... ... ... ... ... "," ... ... ... for statement: for $v in
> /jcr:root/content// return $v
> It only works in combination with another location step, like
> /jcr:root/content//* or /jcr:root/content//test. Tested this on a 2.2
> snapshot, but I think it was actually never supported so far.
> The use case comes up when searching for a property in a subtree of a certain
> node, where you want to include a property on that node directly as well, eg.
> /jcr:root/content//[...@my:prop = 'value']
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.