Re: [xsl] How to "flatten" a XML file with n-ary Cartesian product over n sequences X1, ..., Xn using XSL

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
reynaldo.rizzo@xxxxxxxxxxxxxxxx wrote:

The desired output is a delimited file shown as follows:


That line has nine items while the lines below have only eight items each.


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.

And what determines the complete number of sequences?


	Martin Honnen

Current Thread