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: Fri, 28 Aug 2009 20:09:09 +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.
I've had limited success with my own limited self-learned XSL skills dealing on a per case basis, but I'm not satisfied with the efficiency achieved. Because I have no "normalized" approach, complexity of my XSL grows considerably, related to the number of sequences involved and I'm getting stuck when it involves more than three.
I was wondering if there is any "standard" method that solves this problem for n-sequences (i.e. using a <xsl:for-each-group> that groups by item and repeat the contents for each sublist?) so I could use recursion or iterations according to n. Please note that sequences are optional; the schema allows for empty or nonexistent sequences, where in such cases 'null' must be output for the missing fields.
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How to "flatten" a XML file w, reynaldo . rizzo | Thread | Re: [xsl] How to "flatten" a XML fi, Martin Honnen |
RE: [xsl] Cartesian product of sets, Michael Kay | Date | [xsl] Problems with xsl:result-docu, Luis A Ortiz |
Month |