This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: re - newbie question - <xsl: when test
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: re[xsl] - newbie question - <xsl: when test
- From: Goetz Bock <bock at blacknet dot de>
- Date: Thu, 25 Jan 2001 17:49:10 +0100
- References: <FBCE39CE4112D411AB3C00D0B7445969CF43EF@mailpost.syzygy.net>
- Reply-To: xsl-list at lists dot mulberrytech dot com
On Thu, Jan 25 '01 at 16:26, Sam Griffiths wrote:
> [ ... ]
> I want to differentiate between the first five <faq>s and the rest so I can
> add appropriate formatting to distinguish between two groups of questions on
> a web page (recent and previous).
>
> The xsl below only selects the *most* recent question - which is equivalent
> to <lastid>.
You're already nearly there
> *XSL*
>
> <xsl:param name="lastid" select="/faqs/lastid"/>
> <xsl:param name="id"/>
>
> ....
>
> <xsl:for-each select="/faqs/faq">
> <xsl:sort select="id" order="descending"/>
> <xsl:choose>
> <xsl:when test="id=$lastid">
<xsl:when test="id > ($lastid - 5)">
> <xsl:element name="A">
> <xsl:attribute name="href">#q<xsl:value-of
> select="id"/></xsl:attribute>
> <font color="red"><xsl:value-of select="question"/></font>
> </xsl:element><br/>
> </xsl:when>
> </xsl:choose>
> </xsl:for-each>
>
You might have to add number() to cenvert it to numbers and it mught
only work with $lastid >= 5. But you'd have to try this.
Cu,
Goetz.
PGP signature