You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "Carole E. Mah" <ca...@mama.stg.brown.edu> on 2002/05/23 16:09:40 UTC
Parameterizing search expressions
Let's say we want to perform a search on our text. We've tried to do it
in this way, e.g. to search for "Brian":
<x:parse xml="${xmlFile}" var="doc"/>
<x:out select="$doc//text()[contains(.,'Brian')]"/>
However it seems very hard to parameterize the most crucial part, namely
the value of the "select" attribute in <x:out>. We've tried setting
"$doc//text()[contains(.,'Brian')]" as a parameter earlier in the page
and then using it as the value on select=, but in every case we got
either an Apache error message or an STL error message. It seems that
the select= value really has to be in the form of an XPath.
Is there any way a parameter can be used here?
If not, is there a way to work around this, i.e. to have the query page
contain code that actually writes out a new JSP and send *that* to tomcat?
That way we could take in the query XPath expression as a variable value,
and then write it out as a string in the new page. Does that make sense?
Thanks,
-carole
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Parameterizing search expressions
Posted by "Carole E. Mah" <ca...@mama.stg.brown.edu>.
Yes, it has always worked for me.
I just misunderstood what my colleague wanted in his JSP (I posted on his
behalf).
thanks,
-c
On Thu, 23 May 2002, Brian J. Sletten wrote:
> Does this not work for you, Carole?
>
> <c:set value="Brian" var="parm"/>
>
> <x:forEach select="$doc//text()[contains(.,$parm)]">
> <x:out select="."/>
> </x:forEach>
>
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Carole E. Mah carolem@stg.brown.edu
Senior Programmer/Analyst
Brown University Scholarly Technology Group
phn 401-863-2669
fax 401-863-9313
http://www.stg.brown.edu/
personal: http://www.stg.brown.edu/~carolem/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Parameterizing search expressions
Posted by "Brian J. Sletten" <bs...@nova.org>.
Does this not work for you, Carole?
<c:set value="Brian" var="parm"/>
<x:forEach select="$doc//text()[contains(.,$parm)]">
<x:out select="."/>
</x:forEach>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>