Subversion Repositories ALCASAR

Rev

Rev 325 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 325 Rev 1393
Line 3847... Line 3847...
3847
      if (empty($step) OR ($step == '.') OR ($step == 'current()')) {
3847
      if (empty($step) OR ($step == '.') OR ($step == 'current()')) {
3848
        // Set it to the default value.
3848
        // Set it to the default value.
3849
        $step = '.';
3849
        $step = '.';
3850
        $axis['axis']      = 'self';
3850
        $axis['axis']      = 'self';
3851
        $axis['node-test'] = '*';
3851
        $axis['node-test'] = '*';
3852
        break $parseBlock;
3852
        break;
3853
      }
3853
      }
3854
 
3854
 
3855
      if ($step == '..') {
3855
      if ($step == '..') {
3856
        // Select the parent axis.
3856
        // Select the parent axis.
3857
        $axis['axis']      = 'parent';
3857
        $axis['axis']      = 'parent';
3858
        $axis['node-test'] = '*';
3858
        $axis['node-test'] = '*';
3859
        break $parseBlock;
3859
        break;
3860
      }
3860
      }
3861
 
3861
 
3862
      ///////////////////////////////////////////////////
3862
      ///////////////////////////////////////////////////
3863
      // Pull off the predicates
3863
      // Pull off the predicates
3864
 
3864
 
Line 3906... Line 3906...
3906
 
3906
 
3907
      // Check whether is an abbreviated syntax.
3907
      // Check whether is an abbreviated syntax.
3908
      if ($step == '*') {
3908
      if ($step == '*') {
3909
        // Use the child axis and select all children.
3909
        // Use the child axis and select all children.
3910
        $axis['node-test'] = '*';
3910
        $axis['node-test'] = '*';
3911
        break $parseBlock;
3911
        break;
3912
      }
3912
      }
3913
 
3913
 
3914
      // ### I'm pretty sure our current handling of cdata is a fudge, and we should
3914
      // ### I'm pretty sure our current handling of cdata is a fudge, and we should
3915
      // really do this better, but leave this as is for now.
3915
      // really do this better, but leave this as is for now.
3916
      if ($step == "text()") {
3916
      if ($step == "text()") {
3917
        // Handle the text node
3917
        // Handle the text node
3918
        $axis["node-test"] = "cdata";
3918
        $axis["node-test"] = "cdata";
3919
        break $parseBlock;
3919
        break;
3920
      }
3920
      }
3921
 
3921
 
3922
      // There are a few node tests that we match verbatim.
3922
      // There are a few node tests that we match verbatim.
3923
      if ($step == "node()"
3923
      if ($step == "node()"
3924
          || $step == "comment()"
3924
          || $step == "comment()"
3925
          || $step == "text()"
3925
          || $step == "text()"
3926
          || $step == "processing-instruction") {
3926
          || $step == "processing-instruction") {
3927
        $axis["node-test"] = $step;
3927
        $axis["node-test"] = $step;
3928
        break $parseBlock;
3928
        break;
3929
      }
3929
      }
3930
 
3930
 
3931
      // processing-instruction() is allowed to take an argument, but if it does, the argument
3931
      // processing-instruction() is allowed to take an argument, but if it does, the argument
3932
      // is a literal, which we will have parsed out to $[number].
3932
      // is a literal, which we will have parsed out to $[number].
3933
      if (preg_match(":processing-instruction\(\$\d*\):", $step)) {
3933
      if (preg_match(":processing-instruction\(\$\d*\):", $step)) {
3934
        $axis["node-test"] = $step;
3934
        $axis["node-test"] = $step;
3935
        break $parseBlock;
3935
        break;
3936
      }
3936
      }
3937
 
3937
 
3938
      // The only remaining way this can be a step, is if the remaining string is a simple name
3938
      // The only remaining way this can be a step, is if the remaining string is a simple name
3939
      // or else a :* name.
3939
      // or else a :* name.
3940
      // http://www.w3.org/TR/xpath#NT-NameTest
3940
      // http://www.w3.org/TR/xpath#NT-NameTest
Line 3959... Line 3959...
3959
          $axis['node-test'] = strtoupper($axis['node-test']);
3959
          $axis['node-test'] = strtoupper($axis['node-test']);
3960
        }
3960
        }
3961
        // Not currently recursing
3961
        // Not currently recursing
3962
        $LastFailedStep = '';
3962
        $LastFailedStep = '';
3963
        $LastFailedContext = '';
3963
        $LastFailedContext = '';
3964
        break $parseBlock;
3964
        break;
3965
      } 
3965
      } 
3966
 
3966
 
3967
      // It's not a node then, we must treat it as a PrimaryExpr
3967
      // It's not a node then, we must treat it as a PrimaryExpr
3968
      // Check for recursion
3968
      // Check for recursion
3969
      if ($LastFailedStep == $step) {
3969
      if ($LastFailedStep == $step) {