I am trying to transform an xml file that I am getting into another one with a different layout and some extra tags.
The original xml files I am getting from a process that is fetching this data out of a CSV file so I am unable to change these xml files...
The original file I get is:
CODE
<?xml version="1.0"?>
<Calendars>
<currency>AED</currency>
<description>UAE DIRHAM</description>
<weekday>Friday</weekday>
<weekday></weekday>
<weekday></weekday>
<weekday></weekday>
<weekday></weekday>
<weekday></weekday>
<weekday></weekday>
<holiday>20051203</holiday>
<holiday>20060101</holiday>
<holiday>20060105</holiday>
<holiday>20060107</holiday>
<holiday>20060108</holiday>
<holiday>20060109</holiday>
<holiday>20060110</holiday>
</Calendars>
The XSLT file that I have made and using for the transformation is:
CODE
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mx="http://murex.com/xslt/common" exclude-result-prefixes="mx">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<Calendars>
<calendar id="cal_0">
<businessObjectId mefClass="mxStaticsDatesICALENDAR">
<identifier><xsl:value-of select="Calendars/currency"/></identifier>
</businessObjectId>
<description><xsl:value-of select="Calendars/description"/></description>
<swiftCode></swiftCode>
<holidaysPattern>
<weekdays>
<weekday><xsl:copy-of select="Calendars/weekday"/></weekday>
</weekdays>
<yearlyDates></yearlyDates>
<specialDates>
<date><xsl:copy-of select="Calendars/holiday"/></date>
</specialDates>
</holidaysPattern>
</calendar>
</Calendars>
</MxML>
</xsl:template>
</xsl:stylesheet>
The result I get out of that one is:
CODE
<?xml version="1.0" encoding="UTF-8"?>
<MxML version="1-1">
<Calendars>
<calendar id="cal_0">
<businessObjectId mefClass="mxStaticsDatesICALENDAR">
<identifier>AED</identifier>
</businessObjectId>
<description>UAE DIRHAM</description>
<swiftCode/>
<holidaysPattern>
<weekdays>
<weekday>
<weekday>Friday</weekday>
<weekday/>
<weekday/>
<weekday/>
<weekday/>
<weekday/>
<weekday/>
</weekday>
</weekdays>
<yearlyDates/>
<specialDates>
<date>
<holiday>20051203</holiday>
<holiday>20060101</holiday>
<holiday>20060105</holiday>
<holiday>20060107</holiday>
<holiday>20060108</holiday>
<holiday>20060109</holiday>
<holiday>20060110</holiday>
</date>
</specialDates>
</holidaysPattern>
</calendar>
</Calendars>
</MxML>
HOWEVER!! I still need to get rid of the "empty" weekday tags (<weekday/>) And I can't seem to find on how to do that.
Who can help me?