xsl-list
[Top] [All Lists]

Filtering using list of params (Subtree creation?)

2003-11-19 04:08:59


Hi,

First time posting - please forgive any duplication (I did look in the
archive).

I want to know if there is a preferred method of filtering out multiple
parts of a large XML using some form of parameter list/document.

For illustration purposes I've created the following simple XML

<root>
        <store location="london">
                <staff>100</staff>
        </store>
        <store location="new york">
                <staff>200</staff>
        </store>
        <store location="paris">
                <staff>50</staff>
        </store>
        <store location="madrid">
                <staff>25</staff>
        </store>
        <store location="tokyo">
                <staff>125</staff>
        </store>
</root>


What I need if for different "views" to be available based on the
locations.

e.g. 

London Manager : sees London
Euro Manager   : sees London, Paris, Madrid
Global Manager : sees all

In my application I have some templates that do SUM() (currently 
for the entire document) to give some grand totals.  What I would expect
these to show using the example above is

London Manager : Staff = 100
Euro Manager   : Staff = 175
Global Manager : Staff = 500

So I'm thinking I need to select out the sections I required into an
xsl:variable and then apply the totals templates to that.

Also, what is the best way to express the filter list?  A separate XML
doc?  A comma delimited string param?

Any wisdom on this would be fantastic.

Many thanks,
Chris

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list