xsl-list
[Top] [All Lists]

RE: RE: [Bu posta banka disindan gelmekte olup gerektiginde teyit alinmalidir.] - [xsl] find the sum over distinct nodes - Sender blacklisted

2004-11-19 03:30:38
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 Çinar Eren 
[mailto:Cinar(_dot_)Eren(_at_)isbank(_dot_)com(_dot_)tr]
Sent: 19 November, 2004 09:21
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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(_at_)s-s-t(_dot_)com [mailto:JBryant(_at_)s-s-t(_dot_)com]
Sent: Thursday, November 18, 2004 7:09 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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(_at_)saxonica(_dot_)com> 
11/18/2004 10:55 AM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com


To
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
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/ 

 


--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>
--~--