JBoss.org Community Documentation
The XSLTConfigDelegate
class is an implementation of the ServicesConfigDelegate
that expects a delegate-config
element of the form:
<delegate-config> <xslt-config configName="ConfigurationElement"><![CDATA[ Any XSL document contents... ]]> </xslt-config> <xslt-param name="param-name">param-value</xslt-param> <!-- ... --> </delegate-config>
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" delegateClass="org.jboss.services.binding.XSLTConfigDelegate"> <delegate-config> <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[ <xsl:stylesheet 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:apply-templates/> </xsl:template> <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'/> </config-property> </xsl:template> <xsl:template match="*|@*"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> ]]> </xslt-config> </delegate-config> <binding host="localhost" port="1901"/> </service-config>