Last active
October 27, 2018 09:39
-
-
Save nabsha/b0d569127379fcc0aebb3d1cb73c0739 to your computer and use it in GitHub Desktop.
replace/merge/combine mule sub-flow and flow in-place of flow-ref
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:ns0="http://www.mulesoft.org/schema/mule/core"> | |
<xsl:output omit-xml-declaration="yes" indent="yes"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="@*|node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="/ns0:mule/ns0:sub-flow"/> | |
<xsl:template match="/ns0:mule/ns0:flow"> | |
<xsl:variable name="flowName" select="current()/@name"/> | |
<xsl:if test="not(//ns0:flow-ref[@name=$flowName])"> | |
<xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy> | |
</xsl:if> | |
</xsl:template> | |
<xsl:template match="//ns0:flow-ref"> | |
<xsl:variable name="flowName" select="current()/@name"/> | |
<xsl:choose> | |
<xsl:when test="/ns0:mule/ns0:sub-flow[@name=$flowName]"> | |
<xsl:apply-templates select="/ns0:mule/ns0:sub-flow[@name=$flowName]/*"/> | |
</xsl:when> | |
<xsl:when test="/ns0:mule/ns0:flow[@name=$flowName]"> | |
<xsl:apply-templates select="/ns0:mule/ns0:flow[@name=$flowName]/*"/> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment