You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Licia Capra <l....@cs.ucl.ac.uk> on 2000/08/04 17:39:42 UTC

Variable declaration in xpath

Hello,

I'm working on a tool that makes use of xpath expressions and the xalan
package turned out to be very useful to me.
Now I'd need to be able to declare, bind and reference variables across
xpath expressions but I was not able to find something useful to this
purpose ... does anybody can help me?

Here's the scenario.

Let's say I have a couple of xpath expressions like:
xpath1: /chapter[1]/para[1]
xpath2: /chapter[2]/para[1]

I would like to be able to reference a variable in xpath2 in this way:

xpath2: /chapter[2]/para[1][text()=$var/text()]

Now the question:

1) can I process xpath2 in xalan just as a "normal" xpath expression
(without variables), without doing it by myself? 
2) how can I declare the variable $var and bind it to the result of the
evaluation of xpath1?

Thank you very much :)
Licia


---/\-/\----------------------------------------------------------------
  Licia Capra
  PhD Student
  Software Systems Engineering Group
  University College London
 
  http://www.cs.ucl.ac.uk/ssegroup.html
  Phone: +44 20 7679 3645
------------------------------------------------------------------------