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

Subject: re[xsl] - newbie question - <xsl: when test
From: Sam Griffiths <S.Griffiths@xxxxxxxxxx>
Date: Thu, 25 Jan 2001 16:26:45 -0000
Hello there, apologies in advance if this question has an obvious answer! I
don't usually rush to use this  list. 

I am working on a simple FAQ programme that uses xsl and xml to allow a user
to add (and edit) questions to the list (by updating the original source xml

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>. 

I'm looking for a way to express: $lastid = a range of id values [the higest
five values of this element.

Each time a user submits a question - it is given a 'new' id (previous
lastid+1) and the <lastid> element is updated correspondingly. 

I've been trying to use the position() command to achieve this - but to no

The code is:


	<question>this is a question</question>
	<answer>this is an answer</answer>
	<question>another question</question>
	<answer>another answer</answer>


<xsl:param name="lastid" select="/faqs/lastid"/>
<xsl:param name="id"/>


<xsl:for-each select="/faqs/faq">
<xsl:sort select="id" order="descending"/>
<xsl:when test="id=$lastid">
	<xsl:element name="A">
		<xsl:attribute name="href">#q<xsl:value-of
		<font color="red"><xsl:value-of select="question"/></font>


Any help would be much appreciated.


Sam Griffiths

Interface Developer
Syzygy Ltd.

 XSL-List info and archive:

Current Thread