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

Managing Groups of Elements?

Subject: Managing Groups of Elements?
From: Nigel Byrnes <byrnes@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 02 Jul 1999 10:31:44 +0100
xsl stylesheet for yahoo news
Hi all XSL-ers

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

For an example of what the XML document might look, check out Listing
One at the foot of the mail.

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.

My current progress on this problem is shown in Listing Two. I have
managed to create a template which creates a HTML page but without any
management of the newsItem elements.

Any help on this problem will be appreciated. Thanks in advance,

Nigel

============== Listing One: ======================
<?XML version="1.0" encoding="UTF-8"?>
<news>
 <title>Todays Top Stories</title>
 <newsItem>
  <headline>House Prices Still On The Rise</headline>
  <newsItem>The latest property market survey released by the Halifax
found the increase in house prices continued through June, with the
average up 1.8% to £76,877.</newsItem>

<link>http://www.yahoo.co.uk/headlines/19990702/news/930904700-4-1.html</link>

 </newsItem>

 <newsItem>
   ...
 </newsItem>
</news>

============= Listing Two: =========================

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">

<xsl:template match="NEWS">
 <html>
 <head>
  <title>Nigel's Yahoo News Content Negotiation Demonstration</title>
 </head>
 <body>
  <h1><xsl:value-of select=".//TITLE"/></h1>
   <xsl:for-each select=".//NEWSITEM">
  <h2><xsl:value-of select=".//HEADLINE"/></h2>
   <p>
   <xsl:value-of select=".//STRAPLINE"/>
   <br/>
   <xsl:element name="a">
   <xsl:attribute name="href">
    <xsl:value-of select=".//LINK"/></xsl:attribute>
More...</xsl:element>
   </p>
  </xsl:for-each>
 </body>
 </html>
</xsl:template>

</xsl:stylesheet>


begin:          vcard
fn:             Nigel Byrnes
n:              Byrnes;Nigel
org:            Philips Research
email;internet: byrnes@xxxxxxxxxxxxxxxxxxxxxxxx
title:          Research Scientist
note:           <BR>Software Engineering and Appications Group<BR>Philips Research Labs<BR> Cross Oak Lane<BR>Redhill<BR>Surrey<BR>RH1 5LA<BR>UK<P>Phone: +44 (0) 1293 815 578<BR>Fax: +44 (0) 1293 815 500<BR>GSM: 07899 940 391
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard

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.