allow xpath expression/query to create more than one occurrence of an element
-----------------------------------------------------------------------------
Key: BPEL-272
URL:
http://jira.jboss.com/jira/browse/BPEL-272
Project: JBoss jBPM BPEL
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: Engine
Affects Versions: jBPM BPEL 1.1 beta 3
Reporter: Alejandro Guizar
Assigned To: Alejandro Guizar
Priority: Critical
Fix For: jBPM BPEL 1.1 GA
PROBLEM The current XPath sublanguage implementation automatically creates nodes missing
from location paths during assignment. This facility has a number of conceptual
limitations. One of them is the inability to append a child element to an existing element
if the latter already has a child element with the same name. There is no XPath syntax to
express that a new element is required!
It is tempting to think of a numeric XPath predicate as an array index, leading to the
next snippet:
<copy>
<from><literal>haha</literal></from>
<to variable='laughter'
xmlns:ex='http://jbpm.org/bpel/examples'>
<query>ex:laugh[last() + 1]</query>
</to>
</copy>
However, such an interpretation of a predicate is wrong. Consider the following extract
from XPath 1.0 specification on predicates:
"A PredicateExpr is evaluated by evaluating the Expr and converting the result to a
boolean. If the result is a number, the result will be converted to true if the number is
equal to the context position and will be converted to false otherwise."
The description of the last() function reads:
"The last function returns a number equal to the context size from the expression
evaluation context."
Noticed the problem? The context position is never greater than the context size.
Therefore the predicate [last() + 1] does not represent the position "one past the
context size" but the boolean value false. Unfortunately, no other predicate seems
appropriate.
PROPOSAL Introduce a minor deviation from the XPath 1.0 specification. Interpret the
result of a numeric predicate that equals the context size plus one as a request to
create a new occurrence of the node.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira