Skip to content

Instantly share code, notes, and snippets.

@playerjamesbattleground
Last active August 29, 2015 13:56
Show Gist options
  • Save playerjamesbattleground/8816879 to your computer and use it in GitHub Desktop.
Save playerjamesbattleground/8816879 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans">
<xsl:output method="xml" indent="yes" />
<xsl:param name="service.op.name.capitalcase"/>
<xsl:param name="service.op.name.lowercase"/>
<xsl:template match="*[local-name() = 'mule' and namespace-uri() = 'http://www.mulesoft.org/schema/mule/core']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:choose>
<xsl:when test="//jms:endpoint/@name = $endpointname">
<!-- Already has config -->
</xsl:when>
<xsl:otherwise><!--<xsl:apply-templates select="@* | *"/>-->
<xsl:comment><xsl:value-of select="$service.op.name.capitalcase"/> JMS Endpoints</xsl:comment>
<xsl:text>&#10;</xsl:text>
<jms:endpoint mimeType="text/xml" connector-ref="Service_JMS_Connector">
<xsl:attribute name="queue">${<xsl:value-of select="$service.op.name.lowercase"/>.request.queue}</xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="<xsl:value-of select="$service.op.name.capitalcase"/>
_Request_JMS_Endpoint"/></xsl:attribute>
<xsl:attribute name="doc:name"><xsl:value-of select="$service.op.name.capitalcase"/>&#xA0;Request JMS Endpoint</xsl:attribute>
</jms:endpoint>
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
....
<xslt in="template-mule-config.xml" out="mule-config.xml" style="add-mule-config.xsl" processor="trax">
<param name="service.op.name.lowercase" expression="invoiceorder" />
<param name="service.op.name.capitalcase" expression="InvoiceOrder" />
</xslt>
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment