tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnson, Chris" <chrisjohn...@ti.com>
Subject RE: How do I pass a variable into an x select?
Date Tue, 07 Sep 2004 12:49:46 GMT
Instead of:
Parent: <x:out select="$xml//channel[@id='${v}']/../@id"/> <!--FAILS!-->

Try:
Parent: <x:out select="$xml//channel[@id=$v]/../@id"/>

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Digby
Sent: Saturday, September 04, 2004 12:48 PM
To: taglibs-user@jakarta.apache.org
Subject: How do I pass a variable into an x select?


I've just noticed that the select attribute of all the x tags isn't 
ynamic, so I can't pass in a variable - which is kind of exactly what I 
need to do. Is there a workaround, or am I going to have to abandon jstl

xml for xsl or something?

What I'm trying to do is below (v variable fails, but I can't hardcode 
the "two" for obvious reasons.

TIA

Digby

<x:parse var="xml">
     <channels id="channels">
         <channel id="tv">
             <channel id="one"/>
             <channel id="two"/>
             <channel id="three"/>
             <channel id="four"/>
         </channel>
         <channel id="sky">
             <channel id="movies"/>
             <channel id="sports"/>
         </channel>
     </channels>
</x:parse>
<c:set var="v" value="three"/>
Self: <x:out select="$xml//channel[@id='two']/@id"/>
Index: <x:out select="$xml/channels/@id"/>
Parent: <x:out select="$xml//channel[@id='${v}']/../@id"/> <!--FAILS!-->
First: <x:out 
select="$xml//channel[@id='two']/../channel[position()=1]/@id"/>
Last: <x:out 
select="$xml//channel[@id='two']/../channel[position()=last()]/@id"/>
Next: <x:out 
select="$xml//channel[@id='two']/following-sibling::channel/@id"/>
Prev: <x:out 
select="$xml//channel[@id='two']/preceding-sibling::channel/@id"/>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message