[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] sum() of nodeset
Hello! I have xml file like this: ----------xml------------- <xml> <row m=1 y=1999 v=3 /> <row m=1 y=2000 v=43 /> <row m=2 y=1999 v=6 /> <row m=2 y=2000 v=56 /> ... </xml> -------------------------- and xsl like this (only relevant part is quoted to save space): -------------xsl---------- <xsl:for-each select="//row[@m=1]"> <tr> <td><xsl:value-of select="@m" /></td> <td><xsl:value-of select="@y" /></td> <td><xsl:value-of select="@v" /></td> </tr> </xsl:for-each> -------------------------- Now, I am trying to get sum of values for a particular m (stands for month, of course). I tried: <td><xsl:value-of select="@m[@m=1]" /></td>, but get 0 in this case If I try: <td><xsl:value-of select="//@m[@m=1]" /></td> I get sum of _all_ rows rather than sum of v's for a particular month. Is there a simple solution to my problem without transforming the original file to some intermediate format? Thanks a lot for any ideas, Shimon XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|