3 Replies Latest reply on Nov 7, 2011 6:48 AM by Mike.Will

    XSLT  - Exception error when using XSLT 2.0 code in Transform on LiveCycle ES2

    IanKensey

      I'm new to using this forum, so apologies in advance in I have posted this to the wrong place.

       

      I'm using Adobe LiveCycle ES2.5 (Jboss) and have written several complex XSLT scripts.  All have worked, with the exception of the latest one in which I have to sum a repeating subnode that maynot exist and if it does, may contain a number or be empty.  When I have used SUM by itself, it works perfectly if I all the nodes have values, but returns zero if any are missing or are empty.  After some searching I found a solution (which I have made bold) in the fragment below.

       

      <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ...>

      ...

      <xsl:variable name="varUnitValueTotal" select="sum( (if(SOURCEUNITVALUE='') then 0 else SOURCEUNITVALUE) )"/>

      ...

      </xsl:stylesheet>

       

      I developed and tested this xslt in XMLSpy 2011 and it works a treat.  However, when I invoke the XSLT using the Services\XSLT Transformation 1.0\Transform, I get the following exception error:

       

      javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Could not find function: if

          at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.jav a:936)

          at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.j ava:774)

          at com.adobe.livecycle.xslt.XsltTransformer.transform(XsltTransformer.java:151)

      ...

       

      Now as far as the documentation is concerned ES2 and better should be using XSLT 2.0.  However to test a theory I changed the stylesheet version from 2.0 to 1.0 and re-ran the xslt in XMLSpy and it fell over at exactly the same place as the exception error.  Which makes me conclude that LC ES2+ is still using XSLT 1.0.

       

      Now I am stuck.  The only work around that I can see is to attempt to do the calculation in the form (which sort of defeats the point of usng XSLT).  That said I am reluctant to go down that path, since the maintenance overhead is going to be shocking if I have to apply to dozens of forms.

       

      Is there a way to tell the Transform service to use XSLT 2.0 and if so, how and what are the settings?  Or do I need to find and use a different transform engine, again if so which one should I use and what settings should I make at either JBoss and/or AdminUI level.

       

      Really hoping that someone can help.