RE: How to transform flat structure into hierarchical one?

Subject: RE: How to transform flat structure into hierarchical one?
From: "Paulo Gaspar" <paulo.gaspar@xxxxxxxxxxxx>
Date: Wed, 7 Jun 2000 18:59:16 +0200
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Kay Michael
>>
> > Here he does not mean group as in "GROUP BY" but simply as putting
> > related records next to each other as in "ORDER BY". Don't 
> > think in SQL all the time - English is trickier than that.
> > 
> Yes, I was speaking generically. But you can go further than SQL 
> ordering to
> make the transformation easy, for example you can start with a SELECT
> DISTINCT and put a list of distinct key values at the start of 
> the XML file:
> it's then easy to work through the distinct values and for each one use
> key() to find all the actual records with that value.

As the case was presented that would mean executing 2 queries without
data duplication savings. I also do not see the possible XSLT becoming 
much more efficient so... my guess is that it would be slower.

But that principle would apply with bulky master data. 

A classic example is the Invoice/InvoiceRows - onde does not want to 
duplicate a massive invoice header per each of its rows (wich usualy hold 
less data than the invoice header). The duplication would produce a huge
extra amount of XML to be parsed.

> Another way to tackle this problem is not to generate an XML file at all.
> Instead the program that queries the database can offer the data 
> to the XSLT
> processor as a stream of SAX events. It's then easy for it to 
> slip in extra
> startElement and endElement events when the key value changes.
> 

That is a damn interesting method.

I am not going to use id in my "nice" ADO2.5/MSXML3 framework where so
much is already there, but I am planing the move to a Java environment
(probably Oracle's) and then...

(Yeah... Java is slower but I am not blind to the advantages.)


Have fun,

Paulo Gaspar
(paulo.gaspar@xxxxxxxxxxxx)


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread