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

Generating a Table of Contents linked to grouped nodes

Subject: Generating a Table of Contents linked to grouped nodesets???
From: ghostrider <ghostrider@xxxxxxxxxxx>
Date: Thu, 12 Jul 2001 14:12:52 +0200
xsl link table
Hi all,

I'm having troubling generating a linked Table of Contents with XSL...

My XSL file groups and outputs a number of nodes to HTML, like this:

Input
--DPF: Description1
--IPC: Description2
--...

Output
--DPF: Description3
--123: Description4
--abc
...

Tooling
--DPF: Description5
--123: Description6
---...

...

I would like to have a small table of contents dynamically generated, and 
output in the same HTML file, just before the individual nodes and elements 
are processed and grouped as above.

My TOC should simply be something like this:

Contents
--------

Input <link to the DIV containing all input nodesets as above)
Output
Tooling
....

I have to create some sort of unique bookmark in the HTML code for each TOC 
entry to link to. Any suggestions on how to do this?

[I'll include the XML and XSL files below]

Thanks,

Armin


** XML file ***

<?xml-stylesheet type="text/xsl" 
href="C:\HIGroup\XML\bugs\transform_09-07-01c.xsl"?>
<root>
	<Bugs>
		<Bug>
			<Category1>Input</Category1>
			<Category2>DPF</Category2>
			<Type>Bug fix</Type>
			<Description>Reading in ODB++ somehow ...</Description>
			<BugBase>001</BugBase>
		</Bug>
		<Bug>
			<Category1>Input</Category1>
			<Category2>IPC</Category2>
			<Type>Enhancement</Type>
			<Description>Reading in ODB++ somehow ...</Description>
			<BugBase>002</BugBase>
		</Bug>
		<Bug>
			<Category1>Output</Category1>
			<Category2>IPC</Category2>
			<Type>Enhancement</Type>
			<Description>Reading in ODB++ somehow ...</Description>
			<BugBase>003</BugBase>
		</Bug>
	</Bugs>
	<Calls>
		<Call BugBase="001"> B10015 </Call>
		<Call BugBase="001"> B10016 </Call>
		<Call BugBase="002"> B10017 </Call>
		<Call BugBase="003"> B10018 </Call>
		<Call BugBase="003"> B10019 </Call>
	</Calls>
</root>

** XSL **

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:key name="categories" match="Bug" use="Category1"/>
	<xsl:key name="calls" match="Call" use="@BugBase"/>

	<xsl:template match="root">
		<html>
			<body>
				<p>Release Notes</a>
				</p>

				<xsl:apply-templates />
			</body>
		</html>
	</xsl:template>

<xsl:template match="root/Bugs">
<xsl:apply-templates select="Bug[generate-id(.) = generate-id(key 
('categories', Category1) [1] ) ]" />
</xsl:template>

<xsl:template match="Bugs/Bug">
		<div><b><xsl:value-of select="Category1" /></b><div>
		<xsl:for-each select="key('categories', Category1)">
		<span><b><xsl:value-of select="Category2"/> (<xsl:value-of 
select="Type"/>)</b></p>
		</span>
		<div>
		<p><xsl:for-each select="key('calls', BugBase)">
					<xsl:value-of select="."/>
					<xsl:if test="position() != last()">, </xsl:if>
				</xsl:for-each></p>
                      <div>
				<p><xsl:value-of select="Description"/>
				</p>
			</div>
		</div>
</xsl:for-each>

	</div>	</div>
	</xsl:template>
</xsl:stylesheet>



 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.