code: private static LocationPath discardSelfNode(LocationPath path){
          int noOfNulls = 0;
          Step steps[] = path.steps;
  
          for(int i=steps.length-1; i>=0; --i){
              Step step = steps[i];
              if(step.axis==Axis.SELF && step.constraint.id==Constraint.ID_NODE && !step.predicateSet.hasPosition){
                  if(step.predicateSet.getPredicate()==null){
                      steps[i] = null;
                      noOfNulls++;
                  }else{
                      if(i!=0){
                          steps[i] = null;
                          steps[i-1].setPredicate(step);
                          noOfNulls++;
                      }
                  }
              }
          }
          return noOfNulls>0 ? removeNullSteps(path, noOfNulls) : path;
      }
docs: discard self::node() step if it has no predicate