Converting the Clickbank Marketplace xml to csv

Using the following xsl stylesheet and software like xmlpad, you can convert the Clickbank Marketplace xml into a tab delimited file. I choose tab delimited because the descriptions may have commas which would mess with an comma delimited choice.

 I finally came up with the stylesheet while trying to transform the xml file into an xml suitable for import into Filemaker. I came close, but think I am having issues with the elements that have cdata. But who knows Filemaker basically says your import is screwed and not much more information. And what you can find on the web is sparse.

But I imported the tab delimited file I created. That worked. Then I exported the table into the FMPXMLRESULT type xml file. My transforms looked the same except for the cdata. I will finally get it to work though.Tags: , , , ,

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="Catalog/Category">
<xsl:variable name="Cat" select="Name"/>
<xsl:for-each select="Site">
<xsl:value-of select="$Cat"/>
<xsl:text>&#09;</xsl:text>
<xsl:copy-of select="Id"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="PopularityRank"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="Title"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="Description"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="Gravity"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="EarnedPerSale"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="PercentPerSale"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="TotalEarningsPerSale"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="TotalRebillAmt"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="Referred"/>
<xsl:text>&#09;</xsl:text>
<xsl:value-of select="Commission"/>
<xsl:text>&#xa;</xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>