[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Filtering based on "list" of values

Subject: RE: Filtering based on "list" of values
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 9 Jan 2006 10:52:43 -0000
michael kay store
Pass in the comma separated list of locations as a stylesheet parameter
$locs.

Create a global variable

<xsl:variable name="locSequence" select="tokenize($locs, ',\s+')"
as="xs:string*"/>

then select required locations as:

select="store[@location = $locSequence]"

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Chris Ward [mailto:cward@xxxxxxxxxxxxxxxxxxx] 
> Sent: 09 January 2006 10:39
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Filtering based on "list" of values
> 
> 
> Hi all,
> 
> Sorry if this is a commonly asked question - I've looked in
> the archive but the best match was my first posting back in 2003!
> http://www.biglist.com/lists/xsl-list/archives/200311/msg00700.html
> 
> Anyway, I've returned to the world of XSLT now and I face the same
> problem.  
> 
> 
> Imagine some XML such as...
> 
> <root>
>     <store location="london">
> 
> 	<...>report data here</...>
> 
>     </store>
>     <store location="paris">
> 
> 	<...>report data here</...>
> 
>     </store>
>     <store location="madrid">
> 
> 	<...>report her data here</...>
> 
>     </store>
>     <store location="new york">
> 
> 	<...>report data here</...>
> 
>     </store>
>     <store location="tokyo">
> 
> 	<...>report data here</...>
> 
>     </store>
> </root>
> 
> 
> I've got a webpage/form that allows the user to enter a list
> of locations they want included in a report (I have the report
> XSLT already).  
> 
> 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"
> 
> 
> I happen to be using dom4j/Java.  I do use XMLFilterImpl in
> my code for filtering other XML stuff, but I wondered if I can do
> the filtering inside the XSLT.  I am now running the latest version
> of Saxon therefore XSLT 2.0.  I'm new to XSLT 2.0 and not sure if 
> it's possible using functions or something.
> 
> It's STILL not clear to me where to do this sort of list-based
> filtering.  
> 
> 
> Many thanks for any suggestions.
> 
> Chris Ward

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.