Re: [xsl] sum() over attributes is 0

Subject: Re: [xsl] sum() over attributes is 0
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Aug 2007 20:44:49 -0300
You don't mention which processor you are using but certainly the surface evidence looks like a bug.

Which tool are you using and what do you get with the following change?

<xsl:comment>
  <xsl:text>count: </xsl:text>
  <xsl:value-of select="count(//lc:container[lc:item]/@select)"/>
</xsl:comment>
<xsl:comment>
  <xsl:text>list of select attributes: </xsl:text>
  <xsl:for-each select="//lc:container[lc:item]/@select">
    <xsl:value-of select="."/>
    <xsl:text> </xsl:text>
  </xsl:for-each>
</xsl:comment>

The above will address the nodes using the same address that is being used for the sum function.

Have you tried your code with any other processors?

. . . . . . . . . . Ken

At 2007-08-21 16:33 -0700, Andreas Kemkes wrote:
I'm not having much success using the sum() function over a node set.

The following two expressions

<xsl:comment>
  <xsl:text>sum: </xsl:text>
  <xsl:value-of select="sum(//lc:container[lc:item]/@select)"/>
</xsl:comment>
<xsl:comment>
  <xsl:text>list of select attributes: </xsl:text>
  <xsl:for-each select="//lc:container[lc:item]">
    <xsl:value-of select="@select"/>
    <xsl:text> </xsl:text>
  </xsl:for-each>
</xsl:comment>

result in the following output:

    <!--sum: 0-->
    <!--list of select attributes: 2 3 1 -->

I'm not clear why the result of sum() is 0. Are there any other prerequisites that I'm missing?

Thanks again.








____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
http://mobile.yahoo.com/go?refer=1GNXIC


--
Upcoming public training: XSLT/XSL-FO Sep 10, UBL/code lists Oct 1
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Jul'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread