[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

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

Attachment: pgp00001.pgp
Description: PGP signature

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.