I've a project where the XML should be transformed.
If a tag exists in Output and Parameters, the Parameters one should be
replaced by the Output corresponding and its childs.
Example: (XML In):
<RESULT>
<PARAMETERS>
<CYCLE>
<ENDDATE></ENDDATE>
<NUMBER>50</NUMBER>
</CYCLE>
<FILE>
<CHECK>Yes</CHECK>
</FILE>
<DIR>
<NAME>ONE</NAME>
</DIR>
<RUNTYPE>SAMPLE</RUNTYPE>
</PARAMETERS>
<OUTPUT jobfactor="71">
<CYCLE>
<NAME>MARY<\NAME>
<SURNAME>ROSE<\SURNAME>
</CYCLE>
<FILE>
<FILENAME>E:\ftphome\vodafone\xml\CC20060215S50.XM L</FILENAME>
</FILE>
</OUTPUT>
</RESULT>
(XML Out):
<PARAMETERS>
<CYCLE>
<NAME>MARY<\NAME>
<SURNAME>ROSE<\SURNAME>
</CYCLE>
<FILE>
<FILENAME>E:\ftphome\vodafone\xml\CC20060215S50.XM L</FILENAME>
</FILE>
<DIR>
<NAME>ONE</NAME>
</DIR>
<RUNTYPE>SAMPLE</RUNTYPE>
</PARAMETERS>
I've done somtehing like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0"
encoding="iso-8859-1"></xsl:output>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="OUTPUT"></xsl:template>
<xsl:template match="/RESULT/PARAMETERS/FILE">
<xsl:copy-of select="/RESULT/OUTPUT/FILE" />
</xsl:template>
</xsl:stylesheet>
but this only works if FILE exists, it is not generic. Might you help
me, please?
Its urgent.