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

Re: need help for sum() and point of view

Subject: Re: need help for sum() and point of view
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 03 Jul 2002 19:12:53 +0200
xsl help sum
Hello Elise,

could you please reduce the mail size - who should read 23 KB? Mostly it's enough to give a concise part of the code.

Your problem with the sum() is really easily to solve, you always hav a key, which selects the wanted elements:

<xsl:key name="item-by-id" match="BudgetItemXML" use="BIT_ItemID" />

So you only have to do
<xsl:value-of select="sum(key('item-by-id', 3)/Total)"/>
to sum all 'Total's of the 'BudgetItemXML's with 'BIT_ItemID'=3.

I'm to lazy to search for two buttons in the code ;-) But in general you can pass the parameter to group by to the stylesheet and choose the grouping key to use depending on this parameter:

<xsl:param name="grouping-by" select="'Task'"/>

key(concat('item-by-',$grouping-by), 'thekey')

So if you have

<xsl:key name="item-by-Task" .../>

and

<xsl:key name="item-by-Activity" .../>

the key used for grouping is chosen depending on the parameter.

But I can't see any Task or Activity in your code. Am I blind or did I understand something wrong?

Regards,

Joerg

Elise_Dupont@xxxxxxxxxxxxxx wrote:
hi,

I made some work on a XML file to translate it.

I would like first to have your point of view :

look at the transformation of the following XML by the following XSL
you can see 2 buttons
in fact those buttons should do this :
by default the grouping is made first by Task and then by Activity but if the
user click on the button this should swap the grouping with first Activity and
then Task.

Do you think it's doable ? (maybe with javascript included in the web page,
loading xml using xml dom and data island ... ?)


Second question :


i need some help for the sum() because i still have difficulties with paths and
things like this... the best would be a solution + explanation but i think that
i could maybe try to do it myself with a sample of "complex" sum()


TIA regards,

Elise, XML learning girl ;-)


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.