[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How to transform flat structure into hierarchical one?
> That is why Michael gave you the obvious key to make it > fast by remarking: > "Alternatively, change the SQL query so it does the > grouping for you" > > 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. 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. Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|