code: public int getNextStepPos(int opPos)
    {
  
      int stepType = getOp(opPos);
  
      if ((stepType >= OpCodes.AXES_START_TYPES)
              && (stepType <= OpCodes.AXES_END_TYPES))
      {
        return getNextOpPos(opPos);
      }
      else if ((stepType >= OpCodes.FIRST_NODESET_OP)
               && (stepType <= OpCodes.LAST_NODESET_OP))
      {
        int newOpPos = getNextOpPos(opPos);
  
        while (OpCodes.OP_PREDICATE == getOp(newOpPos))
        {
          newOpPos = getNextOpPos(newOpPos);
        }
  
        stepType = getOp(newOpPos);
  
        if (!((stepType >= OpCodes.AXES_START_TYPES)
              && (stepType <= OpCodes.AXES_END_TYPES)))
        {
          return OpCodes.ENDOP;
        }
  
        return newOpPos;
      }
      else
      {
        throw new RuntimeException(
          XSLMessages.createXPATHMessage(XPATHErrorResources.ER_UNKNOWN_STEP, new Object[]{String.valueOf(stepType)})); 
        //"Programmer's assertion in getNextStepPos: unknown stepType: " + stepType);
      }
    }
docs: Given a location step position, return the end position, i.e. the
  beginning of the next step.
  
  @param opPos the position of a location step.
  @return the position of the next location step.