Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Text search using parameter

Reply
Thread Tools

Text search using parameter

 
 
jose.jeria@gmail.com
Guest
Posts: n/a
 
      07-08-2005
I just started looking at XSLT, so bare with me if I totally
misunderstood this.

I am passing a value to the xslt that i want to use to search in some
nodes. I have the following code for this (note the query parameter):

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput
media-type="text/xml"
method="html"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
encoding="UTF-8"/>

<xslaram name="query"/>

<xsl:template match="/">
<html>
<head>
<title>Search results</title>
</head>

<body>
<h1>Found <xsl:value-of
select="count(/airports/airport/country_name[starts-with(.,$query)])"/>
countries</h1>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

Issue is that this doesn't work. If i "hardcode" a string it works. Do
I need to convert it to a string first?

Thank you for your help

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      07-08-2005


http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:


> <xslaram name="query"/>


> <h1>Found <xsl:value-of
> select="count(/airports/airport/country_name[starts-with(.,$query)])"/>
> countries</h1>


> Issue is that this doesn't work. If i "hardcode" a string it works. Do
> I need to convert it to a string first?


How an external parameter value is passed to an XSLT processor is highly
processor dependent so your "it doesn't work" experience can have many
reasons, you will need to tell us which processor you use, how you use
it (e.g. command line or perhaps from a certain programming language),
how you try to set the parameter. Of course if it is processor specific
it might be easier to find someone with experience on that topic on a
processor specific mailing list.
And what "doesn't work" mean exactly, does the stylesheet show "Found 0
countries", does the processor give an error?

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
jose.jeria@gmail.com
Guest
Posts: n/a
 
      07-08-2005
Yes, i got 0 hits. And I just realized why. I was not thinking about
the case-sensivity in my search query...

Sorry for have wasted your time, but thanks for taking the time to
answer me.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using declaration inside first template parameter as default valuefor second template parameter. Stuart Redmann C++ 5 12-14-2007 08:42 AM
Command line options: using an [option: parameter] without a parameter passed to it soren625 Perl Misc 10 12-28-2005 09:26 PM
is it possible to get hidden parameter values using window.opener.document.form.parameter.value. Abdul Mohsin Javascript 1 09-06-2005 03:38 PM
search within a search within a search - looking for better way...my script times out Abby Lee ASP General 5 08-02-2004 04:01 PM



Advertisments