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-->

How to generate a Excel sheet with xslt

Today I searched for a solution to submit a form embedded into a jQuery dialog with ajax.

My situation is the following: I use a jQuery UI Dialog to display a feedback-form in my web application. The feedback form should not change the state of the page the user worked before.

So my first approach was to change my form post action into a ajax post action. This can be done easily during the initialisation of the dialog. See the following code snippet:

 * Method to initialize the feedback dalog.
 * @see contact_dialog.xhtml
function initContactDialog() {
    // set default settings for profile dialog
        resizable : false,
        height : 530,
        width : 550,
        modal : true,
        autoOpen : false

    // hide contact dialog per default
    // the following method modifies the submit request into a ajax request
    // So the dialog will be closed after the submit was successfull without
    // affects to the main page.
    $('#dialog-contact-form').submit(function() {
        // show up waiting panel
               type: "POST",
               url: "http://localhost:8080/myrestservice",
               data: $("#dialog-contact-form").serialize(), // serializes the form's elements.
               success: function(data)
               error: function(data)
                   alert('An error occured. Could not send data!'); // show response from post.

        return false; // avoid to execute the actual submit of the form.

With the initContactDialog() method I initialize the dialog and bind a function to the submit event of my form. The function changes the submit into a ajax call and closes the dialog after the ajax request was finished.

This is quite easy and the dialog will automatically close when the Ajax submit was finished.

Here is the html part of my dialog form:

    <!-- Dialog Box -->
        <div id="dialog-contact"  title="#{global.contact_title}">
            <form id="dialog-contact-form" method="post" name="contact_form">

                <h:panelGrid columns="2">

                                <input type="text" name="txtfirstname" value="" />
                        <dl style="">
                                <input type="text" name="txtlastname" value="" />
                        <dl style="">
                                <input type="text" name="txtemail" value="" />
                <dl style="margin: 0 0 0 0px;">
                        <textarea style="width: 450px; height: 80px;" name="_description" />
                <input type="submit" value="send" />


I open the dialog with the following JavaScript function:

 * helper method to open the contact dialog. 
 * The method creates a new empty contact workitem.
function openContact() {    


As you can see in my script and in the html snippet I have added a div section with the class ‘ajax-wait-panel’. This div overlays the form of my dialog when the ajax call is started. So the user will see a ‘Please wait’ message until the ajax request is finished. I simply add the class ‘ajax-waiting’ to the div section in the moment the request starts and remove the class when the submit was finished. So this is the css part of my solution:

/* Ajax-wait-panel can be useded in jquery dialogs
   for long runnign ajax request.
   Start by setting display:none to make this hidden.
   Background we set to 80% white with
   our animation centered, and no-repeating */
 .ajax-wait-panel {
    display:    none;
    position:   absolute;
    z-index:    1000;
    top:        0;
    left:       0;
    height:     100%;
    width:      100%;
    background: rgba( 255, 255, 255, .6 ) 
                50% 50% 
    cursor: wait;

.ajax-wait-panel  h2 {
    position: absolute;
    top: 50%;
    margin-top: -80px;
    color: #666;
    text-align: center;
    width: 100%;
/* Class to be added when ajax wait panel should 
   be displayed */
.ajax-waiting {
     display: block;