Re: XPath examples
Michael Kay <[email protected]> Thu, 31 May 2012 08:59:48 +0100
| Newsgroups | gmane.comp.java.jdom.general |
|---|---|
| Message-ID | <[email protected]> |
>> >> Do the variables have to be xpath values (i.e., in quotes), or can >> any part of the xpath expression be put into a variable? >> >> Peter Kronenberg Variables in XPath represent values, not fragments of expression text: XPath isn't like shell scripts where variables are essentially macros. So you can't put "+" or "-" into a variable $op and then do (3 $op 2). Because the language is orthogonal, a variable reference can be used anywhere an expression can be used. That rules out things like child::$e, a/$e (which becomes acceptable in XPath 2.0, but doesn't mean what people sometimes imagine), or $e(2) (which becomes acceptable in XPath 3.0, where functions are first-class values). Michael Kay Saxonica _______________________________________________ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/[email protected]