Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Denormalised File from XML & XSL Files

$
0
0

Hi All

In VS2008 I would like to create a de-normalized file for importing into a SQL table. I have a XML file downloaded from client site and I have created the XSL file from the XML.

I am using a XML task with the XLST operation type, with the source of the XML file and second operand file being the XSL file and finally the output is the de-normalized file.

The XML file or batch holds invoice information;

Batch File num 1234;

  has <invoices>

<invoices> can have one or more <Invoice>

<Invoice> has header details, then <items>

<items> can have one or more <item>

See screen shot below, it's too big to include the closing tags at bottom.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" encoding="UTF-8" indent="yes" /><xsl:template match="/"><xsl:for-each select="Export"><Batches><xsl:for-each select="Export/Invoices"><Invoices><Invoice><AgencyName></AgencyName><TransDescription></TransDescription><CampaignName></CampaignName><AgencyNo></AgencyNo><TransactionNo></TransactionNo><CampaignNo></CampaignNo><PurchaseOrderNo></PurchaseOrderNo><CampaignAccountCode></CampaignAccountCode><CampaignType></CampaignType><InvoiceDate></InvoiceDate><ExTaxTotal></ExTaxTotal><IncTaxTotal></IncTaxTotal><Agent></Agent><AgentAccCode></AgentAccCode><CoAgent></CoAgent><CoAgentAccCode></CoAgentAccCode><Items><Item><OrderItemNo></OrderItemNo><Description></Description><SaleCode></SaleCode><SupplierNo></SupplierNo><SupplierName></SupplierName><PublicationName></PublicationName><PublicationAdSizeDescription></PublicationAdSizeDescription><PublicationAdSizeFixedX></PublicationAdSizeFixedX><PublicationAdSizeFixedY></PublicationAdSizeFixedY><ArtworkType></ArtworkType><Date></Date><Qty></Qty><PriceExcGST></PriceExcGST><PriceIncGST></PriceIncGST><MediaRebateExcGST></MediaRebateExcGST><MediaRebateIncGST></MediaRebateIncGST></Item></Items></Invoice><xsl:value-of select="." /></Invoices></xsl:for-each><xsl:value-of select="." /></Batches></xsl:for-each></xsl:template></xsl:stylesheet>

My XSL file code is above.

After the XML task it creates the de-normalized file ok, but it doesn't have any columns everything is column 0.

Can anyone tell me if there is a way to create the XSL file or what the error is in my file.

Thanks for any assistance.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>