Re: axis and sorting, or a two run task?

Subject: Re: axis and sorting, or a two run task?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 10 Nov 1999 15:56:03 GMT
> Given the following xml,

That isn't well formed xml so I am not sure I understood the question
and havent tested the following answer.

However

>  I want to
> output  the topic only once,
> then output the sorted q and a elements.

sounds like
<xsl:for-each select="qna/topic[not(. = following::topic)]"/>
 <xsl:sort select="."/>
 <xsl:value-of select="."/>
<!-- so this gives you all topics once in sorted sorted order
Now you want to get all the qna s that have a topic with the same value as
this, sorted in q order
 -->
  <xsl:for-each /wrapper/qna[topic = current()]>
   <xsl:sort select="q">
    whatever you want here
 </xsl:for-each>
 </xsl:for-each>

Any question that involves getting unique sorting should trigger a
standard pointer to saxon's group constructs which probably avoid
the overhead in building that following::topic list each time.


David


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


Current Thread