|
Subject: Re: [xsl] How to "flatten" a XML file with n-ary Cartesian product over n sequences X1, ..., Xn using XSL From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Sat, 29 Aug 2009 13:53:00 +0200 |
The desired output is a delimited file shown as follows:
'output.csv' root,itemCode,itemName,aCode,aDescription,bCode,bDescription,cCode,cDescription 01,name0,10,description0,100,description2,996,description4 01,name0,10,description0,100,description2,997,description5 01,name0,10,description0,200,description3,996,description4 01,name0,10,description0,200,description3,997,description5 02,name1,20,description6,null,null,998,description10 02,name1,20,description6,null,null,999,description11
Output is the Cartesian product of each item with its own sub-sequences.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mf="http://example.com/2009/mf" version="2.0">
<xsl:param name="lf" select="' '" as="xs:string"/> <xsl:param name="sep" select="','" as="xs:string"/> <xsl:param name="default" select="'null'" as="xs:string"/>
<xsl:for-each select="root/item">
<xsl:call-template name="mf:make-lines">
<xsl:with-param name="item" select="."/>
<xsl:with-param name="item-list" select="$item-list"/>
</xsl:call-template>
</xsl:for-each>Martin Honnen http://msmvps.com/blogs/martin_honnen/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] How to "flatten" a XML fi, Martin Honnen | Thread | [xsl] Problems with xsl:result-docu, Luis A Ortiz |
| [xsl] Resolved: Problems with xsl:r, Luis A Ortiz | Date | Re: [xsl] Some attribute not displa, lee qm |
| Month |