xsl-list
[Top] [All Lists]

RE: Filtering based on "list" of values

2006-01-09 03:52:43
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[(_at_)location = $locSequence]"

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

-----Original Message-----
From: Chris Ward [mailto:cward(_at_)horizon-asset(_dot_)co(_dot_)uk] 
Sent: 09 January 2006 10:39
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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







--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--