Sidebar

XSL with Java objects

0 votes
498 views
asked Feb 10, 2015 by mike-r-7535 (13,830 points)

I am running Java 7, and XSL 1.0.  I am getting the following error when calling qie.applyXSLTransform().

Use of the extension function ' http://xml.apache.org/xslt/java:new' is not allowed when the secure processing feature is set to true

This same configuration works in Java 6.

1 Answer

0 votes

Java 7 and Java 8 have, by default, restricted the use of creating Java objects within XSL since it can allow access to the JVM from the XSL file.  One valid use case for it, however might be to use Java date objects like this:

<xsl:variable name="nowDate" select="java:java.util.Date.new()"/>

There are two options I would recommend:

1. XSL 2.0 has built in date functions, which can be used instead of using Java date objects. http://www.w3.org/TR/xslt20/#format-date

2. If you want to still use Java objects in your XSL, in the QIE Service Manager, add the following line to your Startup tab, Arguments section: 

-Dqie.allowXslInsecureProcessing=true

answered Feb 10, 2015 by mike-r-7535 (13,830 points)
...