Ok if the requirement is to group all the products of the
same id together, I would follow the following steps. 1. Get
all the unique nodes 2. Group all the products with the id as
defined by the id of the unique node.
Is there any other way we could avoid using two nested loops
for a requirement like this? Thanks Vasu
Absolutely. Muenchian grouping solves this in O(n log n) time. See
www.jenitennison.com/xslt/grouping for the algorithm.
Actually it's essentially the algorithm you described above. Step 1
requires a serial scan of the document, Step 2 requires an index lookup
using a key. Your mistake was to do step 2 with a (second, nested)
serial scan.
Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list