This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: <xsl:sort> using a derived element
- To: "RUSSO, EDITH" <EDIRUS at SAFECO dot com>
- Subject: Re: [xsl] <xsl:sort> using a derived element
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Tue, 6 Mar 2001 17:00:30 +0000
- CC: "'XSL-List at lists dot mulberrytech dot com'" <XSL-List at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <D1CF927198C7D11198A50001FAD456540C6F50EE@hoxsv027.safeco.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Edith,
> I'd like to sort using ItmDesc, but only a substring of it. Here's my sort:
>
> <xsl:sort select="substring-after(ItmDesc,'-')" order="ascending"/>
>
> Here's an example of the data, I want to sort Spokane, not 214-Spokane:
>
> <ItmDesc>214-Spokane</ItmDesc>
>
> The sort statement above does not do it. How do I do it?
What you have should work as long as the ItmDesc elements are children of
the elements that you're sorting. You should have something like:
<xsl:for-each select="Itm">
<xsl:sort select="substring-after(ItmDesc, '-')"
order="ascending" />
...
</xsl:for-each>
with the source being something like:
<Itm>
<ItmDesc>214-Spokane</ItmDesc>
</Itm>
<Itm>
<ItmDesc>534-Hullabaloo</ItmDesc>
</Itm>
I guess another possibility would be that you might be using the old
MSXML namespace rather than the XSLT namespace?
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list