Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: Sun, 29 Jun 2008 03:45:33 -0700 (PDT),    group: microsoft.public.xsl        back       


ceiling   
For each element in the group I need to get ceiling of divide
operation then get the summation for group elements
I tried this code but it’s doesn’t work


<xsl:for-each-group select="csv:line" group-by="csv:field[1]">
									<xsl:element name="csv:field">

                   <xsl:value-of select="sum(ceiling(current-group()/
csv:field[4] div 1000))"/>
								</xsl:element>

</xsl:for-each-group>


<csv:line>
                <csv:field>48</csv:field>
                <csv:field>20</csv:field>
                <csv:field>6</csv:field>
                <csv:field>6430</csv:field>
        </csv:line>
        <csv:line>
                <csv:field>23</csv:field>
                <csv:field>18</csv:field>
                <csv:field>5</csv:field>
                <csv:field>4621</csv:field>
        </csv:line>
        <csv:line>
                <csv:field>48</csv:field>
                <csv:field>23</csv:field>
                <csv:field>198</csv:field>
                <csv:field>5770</csv:field>
        </csv:line>
        <csv:line>
                <csv:field>25</csv:field>
                <csv:field>27</csv:field>
                <csv:field>7</csv:field>
                <csv:field>8873</csv:field>
        </csv:line>
date: Sun, 29 Jun 2008 03:45:33 -0700 (PDT)   author:   unknown

Re: ceiling   
heshamelesawy@gmail.com wrote:
> For each element in the group I need to get ceiling of divide
> operation then get the summation for group elements
> I tried this code but it’s doesn’t work
> 
> 
> <xsl:for-each-group select="csv:line" group-by="csv:field[1]">
> 									<xsl:element name="csv:field">
> 
>                    <xsl:value-of select="sum(ceiling(current-group()/
> csv:field[4] div 1000))"/>
> 								</xsl:element>
> 
> </xsl:for-each-group>

I am not sure I understand what you want to achieve but perhaps the 
following does what you want:

<xsl:for-each-group select="csv:line" group-by="csv:field[1]">
									<xsl:element name="csv:field">

                    <xsl:value-of select="sum(for $l in current-group() 
return ceiling($l/csv:field[4] div 1000))"/>
								</xsl:element>

</xsl:for-each-group>

The grouping is the same as you have but then the computation of 
csv:field[4] div 1000 and the ceiling is done for each csv:line element 
in the group, in the end the sum is taken.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Sun, 29 Jun 2008 13:33:40 +0200   author:   Martin Honnen

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us