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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...