469,945 Members | 2,333 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

Text search using parameter

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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
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"/>

<xsl:param 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

Jul 20 '05 #1
2 1054


jo********@gmail.com wrote:

<xsl:param 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/
Jul 20 '05 #2
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.

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mark | last post: by
2 posts views Thread by charlie_M | last post: by
10 posts views Thread by Michael B. Trausch | last post: by
reply views Thread by Savvas | last post: by
6 posts views Thread by shantanu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.