This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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



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.

PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]