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

Re: Managing Groups of Elements?

Subject: Re: Managing Groups of Elements?
From: Edd Dumbill <edd@xxxxxxxxxxxxx>
Date: Sat, 3 Jul 1999 10:46:05 +0000
edd screen element
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() &lt; 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() &gt; 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


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.