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-18 04:41:05
Hi,

           <xsl:for-each select="$ZZZ[generate-id(.)]">

This is in effect the same as

  <xsl:for-each select="$ZZZ">

as an id can be generated for each node and it will always be a non-zero length 
string. Just use

<xsl:template name="temp1">
  <xsl:param name="ZZZ" />
  <xsl:for-each select="$ZZZ/B[generate-id(value) = generate-id(key('dkey', 
value/v1))]">
    <xsl:variable name="miktar" select="sum(key('dkey', value/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:template>

Cheers,

Jarno

              ...
              <xsl:if test=...>
                        <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>
              
              </xsl:if>       

                </xsl:for-each>
                </xsl:template>

is this a wrong idea to use ZZZ multiple times?
              
-----Original Message-----
From: Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com 
[mailto:Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com]
Sent: Thursday, November 18, 2004 11:55 AM
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,

<xsl:key name="dkey" match="value" use="v1"/>
<xsl:for-each select="$ZZZ[generate-id(.)]/B[generate-id(.) = 
generate-id(key('dkey',v1)[1])]">

[generate-id(.)] will always return true, so we can rewrite 
the above into

$ZZZ/B[generate-id(.) = generate-id(key('dkey',v1)[1])]
 
but this returns nothing, that is this does not return a nodeset...
i have a problem with the grouping.
any ideas?

How about

  <xsl:for-each select="$ZZZ/B[generate-id(value) = 
generate-id(key('dkey', value/v1))]">
    <xsl:variable name="miktar" select="sum(key('dkey', 
value/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>

Cheers,

Jarno
 
regards..

-----Original Message-----
From: Osman Çınar Eren 
[mailto:Cinar(_dot_)Eren(_at_)isbank(_dot_)com(_dot_)tr]
Sent: Thursday, November 18, 2004 10:43 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [Bu posta banka dışından gelmekte olup gerektiğinde teyit
alınmalıdır.] - [xsl] find the sum over distinct nodes - Sender
blacklisted



Hi,
 
I have such an XML nodeset:
 
<A>
        <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>
</A>
 
<A>
       <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>
</A>
 
<A>
        <B>
            <key>dd</key>
            <value>
                <v1>dd</v1>
                <v2>60</v2>
            </value>
        </B>
</A>
 
what i try to do is to have the sum values over 'v2' values 
for distinct B nodes.(distinct means for different key values.)
i would like to have such an XSL part:
 
<xsl:for-each select="$ZZZ[generate-id(.)]/???">
  <xsl:variable name="miktar" select="sum(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>
 
where $ZZZ is the nodeset which contrains the elements given above.
 
thanks in advance.
best regards..


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



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