Click to See Complete Forum and Search --> : xsl:sort ..why is it not working?


Candy
11-21-2001, 04:22 PM
Hi,

If you have the following code, where do you insert this xsl:sort element
line?

<xsl:sort select="./softwaretitle" order="ascending" data-type="text"/>

<xsl:template match="/tipsheets/tipsheet/softwaretitle">
<xsl:variable name="curtitle" select="."/>
<xsl:for-each select=".">
<xsl:sort select="." order="ascending" data-type="text"/>
<xsl:if test="not (preceding::softwaretitle[.=$curtitle])">
<option><xsl:attribute name="value"><xsl:value-of select="$curtitle"/></xsl:attribute><xsl:value-of
select="$curtitle"/></option>
</xsl:if>
</xsl:for-each>
</xsl:template>

I have tried it in all sorts of places and it won't work. This template displays
softwaretitle in a drop down list and removes duplicates.

Thank you,

Candy

S
11-23-2001, 04:35 AM
hi,
the <xsl:sort> element should be direct child of either <xsl:template>
or <xsl:foreach> template
if u have MSDN loaded in ur m/c, pl go thro' help

bye,
S



"Candy" <candy@apsc.ubc.ca> wrote:
>
>Hi,
>
>If you have the following code, where do you insert this xsl:sort element
>line?
>
><xsl:sort select="./softwaretitle" order="ascending" data-type="text"/>
>
><xsl:template match="/tipsheets/tipsheet/softwaretitle">
> <xsl:variable name="curtitle" select="."/>
> <xsl:for-each select=".">
> <xsl:sort select="." order="ascending" data-type="text"/>
> <xsl:if test="not (preceding::softwaretitle[.=$curtitle])">
> <option><xsl:attribute name="value"><xsl:value-of select="$curtitle"/></xsl:attribute><xsl:value-of
>select="$curtitle"/></option>
> </xsl:if>
> </xsl:for-each>
></xsl:template>
>
>I have tried it in all sorts of places and it won't work. This template
displays
>softwaretitle in a drop down list and removes duplicates.
>
>Thank you,
>
>Candy