4 Replies Latest reply on Nov 17, 2008 5:43 AM by blep

    XSL Integration

    blep Newbie

      Hi

      My application have to apply XSL transformation to XML documents, of course a esb service using smooks can handle this job. An other requirement for my application is to empower users to publish new transformation services based on XSL.

      To do so, they have to set the service configuration file, the smooks resource file with the XSL location AND the selector with the root element.

      This process is not so complicated but from user view you can imagine that it is not so easy to understand why they have to set this smooks res file. And if a user just want to set a service with a XSL without any XSL skills, it is not possible because he has to know the root element, as smooks is fragment based.

      The target process (the one we'd like!) is : set the service up and just set the XSL location and deploy.

      So my questions are:

      - In the message transformation guide, I read:

      In this release of JBossESB, XSL Transformations are supported through Smooks. In later releases we may support XSLT natively. Support for XSLT can be provided by creating a custom org.jboss.soa.esb.actions.ActionProcessor implementation.
      . Do you know when this feature will be available?
      - If not, is there any way, in smooks, to select the root element without knowing it (like selector="/" maybe?)?
      - If not, is there any way to give smooks paramters in order to have only the jboss-esb.xml file to set? Something like:
      jboss-esb.xml:
      <action name="transform" class="org.jboss.soa.esb.actions.smooks.SmooksAction">
       <property name="smooksConfig" value="smooks-config.xml" />
       <property name="xslFile" value=sheet.xsl"/>
       <property name="rootNode" value="myRoot"/>
      </action>


      a generic smooks-confi.xml for all XSL transformations:
      <?xml version="1.0"?>
      <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
       <resource-config selector="${rootNode}">
       <resource>${xslFile}</resource>
       <param name="is-xslt-templatelet">false</param>
       </resource-config>
      </smooks-resource-list>
      


        • 1. Re: XSL Integration
          Kevin Conner Master

          I'll leave Tom to discuss any smooks specific options, but from the perspective of the ESB this is not something that we support directly at this stage.

          It would be a simple matter, however, to create a new action to wrap this. You could either subclass the smooks action, defaulting the missing configuration parameters, or create an action which uses XSLT. The choice would be yours.

          • 2. Re: XSL Integration
            blep Newbie

            Hello,

            Of course instancing our own XSLT processor (xalan) is an option but we think if SOA platform provides the means to process XSLT transformation (actually through smooks and natively in the future), we have to use it and find the correct setting to make it compliant with our needs.

            Rgds

            • 3. Re: XSL Integration
              Tom Fennelly Master

              Hi blep... to target the XSL at the root fragment (i.e. the whole document) set the selector to "$document". That will match against the root element - no need for your users to know what it is.

              • 4. Re: XSL Integration
                blep Newbie

                Great!

                It fixes two issues in the same time because another need was to ensure if no fragment compliant with the selection is found, then the content have to set to an empty value.

                Thank you for answers.