[xsl] Using key to group large documents

Subject: [xsl] Using key to group large documents
From: Heinz Seldte <HeinzS@xxxxxxxxx>
Date: Wed, 17 Mar 2004 07:04:06 +0200
Hi there,

I have to group information in the hypothetic format:

<item>
   <prop1>x</prop1>
   <prop2>y</prop2>
   <prop3>z</prop3>
   <lots-of-other-info-for-display/>
</item>

I need to group info in the items as follows:

prop1
  prop2
     prop3

(Thus - first by prop1, then prop2, then prop3)

To do this, I am using keys, but I am encountering very bad performance when
using Xalan.  To improve the performance I have now produced only one key
using a concatenation of all properties to group the items:

    <xsl:key name="per" match="//item" use="concat(prop1,concat(prop2,
prop3))"/>

After grouping I have to produce a fairly complex matrix (output as an html
table) for each item (since the grouped items are then combined and
displayed in a single row based on other item info). This also takes quite a
while, so I have resorted to taking a multi-pass approach by using the Xalan
nodeset function to first apply-imports to produce an xml document with the
grouped items and then apply templates to this nodeset to produce the html.

My question is this - is there some "rule-of-thumb" max size where the input
documents should rather be grouped or split by the processes producing them
rather than the stylesheet?  I do not want to do this, since the grouping is
based purely on a presentation requirement and I do not want the application
or business layer to worry about these issues. With the above scenario,
using Xalan 2.3.1 on linux I seem to start having problems around the 2Meg
mark with 1500 items.

Any suggestions on alternative methods etc would be much appreciated. 


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


Current Thread