XML Transformation

Here is an XML example it is very well structured therefore there not need to perform additional transformations.

<Table>
<Record>
<ID>1</ID>
<Company>James Bond Production</Company>
<Amount>13</Amount>
</Record>
<Record>
<ID>2</ID>
<Company>Green Cloud</Company>
<Amount>14</Amount>
</Record>
</Table>

XML is a very flexible format and there is no guarantee that next file received will have an exactly same structure

Shifted XML Tags

This XML has different tags order

<Table>
<Record>
<Company>James Bond Production</Company>
<ID>1</ID>
<Amount>13</Amount>
</Record>
<Record>
<ID>2</ID>
<Company>Green Cloud</Company>
<Amount>14</Amount>
</Record>
</Table>

Additional XML Tags

This XML has additional YEAR tag

<Table>
<Record>
<ID>1</ID>
<Company>James Bond Production</Company>
<Year>1956</Year>
<Amount>13</Amount>
</Record>
<Record>
<ID>2</ID>
<Company>Green Cloud</Company>
<Amount>14</Amount>
</Record>
</Table>

XSLT Transformation

XSLT is a way of transforming XML into a different format

<?xml version=“1.0” encoding=“UTF-8”?>
<xsl:stylesheet version=“1.0” xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”>
<xsl:output method=“xml” indent=“yes” version=“1.0”/>
<xsl:template match=“Table”>
<Table>
<xsl:for-each select=“Record”>
<Record> <ID><xsl:value-of select=“ID”/></ID>
<Company><xsl:value-of select=“Company”/></Company>
<Amount><xsl:value-of select=“Amount”/></Amount>
</Record>
</xsl:for-each>
</Table>
</xsl:template>
</xsl:stylesheet>

For more technologies supported by our ETL Software see Advanced ETL Processor Versions and Visual Importer ETL Versions

Confused? Ask question on our ETL forum

  • knowledgebase/xml1.txt
  • Last modified: 17/09/2018 09:45
  • by admin