This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Summing over nodes belonging to different ns


This stylesheet computes it two ways.   Works with msxml3.

<?xml version="1.0"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
  xmlns:us="www.us.com"
  xmlns:them="www.them.com"> 

<xsl:template match="summary">
Sum of values for each namespace: 
<xsl:value-of select="format-number(sum(//us:value) + sum(//them:value),
'###,###,##0.00')" /> 
Sum of all 'value' elements regardless of namespace: 
<xsl:value-of select="format-number(sum(//*[local-name() = 'value']),
'###,###,##0.00')" />
</xsl:template>
</xsl:stylesheet> 

Don


>-----Original Message-----
>From: Parker, Daniel [mailto:Daniel.Parker@schwab.com]
>Sent: Wednesday, October 25, 2000 10:21 AM
>To: 'xsl-list@mulberrytech.com'
>Subject: Summing over nodes belonging to different ns
</summary>
>
>is there a simple way of using the sum function to compute a 
>grand total for
>the us:values and the them:values?
>
>Thanks,
>Daniel Parker
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]