RE: [xsl] Sorting resulttree to multiple levels

Subject: RE: [xsl] Sorting resulttree to multiple levels
From: Jarno.Elovirta@xxxxxxxxx
Date: Thu, 15 May 2003 13:25:20 +0300
Hi,

> What I need is to sort the resulttree. This seems to be 
> somekind of grouping
> problem. The structure of xml is supposed to describe a 
> discussion tree.
> Should I try some key solution or what?
> 
> So the result is supposed to be something like:
> 
> id41 (from element <knowledge-object id="41"> )
>   47 (<unstructured-source>47</unstructured-source>
>   48
>    49
>     50
>    51
>   52
> 
> id42
>   23
>    24
>     25
>    26
>   27

Well, you could define a key

  <xsl:key name="id" match="knowledge-object" use="@id" />

and then just recursively go through knowledge-object and always retrieving their sub-topics. In your stylesheet you tried to use xsl:for-each, but you really need xsl:apply-templates to make the processing recursive. The only problem you have is how to identify the topic root knowledge-object to start the processing, but since the example data is incomplete, it's hard to tell what will indicated root topics.

Cheers,

Jarno - Assemblage 23: Anthem

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


Current Thread