Jump to content

XSLT with Sum


Recommended Posts

Given this xml:<?xml version="1.0" encoding="UTF-8"?><dataroot>  <Entry GLCategory="NET SALES">-474893.74</Entry>  <Entry GLCategory="NET SALES">2764.57</Entry>  <Entry GLCategory="VARIANCES">13068.06</Entry>  <Entry GLCategory="VARIANCES">-851.18</Entry>  <Entry GLCategory="MATERIAL">55273.86</Entry>  <Entry GLCategory="MATERIAL">12791.22</Entry>  <Entry GLCategory="LABOR">23159.81</Entry>  <Entry GLCategory="OVERHEAD">134343.71</Entry>  <Entry GLCategory="SELLING, GENERAL & ADMIN">5090.38</Entry>  <Entry GLCategory="SELLING, GENERAL & ADMIN">344.02</Entry></dataroot>and this xsl:<?xml version='1.0'?><xsl:stylesheet version="1.0"      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:output method="xml"/>  <xsl:template match="/">  <xsl:element name="NET SALES">        <xsl:value-of select="sum(//Entry[@GLCategory=NET SALES])"></xsl:value-of>     </xsl:element></xsl:template></xsl:stylesheet>I expect the answer to be (-474893.74 + 2764.57)= -472,129.17But my "style sheet cannot be parsed (tried with XML Copy Editor and/or Notepad++ XML Tools)QUESTION: What is the problem with my xsl?  Weird thing - I swear it worked once and then I must have changed something and no joy.Attached file sha256sum: 852c0e3d4c478a59895f3fe20c067caf37ba8ffc9320c3f469199839a8c55c30

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...