I am looking for solution for a scenario which is troubling me a lot.
I am working on mule 3.3.
I have some incoming XML and a second XMLcoming from the enricher.
Now the xml from the enricher is to be added into my input XML.
My flow looks like below (abstract)
<flow name="main" >
<file:inbound ....>
<enricher target="#[variable:myProperty]">
<vm:outbound .... />
</enricher>
<xslt transformer .... />
.......
.......
<file:outbound ..>
</flow>
My Mule Flow part and the XSL as given below
<mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="C:\NSBTransformerXSL.xsl" outputEncoding="UTF-8" doc:name="XSLT">
<mulexml:context-property key="RefXML" value="#[header:INVOCATION:RefXML]" />
</mulexml:xslt-transformer>
My XSL is given below
<xsl:param name="RefXML"></xsl:param>
<xsl:template match="@*|node()">
<xsl:copy >
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="TXRequest">
<xsl:copy copy-namespaces="no" >
<xsl:apply-templates select="@* | node()"/>
<xsl:copy-of select="$RefXML"/>
</xsl:copy>
</xsl:template>
Thanks..
Use an XSL-T transformer and pass the XML fragment you got from the enricher to your XSL as a named parameter.
That way you can easily combine two XMLs.
The correct way of doing this would be to parse
RefXMLas a DOM element, then pass it as an XSL parameter, but a bug in Mule prevents this 🙁So the only option is a verbatim copy of the string value of
RefXML:Not super satisfying but it works.