[
https://issues.apache.org/jira/browse/JCR-2271?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Klimetschek resolved JCR-2271.
----------------------------------------
Resolution: Invalid
With JCR 1.0 you can only compare a property against a fixed value, eg.
@jcr:isMixin=true, but not compare two properties itself:
@jcr:ismix...@jcr:hasOrderableChildNodes. See section 6.6.3.3 of the spec [1]:
"In XPath support is only required for comparisons of the form
<property><op><literalvalue> and <literalvalue><op><property>."
IIUC, this does not change with the upcoming JSR-283, where a comparison is
defined as "Comparison ::= DynamicOperand Operator StaticOperand", with a
StaticOperand being only a literal or predefined variable.
However, in the case of a boolean with only two possible values a workaround is
possible:
(@jcr:isMixin=true and @jcr:hasOrderableChildNodes=true) or (@jcr:isMixin=false
and @jcr:hasOrderableChildNodes=false)
[1] http://www.day.com/specs/jcr/1.0/6.6.3.3_Property_Constraint.html
> XPath query fails comparing two attributes
> ------------------------------------------
>
> Key: JCR-2271
> URL: https://issues.apache.org/jira/browse/JCR-2271
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: query
> Affects Versions: 1.6.0
> Reporter: Brian Stiles
>
> An XPath query (via QueryManager) like '//element(*,
> nt:nodeType)[...@jcr:ismix...@jcr:hasOrderableChildNodes]' ought to find at
> least some nodes (e.g., /jcr:system/jcr:nodeTypes/nt:version). However, this
> query results in no matches. Oddly, changing the comparison from = to !=
> still results in no matches.
> It appears that it is not possible to test for equality of the values of two
> attributes on the same node (I haven't tested two attributes from different
> nodes).
> The use case that led to this discovery was one in which I wanted to find all
> nodes (cards) in an address book for which the first name attribute matches
> the last name attribute. Any workarounds would be much appreciated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.