Hi,
I am trying to split an xml using xslt. For this I am using <redirect:write> which is Xalan specific. Is there an alternative tag I can use and get the same functionality?
This is an example xml file:
<?xml version="1.0" encoding="UTF-8"?>
<MyFType>
<MyRType>
<MCode>
<ID>1</ID>
<Title>ABC</Title>
<ShortSummary>EFG</ShortSummary>
</MCode>
</MyRType>
<MyRType>
<MCode>
<ID>2</ID>
<Title>WER</Title>
<ShortSummary>EFG</ShortSummary>
</MCode>
</MyRType>
</MyFType>
This is the xslt which will split the above into 1.xml and 2.xml
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
extension-element-prefixes="redirect"
version="1.0"
>
<xsl
utput method="xml"/>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="MyFType">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="MyRType">
<xsl:variable name="filename" select="concat(MCode/ID,'.xml')" />
<redirect:write select="$filename">
<MyRType>
<xsl:apply-templates />
</MyRType>
</redirect:write>
</xsl:template>
<xsl:template match="MCode">
<xsl:copy-of select="." />
</xsl:template>
</xsl:stylesheet>