Skip to content

Commit

Permalink
Ensure we won't set multiplicities in all steps of a tree ref
Browse files Browse the repository at this point in the history
If the ref being contextualized has a non-zero refLevel - it starts with one or more relative parent paths as in ../../.. - then we won't copy the corresponding context's multiplicity because it would overwrite any explicit multiplicity set by the user in the ref that's being contextualized.
  • Loading branch information
ggalmazor committed Feb 28, 2020
1 parent f02f2e3 commit 26cdfa2
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,12 @@ public TreeReference contextualize(TreeReference contextRef) {
//on this expression, since those reset any existing resolutions which
//may have been done.
if (newRef.getPredicate(i) == null) {
newRef.setMultiplicity(i, contextRef.getMultiplicity(i));
newRef.addPredicate(i, contextRef.getPredicate(i));
List<XPathExpression> predicate = contextRef.getPredicate(i);
newRef.addPredicate(i, predicate);
}
if (i + refLevel <= newRef.size()) {
int multiplicity = contextRef.getMultiplicity(i);
newRef.setMultiplicity(i, multiplicity);
}
} else {
break;
Expand Down

0 comments on commit 26cdfa2

Please sign in to comment.