Jump to content

david178

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by david178

  1. david178

    XSLT with Sum

    Oh dear. I just changed my element name to "NET_SALES" instead of "NET SALES" for the element I create with the stylesheet. So no spaces in element names appears to be the rule here! Back in business.
  2. david178

    XSLT with Sum

    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
×
×
  • Create New...