[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Re: sum


Subject: [xsl] Re: sum
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Wed, 4 Feb 2004 21:02:28 +0100

This is easy to do with FXSL.

Search the list for "transform-and-sum". There are several examples -- e.g.:

    http://sources.redhat.com/ml/xsl-list/2001-11/msg00831.html


Cheers,

Dimitre Novatchev,
FXSL developer

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html


"poppe chris" <pc_poppe@xxxxxxxxxxx> wrote in message
news:Law9-F68DJaqezRSry400005c1f@xxxxxxxxxxxxxx


Hello, i have the following question,

Im dealing with the following xmlfile (only showing parts of it)


<GOPSIZE>
<GOP_BYTE>721619968</GOP_BYTE>
<GOP_BYTE>35392768</GOP_BYTE>
<GOP_BYTE>3214937088</GOP_BYTE>
<GOP_BYTE>2174815232</GOP_BYTE>
<GOP_BYTE>2650147328</GOP_BYTE>
<GOP_BYTE>1301153792</GOP_BYTE>
<GOP_BYTE>1162808064</GOP_BYTE>
</GOPSIZE>

<SUBSTR8>
    <SUBSTREAM>
                <lengthbit>0</lengthbit>
                <stuff>5</stuff>
<two>167</two>
                <SUBSTREAM_interior>477407 1447</SUBSTREAM_interior>
    </SUBSTREAM>
    <SUBSTREAM>
<lengthbit>0</lengthbit>
<stuff>18</stuff>
<two>83</two>
<SUBSTREAM_interior>478856 4691</SUBSTREAM_interior>
    </SUBSTREAM>
    <SUBSTREAM>
<lengthbit>0</lengthbit>
<stuff>58</stuff>
<two>46</two>
<SUBSTREAM_interior>483549 14894</SUBSTREAM_interior>
    </SUBSTREAM>
    <SUBSTREAM>
<lengthbit>1</lengthbit>
<stuff>0</stuff>
<four>60422</four>
<SUBSTREAM_interior>498447 60422</SUBSTREAM_interior>
     </SUBSTREAM>
     <SUBSTREAM>
<lengthbit>1</lengthbit>
                <stuff>0</stuff>
<four>233080</four>
<SUBSTREAM_interior>558873 233080</SUBSTREAM_interior>
      </SUBSTREAM>


what i would like to do is take the sum of all the rightparts of the
<SUBSTREAM_interior> elements and substract this from the first <GOP_BYTE>
element. 2 problems arise here, first of all,
how can i take a sum of those elements?

I use number((substring-after(normalize-space(m:SUBSTREAM_interior),' ')))
to reach the right part of the <SUBSTREAM_interior> but something like

<xsl:template name="substream8" match="m:SUBSTR8">
      <xsl:value-of
select="sum(number((substring-after(normalize-space(./m:SUBSTREAM/m:SUBSTREA
M_interior),'
'))))"/>
</xsl:template>

doesnt work,

and secondly when i got the sum how can i substract it from a
<GOP_BYTE>element wich is standing higher in the xmlfile then the <SUBSTR8>
?

I hope someone can help me out here,

greetings Chris

_________________________________________________________________
Geschenkideeën en e-cards voor Valentijn ! http://www.msn.be/valentijn


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





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



Current Thread
  • [xsl] sum
    • poppe chris - Wed, 04 Feb 2004 12:56:06 +0100
      • Dimitre Novatchev - Wed, 4 Feb 2004 21:02:28 +0100 <=
      • <Possible follow-ups>
      • Josh Canfield - Wed, 4 Feb 2004 11:25:56 -0800