Re: [xsl] Filtering based on "list" of values

Subject: Re: [xsl] Filtering based on "list" of values
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Mon, 9 Jan 2006 10:54:15 -0000
----- Original Message ----- From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, January 09, 2006 10:42 AM
Subject: Re: [xsl] Filtering based on "list" of values



Imagine some XML such as...

<root>
    <store location="london">

<...>report data here</...>

</store>
[snip]
</root>

I guess I am thinking about passing something into the XSLT (via a
param) along the lines of

"london,new york"

or

"tokyo, paris, london"

How about:


<xsl:apply-templates select="/root/store[contains($param, @location)]"/>

cheers
andrew

If you're going to do that it maybe better to delimit both sides, with commas for instance, otherwise you will get yor "New York" store when you search for "York".

Joe

Current Thread