Expand my Community achievements bar.

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

Avatar

Former Community Member

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.java:936)

    at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java: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.

3 Replies

Avatar

Level 1

We are having the same issue and would like to know if you found a solution.

Avatar

Former Community Member

The XSLT service is configurable.

http://help.adobe.com/en_US/LiveCycle/9.5/WorkbenchHelp/WS92d06802c76abadb-1cc35bda128261a20dd-6750....

1) Stop LiveCycle.

2) Add the .jars of your XSLT processor of choice to the LiveCycle server lib folder.

3) Restart LiveCycle.

4) Go to Workbench and stop the XSLT service. Right-click on XSLTService:1.0 and Edit Service Configuration.

Untitled.png

5) Enter the factory name for the given XSLT processor. I think for Xalan 2.7.1 it is org.apache.xalan.processor.TransformerFactoryImpl (but I could be wrong).

Untitled1.png

6) Restart the service.

Steve

Avatar

Level 1

I did something very similar, but specified the factory name in the workspace step instead of doing it globally.  (I used the Saxon library)  It would work once but after that the workflow would fail.  I would try to record the process and it would show up as a blank recording when trying to replay the process. Also when invoking the process through workbench it would indicate the process finished with no output variables (When in fact I did).

To solve this issue I went the route of the following blog (http://www.martinkremers.de/blog/?p=387).  I updated the example to use ES2 and everything is now working correctly.

Mike