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

Subject: [xsl] Re: sum() over attributes is 0
From: Andreas Kemkes <a5sk4s@xxxxxxxxx>
Date: Wed, 22 Aug 2007 10:21:35 -0700 (PDT)
I'm only subscribed to the digest, so I'm responding to my own message and
hope it will end in the same thread.

Ken:

I'm using Java1.4.2 and according
to the release notes that entails "... xalan-j 2.4.1+ (Xalan version 2.4.1
with controlled 
bug fixes)."

<xsl:comment>
  <xsl:text>count: </xsl:text>
<xsl:value-of select="count(//lc:container[lc:item]/@select)"/>
</xsl:comment>
<!--count: 0-->

but both count(lc:container[lc:item]/@select) and
count(.//lc:container[lc:item]/@select) work.

What would be the issue with
using count(//lc:container[lc:item]/@select)?

Thanks,

Andreas

-----
Original Message ----
From: Andreas Kemkes <a5sk4s@xxxxxxxxx>
To: XSL-List
<xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, August 21, 2007 4:33:25 PM
Subject: sum() over attributes is 0

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
_____________________________________________________________________________
_______
Building a website is a piece of cake. Yahoo! Small Business gives you
all the tools to get online.
http://smallbusiness.yahoo.com/webhosting

Current Thread