Re: re[xsl] - newbie question - <xsl: when test

Subject: Re: re[xsl] - newbie question - <xsl: when test
From: Goetz Bock <bock@xxxxxxxxxxx>
Date: Thu, 25 Jan 2001 17:49:10 +0100
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 &gt; ($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.

Attachment: pgp00001.pgp
Description: PGP signature

Current Thread