Subject: RE: [xsl] RE: [Bu posta banka disindan gelmekte olup gerektiginde teyit alinmalidir.] - [xsl] find the sum over distinct nodes - Sender blacklisted From: <Jarno.Elovirta@xxxxxxxxx> Date: Fri, 19 Nov 2004 12:30:38 +0200 |
Hi, Rewrite your keys to <xsl:key name="categorise" match="value[C]" use="C"/> <xsl:key name="dkey" match="value[v1]" use="concat(../../C, ' ', v1)"/> and <xsl:for-each select="value[generate-id() = generate-id(key('categorise', C))]"> <xsl:variable name="C" select="C"/> <xsl:for-each select="../value/B/value[generate-id() = generate-id(key('dkey', concat($C, ' ', v1)))]"> <xsl:variable name="miktar" select="sum(key('dkey', concat($C, ' ', v1))/v2)"/> <fo:table-row> <fo:table-cell> <fo:block text-align="left" font-size="8pt" > <xsl:value-of select='format-number($miktar, "###,###.00")'/> </fo:block> </fo:table-cell> </fo:table-row> </xsl:for-each> </xsl:for-each> I removed the ZZZ variable and mytemplate template call to make the grouping clearer. Cheers, Jarno > -----Original Message----- > From: ext Osman Ginar Eren [mailto:Cinar.Eren@xxxxxxxxxxxxx] > Sent: 19 November, 2004 09:21 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: [xsl] RE: [Bu posta banka disindan gelmekte olup > gerektiginde teyit alinmalidir.] - [xsl] find the sum over > distinct nodes - Sender blacklisted > > > hi, > > my problem seems to be related to multiple level grouping. > there is a nice answer in your link. however my question is > more complex; My second level grouping is not in the same > level. My input data : > <value> > > <B> > <key>aa</key> > <value> > <v1>aa</v1> > <v2>110</v2> > </value> > </B> > <B> > <key>bb</key> > <value> > <v1>bb</v1> > <v2>10</v2> > </value> > </B> > <B> > <key>cc</key> > <value> > <v1>cc</v1> > <v2>60</v2> > </value> > </B> > <C>002</C> > </value> > > <value> > <B> > <key>bb</key> > <value> > <v1>bb</v1> > <v2>40</v2> > </value> > </B> > <B> > <key>cc</key> > <value> > <v1>cc</v1> > <v2>200</v2> > </value> > </B> > <C>002</C> > </value> > > <value> > <B> > <key>dd</key> > <value> > <v1>dd</v1> > <v2>60</v2> > </value> > </B> > <C>001</C> > </value> > > my keys: > <xsl:key name="categorise" match="value" use="C"/> > <xsl:key name="dkey" match="value" use="v1"/> > > two groupings are as follows: > first group according to C values of 'value' elements: > <xsl:for-each select="value[generate-id()= > generate-id(key('categorise',C)[1])]"> > <xsl:call-template name="mytemplate"> > <xsl:with-param name="ZZZ" select="$ZZZ" /> > </xsl:call-template> > </xsl:for-each> > > in my template: > > <xsl:for-each select="$ZZZ/B/value[generate-id(.) = > > generate-id(key('dkey', v1))]"> > > <xsl:variable name="miktar" select="sum(key('dkey', > > v1)/v2)"/> > > <fo:table-row> > > <fo:table-cell> > > <fo:block text-align="left" font-size="8pt" > > > <xsl:value-of select='format-number($miktar, > > "###,###.00")'/> > > </fo:block> > > </fo:table-cell> > > </fo:table-row> > > </xsl:for-each> > > so how can i move the first key value into the second one as > it is given in the link below?(the two keys are in different > levels in the XML) > > i am not sure if i could tell my problem, if it is not enough > i can go deeper. > > thanks in advance. > best regards... > > > -----Original Message----- > From: JBryant@xxxxxxxxx [mailto:JBryant@xxxxxxxxx] > Sent: Thursday, November 18, 2004 7:09 PM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: [xsl] RE: [Bu posta banka disindan gelmekte olup > gerektiginde teyit alinmalidir.] - [xsl] find the sum over distinct > nodes - Sender blacklisted > > > I found that Dave Pawson's FAQ was also very helpful when I > had to solve > the flat-to-structured problem. The portion of the FAQ that > deals with > turning flat documents into structured documents is at > http://www.dpawson.co.uk/xsl/sect2/flatfile.html > > My thanks to Jeni and Dave for creating these resources and > to everyone on > the list for all the input. > > Jay Bryant > Bryant Communication Services > > > > > "Michael Kay" <mike@xxxxxxxxxxxx> > 11/18/2004 10:55 AM > Please respond to > xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > > To > <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > cc > > Subject > RE: [xsl] RE: [Bu posta banka disindan gelmekte olup > gerektiginde teyit > alinmalidir.] - [xsl] find the sum over distinct nodes - Sender > blacklisted > > > > > > > Last time Jarno showed you what to do, you did something > different and > then > said it didn't work. > > Now you still say it doesn't work, but you're not telling us > what you've > done this time. > > Show a complete source document, a complete stylesheet, the > output you are > getting, and the output that you want. > > It's going to be difficult for you to use Jarno's code > correctly unless > you > study it enough to understand it. Reading Jeni's XSLT > grouping pages will > help greatly: http://www.jenitennison.com/xslt/grouping > > Michael Kay > http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] RE: [Bu posta banka disin, Osman Çınar Eren | Thread | [xsl] Sorting RTF, Paul Hebble |
RE: [xsl] XSL to create nested list, Jarno.Elovirta | Date | Re: [xsl] XSL to create nested list, Shawn |
Month |