JBoss.org Community Documentation

10.5.2. XSLTConfigDelegate

The XSLTConfigDelegate class is an implementation of the ServicesConfigDelegate that expects a delegate-config element of the form:

    <xslt-config configName="ConfigurationElement"><![CDATA[
        Any XSL document contents...
     <xslt-param name="param-name">param-value</xslt-param>
     <!-- ... -->

The xslt-config child element content specifies an arbitrary XSL script fragment that is to be applied to the MBean service attribute named by the configName attribute. The named attribute must be of type org.w3c.dom.Element. The optional xslt-param elements specify XSL script parameter values for parameters used in the script. There are two XSL parameters defined by default called host and port, and their values are set to the configuration host and port bindings.

The XSLTConfigDelegate is used to transform services whose port/interface configuration is specified using a nested XML fragment. The following example maps the port number on hypersonic datasource:

<service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS" 
        <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

  <xsl:output method="xml" />
  <xsl:param name="host"/>
  <xsl:param name="port"/>

  <xsl:template match="/">

  <xsl:template match="config-property[@name='ConnectionURL']">
    <config-property type="java.lang.String" name="ConnectionURL">
       jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/>

  <xsl:template match="*|@*">
      <xsl:apply-templates select="@*|node()"/>
     <binding host="localhost" port="1901"/>