|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Managing Groups of Elements?
On Fri, Jul 02, 1999 at 10:31:44AM +0100, Nigel Byrnes wrote: > Considering the following DTD: > > <!ELEMENT news (title, newsItem*)> > <!ELEMENT title (#PCDATA)> > > <!ELEMENT newsItem (headline, strapline, link)> > <!ELEMENT headline (#PCDATA)> > <!ELEMENT strapline (#PCDATA)> > <!ELEMENT link (#PCDATA)> > The problem is that the number of newsItems may be too large to fit on > one screen. Indeed I have a requirement to fit no more than four > newsItems on one page. In cases where there are more than four, a link > should be present at the bottom of the page to navigate to the next > page. I suggest using something like these fragments to match your newsItems. The first case is the normal case, the second case deals with adding the link in when there's more than 4 elements, and the third case simply ensures that the surplus elements aren't displayed. <xsl:template match="news/newsItem[position() < 5]"> <xsl:apply-templates/> </xsl:template> <xsl:template match="news/newsItem[position()=5]"> <a href="more.html">Click here for more</a> </xsl:template> <xsl:template match="news/newsItem[position() > 5]"> </xsl:template> You can make a similar stylesheet for the second page following this pattern. The mental jump I find one needs to make is away from trying to count out your elements and concentrate on matching them instead. I've tested this with XT, by the way. regards -- Edd Dumbill | Director, Useful Information Co. & Pharmalicensing Ltd tel: +44 (0) 702-093-6870 | edd@xxxxxxxxxxxxx | http://usefulinc.com fax: +44 (0) 870-164-0230 | pgp: http://usefulinc.com/edd/pubkey.asc XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








