xsl-list
[Top] [All Lists]

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

2011-07-11 18:06:06
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?

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>