[xsl] Trying to simply reformat but my stylesheet will not compile

Subject: [xsl] Trying to simply reformat but my stylesheet will not compile
From: thehulk@xxxxxxxxxxx
Date: Mon, 11 Jul 2011 23:05:53 +0000 (UTC)
I cannot restructure my working inline expression into the structured expressions that i want.

The original was working. 

The task is: If there is any child element named "Service", output a <Total_Rollable_Charge> element, that adds up the amounts of the charges.

It was working this way:
<if test="Service">
<Total_Rollable_Charge Amount="{sum(Service//Charge[not(Trans_Class='I')]/Charge_Amount/Amount)}" Flag="HasSvc" />
</if>		<!-- end if-service -->     


The next similar task is so much more complex, so I want to factor this out into <xsl:element> 
and <xsl:attribute> tags, and then use that as a model for the tougher one. This one is simple right? 

<if test="Service">
  <element name="Total_Rollable_Charge">
    <attribute name="Amount"> 
      <value-of select="{sum( Service//Charge[not(Trans_Class=&quot;I&quot;)]/Charge_Amount/Amount )}" />
    </attribute>	
    <attribute name="Flag" >
      <value-of select="HasSvc" />
    </attribute>	
  </element>
</if>

but no! 
ERROR:  'file:my.xsl: 
line 427: Error parsing XPath expression '{sum( Service//Charge[not(Trans_Class="I")]/Charge_Amount/Amount )}'.'
FATAL ERROR:  'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source)
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Unknown Source)
	at Middleware.Executor.main(Executor.java:278)

Where have I erred?

Current Thread