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 file). 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 effect. The code is: *XML* <faqs> <lastid>2</lastid> <faq> <id>1</id> <question>this is a question</question> <answer>this is an answer</answer> </faq> <faq> <id>2</id> <question>another question</question> <answer>another answer</answer> </faq> ... </faqs> *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: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> .... Any help would be much appreciated. Thanks Sam Griffiths Interface Developer Syzygy Ltd. s.griffiths@xxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] xsl reorder, Julian F. Reschke | Thread | Re: re[xsl] - newbie question - <xs, David Carlisle |
Re: [xsl] xsl reorder, Goetz Bock | Date | RE: [xsl] xsl reorder, Julian F. Reschke |
Month |