Re: [xsl] dynamic grouping of tabular data; one or two transformations?

Subject: Re: [xsl] dynamic grouping of tabular data; one or two transformations?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Sat, 24 Nov 2001 15:20:06 +0000
Hi Dan,

> So here is my question to the list: Is it possible to do this with
> *one* stylesheet transformation? I can't see a way to generate the
> required grouping keys dynamically. My thinking is to first generate
> a stylesheet with the required key definitions and essential
> transformation code and then transform the original XML source with
> this generated stylesheet:
>
>   xsl2 = xml.transformNode(xsl1);
>   html = xml.tranformNode(xsl2);
  
It *is* possible to do it with a single transformation. If you know
what the fields are (i.e. A, B, C and D) in advance, you can set up
the keys for grouping by each individual field and then use predicates
to ensure that the groupings are working in the correct manner, rather
than having keys for each combination. If you don't know the fields in
advance it's more complicated, although even then if you can use
intermediate node sets (i.e. use a node-set() extension function) to
build the groups up step-by-step then it's doable.

But I think that using a two-step transformation where the first
transformation generates the keys that you use for the second
transformation is probably more straight-forward in the long run.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread