xsl-list
[Top] [All Lists]

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

2007-08-22 10:21:58
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(_at_)yahoo(_dot_)com>
To: XSL-List <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
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 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>