XSLT 2.0 with Eclipse and Wildfly

Eclipse IDE provides a cool feature which allows you to execute XSL templates within the IDE. You just need to select the XSL file together with the XML file and choose from the context menu

Run As -> XSL Transformation

But for some reasons Eclipse is not supporting XSL 2.0 – which is standard in these days. So for example if you try to use xsl functions like ‘format-date-time’ or ‘replace’ this will not work. This is also true for Wilfly application server. So here is how to add XSLT 2.0 support for both – Eclipse and Wilffly

Eclipse IDE

You can install an XSLT 2.0 processor manually into your Eclipse IDE:

  1. Download the latest Saxon XSLT processor
  2. Unzip the package to get the saxon9he.jar file and place it into your workspace or some external folder
  3. In eclipse choose “Window > Preferences” then “XML > XSL > Java Processors > Add”
  4. Fill in a “Processor Name”, e.g. “Saxon XSLT 2.0”
  5. In field “Processor type” choose “Saxon (XSLT 2.0)”
  6. Choose “Add external jar” and choose your saxon jar, e.g. “saxon9he.jar”
  7. Confirm by clicking “OK”

Now you can use saxon for XSLT 2.0 transformations in Eclipse. You need just configure your Run As Configurations and select the option ‘use specific process‘ to select the newly added Saxon processor.

Wildfly Sever

Also wildfly server supports only XSL 1.0 per default. If you need XSL 2.0 in your application add the following maven dependency:

        <!-- XSL 2.0 support-->

2 Replies to “XSLT 2.0 with Eclipse and Wildfly”

  1. Hi Ralph,

    Thanks for this tutorial. Could you please add some more details in the “Eclipse IDE” section especially regarding the Run Configuration settings? (I get a java.lang.ClassNotFoundException: org.xmlresolver.Resolver within main() from the Processor constructor (false) with Saxon HE-11)

    More specifically:
    – Which of the Eclipse IDEs should be used (only the Eclipse IDE for Enterprise Java and Web Developers provides the XML>XSL preference option that you describe)
    – Should the project be a Java project or other e.g. Maven to run the examples provided by Saxonica?
    – Where exactly is the option ‘use specific process‘ to be found?
    – ….any other useful update since the time this tutorial was written.

    Thanks in advance for your comments back.

  2. The Eclipse Edition and also the Project type does not really matter here. A ClassNotFoundException indicates more that the Java Version used by Eclipse is not matching the required version of your xsl processor. The JRE can be defined in the run-configuration in the tab ‘JRE’. And you can define the XSL Processor in the run-configuration in the tab ‘Processor’.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.