Subject: RE: <xsl:sort> using a derived element
From: "RUSSO, EDITH" <EDIRUS@xxxxxxxxxx>
Date: Wed, 7 Mar 2001 07:48:20 -0800
|
Jeni,
Before I saw your reply, I saw Mike Kay's reply and did it a little
differently than what you had suggested below. Both work, is that the case
a lot of the time? This is a trivial combobox, but how should I decide
which way to implement something similar to this in the future? What I did
was added /Itm to the end of the xsl:apply-templates and xsl:template
statements and took out the xsl:for-each:
<xsl:apply-templates select="PATHFINDER/List[ListID='102000']/Itm">
<xsl:sort select="substring-after(ItmDesc,'-')" order="ascending"/>
</xsl:apply-templates>
<xsl:template match="PATHFINDER/List[ListID='102000']/Itm">
<OPTION><xsl:attribute name="value"><xsl:value-of select="ItmID"/>
</xsl:attribute><xsl:value-of select="substring-after(ItmDesc,'-')"/>
</OPTION>
</xsl:template>
Thanks!
Edith
>What I think you want to do is simply move the xsl:sort element from
>the xsl:apply-templates in the first template and put it as the first
>child of the xsl:for-each element in the template above. You'll then
>have:
> <xsl:for-each select="Itm">
> <xsl:sort select="substring-after(ItmDesc, '-')"
> order="ascending" />
> ...
> </xsl:for-each>
>That will iterate through the Itm elements, sorted according to the
>string after the '-' in the ItmDesc children of the Itm elements.
>Which should work fine.
>I hope that helps,
>Jeni
>---
>Jeni Tennison
>http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|