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

RE: RE: Filtering using list of params (Subtree creati

Subject: RE: RE: Filtering using list of params (Subtree creation?)
From: "Chris Ward" <cward@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Nov 2003 19:04:40 -0000
get subtree from dom4j
> 
> 
> The easiest way to solve this is to restructure the XML, if 
> possible. Then your input could look like this:
> 
> <root>
>   <europe>
>     <store location="london">
>       <staff>100</staff>
>     </store>
>     <store location="paris">
>       <staff>50</staff>
>     </store>
>     <store location="madrid">
>       <staff>25</staff>
>     </store>
>   </europe>
>   <north-america>
>     <store location="new york">
>       <staff>200</staff>
>     </store>
>   </north-america>
>   <asia>
>     <store location="tokyo">
>       <staff>125</staff>
>     </store>
>   </asia>
> </root>
> 
> And summing any particular group is easy the the XLST sum() function:
> 
>   <xsl:template match="/root">
>     <xsl:variable name ="staffing" select="sum(europe/store/staff)" />
>     <xsl:value-of select="$staffing" />
>   </xsl:template>
> 
> If you can't get the producer of the XML to group the data 
> like this, we'll have to try another approach.

Excellent suggestion, thanks Charles.  However, I fear that
my example XML may not have illustrated my problem fully.

This has made me think about the structuring though.

In my real application, the sub-elements are accounts with
account numbers as the attribute.  Different users will be set
up to view different sets of accounts and these may intersect/overlap
- which potentially breaks the organisation solution you proposed.

I guess my original query was "can functions like SUM() be parameterised
from a list?".

I imagined I would have to create a sub set into an xsl:variable and
then
use that.  Or something.

In the end I think I've decided to do this filtering upstream since
I do create the XML myself.  This just means that the user-specific 
XML document has to be created for each request - I did intend caching
the full XML document (as a dom4j Java object in my Tomcat server)
and then "picking out" the bits for each user.

Many thanks to all who replied to my posting.

Best regards,
Chris



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


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.