On Thu, 20 Mar 2003, Peter Giesin wrote:

> <c:set var="foo" value="/a/b[1]"/>
> <x:parse  xml="some-xml-source" var="xml"/>
> <x:out select="$xml/a/b[1]"/>
> 
> I would like to define the "x:out" statement to use the foo variable
> instead of the hard-coded xpath. Something like this: <x:out
> select="$xml/$foo"/>
> 
> I have read through the spec and various other docs, but just cannot
> seem to get this working. If some one could help point me in the right
> direction I would greatly appreciate it.

You can use XPath variables in XPath expressions within JSTL tags, but the
syntax you're using isn't right.  A variable evaluates to a value; it does
not get string-interpolated into the text of your message.  The expression
you're looking for wouldn't be "$xml/$foo" but "$xml/*[name()=$foo]" or
something similar.

Shawn


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to