Database Reference
In-Depth Information
The sample XML from Listing 9-3 produced three separate outputs for the XML
Source component. To insert the data into our destination, we had to merge the outputs
into the format we wanted. Using the XSLT script in Listing 9-4 , we can “flatten” or
denormalize the data so that the XML Source component will have a single output.
Listing 9-4 . XSLT Script to Simplify Our XML Sample
<?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"/>
<xsl:template match="/Extract">
<Customers>
<xsl:for-each select="Customers/Customer">
<Customer>
<Key>
<xsl:value-of select="@Key"/>
</Key>
<FirstName>
<xsl:value-of select="Name/FirstName"/>
</FirstName>
<LastName>
<xsl:value-of select="Name/LastName"/>
</LastName>
<BirthDate>
<xsl:value-of select="BirthDate"/>
</BirthDate>
<Gender>
<xsl:value-of select="Gender"/>
</Gender>
<YearlyIncome>
<xsl:value-of select="YearlyIncome"/>
</YearlyIncome>
</Customer>
</xsl:for-each>
</Customers>
</xsl:template>
</xsl:stylesheet>
 
 
Search WWH ::




Custom Search