This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: sort and if
- From: "Joerg Heinicke" <joerg dot heinicke at gmx dot de>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 6 Feb 2002 00:40:52 +0100
- Subject: Re: [xsl] sort and if
- References: <F122EwPXoudlF7QRgF700018fee@hotmail.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Just use a grouping technique like Muenchian Method, which was discussed on
this list today in about 20 messages.
The problem with your method is the following:
<xsl:for-each select="item">
<xsl:sort select="date"/>
<xsl:if test="preceding-sibling::item[1][date= current()/date]">
<xsl:value-of select="date"/>
</xsl:if>
</xsl:for-each>
The test on preceding <item> elements sounds very good, but it's using the
document order and not the sorted order.
Regards,
Joerg
----- Original Message -----
From: "Ilyasov Jienbay" <jienbay@hotmail.com>
To: <xsl-list@lists.mulberrytech.com>
Sent: Tuesday, February 05, 2002 1:00 PM
Subject: [xsl] sort and if
> hello,
>
> please help with this...
> it drives me crazy!
>
> <items>
> <item>
> <date>011022<date>
> </item>
> <item>
> <date>011021<date>
> </item>
> <item>
> <date>011021<date>
> </item>
> </items>
>
> i want to *sort* and then put "same as above" or *nothing* if the
previouse
> $date is equal to the current $cur_date, something like:
>
> date
> -----
> 011021
> same as above(or nothing)
> 011022
>
> thank you in advance
>
> jian
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list