[xsl] Sorting + unique copy problem

Subject: [xsl] Sorting + unique copy problem
From: "Annalisa Ricci" <Annalisa.Ricci@xxxxxxxx>
Date: Thu, 8 Nov 2001 19:24:36 +0100
Hallo all,
I have a problem with sorting too and I couldn't solve it.
My XML contains a <Filmlist>.
Every <Film> in the <Filmlist> can have 1..* <KeyWord> tags.
I would to use the KeyWord values as <OPTION> of a <SELECT> input.
I would every KeyWord value to be present in a unique copy, and sorted in
alphabetic order.
Something like :

<option value="{Keyword1}"> Keyword1</option>
<option value="{Keyword2}"> Keyword2</option>
<option value="{Keyword3}"> Keyword3</option>
<option value="{Keyword4}"> Keyword4</option>
<option value="{Keyword5}"> Keyword5</option>

I tried the code XSL below and the KeyWord values are present in un unique
copy, but they aren't sorted.

What is wrong?
TIA, annalisa
====My XML ================================

====My XSL ================================
<xsl:key name="kw" match="KeyWord" use="."/>

<xsl:template match="/">
    <form action="process_user.jsp" TARGET="result" method="get">
           <select type="text" name="kw" size="1" maxlength="125">
                    <option value="empty"/>
                     <xsl:apply-templates select="//KeyWord"/>

<xsl:template match="KeyWord">
    <xsl:for-each select="self::node()[generate-id(.)=generate-id(key('kw',
    <xsl:sort select="." />
    <option value="{.}"><xsl:value-of select="."/></option>

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

Current Thread