Project

Profile

Help

Revision 5c9d209e

Added by Michael Kay about 14 years ago

Fix bug 1788571 (incorrect rewrite of a/./b)

View differences:

latest8.9/bj/net/sf/saxon/expr/PathExpression.java
152 152
            return start;
153 153
        }
154 154

  
155
        // Remove a redundant "." in the middle of a path expression
156

  
157
        if (step instanceof PathExpression && ((PathExpression)step).getFirstStep() instanceof ContextItemExpression) {
158
            PathExpression p2 = new PathExpression(start, ((PathExpression)step).getRemainingSteps());
159
            p2.setLocationId(getLocationId());
160
            p2.setParentExpression(getParentExpression());
161
            return p2;
162
        }
163

  
164
        if (start instanceof PathExpression && ((PathExpression)start).getLastStep() instanceof ContextItemExpression) {
165
            PathExpression p2 = new PathExpression(((PathExpression)start).getLeadingSteps(), step);
166
            p2.setLocationId(getLocationId());
167
            p2.setParentExpression(getParentExpression());
168
            return p2;
169
        }
155
        // Remove a redundant "." in the middle of a path expression [removed because incorrect: see test qxmp331]
156

  
157
        //if (step instanceof PathExpression && ((PathExpression)step).getFirstStep() instanceof ContextItemExpression) {
158
        //    PathExpression p2 = new PathExpression(start, ((PathExpression)step).getRemainingSteps());
159
        //    p2.setLocationId(getLocationId());
160
        //    p2.setParentExpression(getParentExpression());
161
        //    return p2;
162
        //}
163

  
164
        //if (start instanceof PathExpression && ((PathExpression)start).getLastStep() instanceof ContextItemExpression) {
165
        //    PathExpression p2 = new PathExpression(((PathExpression)start).getLeadingSteps(), step);
166
        //    p2.setLocationId(getLocationId());
167
        //    p2.setParentExpression(getParentExpression());
168
        //    return p2;
169
        //}
170 170

  
171 171
        // the expression /.. is sometimes used to represent the empty node-set
172 172

  

Also available in: Unified diff