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

Re: Displaying one node at a time

Subject: Re: Displaying one node at a time
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Mon, 04 Jul 2005 20:42:15 +0200
javascript getelementsbytagname
Hi,

Tempore 20:02:06, die 07/04/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Fadi Qutaishat <fadi_taher2000@xxxxxxxxx>:

How can I display one chunk at a time, for example,
using a next link.

But word 'link' in this context seems to imply html.


Just a wild guess, but I think your looking for a stylesheet that generates DHTML to dynamically browse your page's chunks:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/>


<xsl:template match="/">
	<html>
		<head>title
		<script type="text/javascript">
		function show(id) {
		var block=document.getElementsByTagName('div');
		for (i=0;i &lt; block.length;i++) {
			block[i].style.display='none';
		}
		document.getElementById(id).style.display='block';
		}
		</script>
		</head>
		<body onload="show('{//chunk/@id[1]}')">
			<xsl:apply-templates/>
		</body>
	</html>
</xsl:template>

<xsl:template match="page">
<h1>My page</h1>
<ul>
<xsl:for-each select="chunk">
<li><a href="javascript: show('{@id}')">chunk <xsl:value-of select="@id"/></a></li>
</xsl:for-each>
</ul>
<xsl:apply-templates/>
</xsl:template>


<xsl:template match="chunk">
<div id="{@id}" style="display: none">
<h2>chunk <xsl:value-of select="@id"/></h2>
<p><xsl:apply-templates/></p>
<xsl:if test="position()!=1">
<a href="javascript: show('{preceding-sibling::chunk[1]/@id}')">&lt;&lt;previous chunk |</a>
</xsl:if>
<xsl:if test="position()!=last()">
<a href="javascript: show('{following-sibling::chunk[1]/@id}')">| next chunk&gt;&gt;</a>
</xsl:if>
</div>
</xsl:template>


</xsl:stylesheet>

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Spread the wiki (http://www.wikipedia.org)

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.