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

How to build a drill-down list from XML using XSL?

Subject: How to build a drill-down list from XML using XSL?
From: Joseph Tak Kin Tam <JTam@xxxxxxxxxxxx>
Date: Fri, 14 Apr 2000 15:16:21 -0400
drill down list
Here's a snippet of my XML data file:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="channel.xsl"?>
<Table>
	<Partner>
		<Type>HVAC</Type>
		<Division>Chatham</Division>
		<ChannelRep>John</ChannelRep>
		<Name>ABC Heating</Name>
	</Partner>
	<Partner>
		<Type>HVAC</Type>
		<Division>Chatham</Division>
		<ChannelRep>John</ChannelRep>
		<Name>DEF Heating</Name>
	</Partner>
	<Partner>
		<Type>Retail</Type>
		<Division>London</Division>
		<ChannelRep>Joe</ChannelRep>
		<Name>XYZ Hardware</Name>
	</Partner>
</Table>

I want to display this like:

HVAC
 |
 --Chatham
    |
    -- John
        |
        --ABC Heating
          DEF Heating
Retail
 |
 --London
    |
    -- Joe
        |
        --XYZ Hardware

so I want to use nested HTML <UL> tags, but I don't know how to only show
HVAC and Retail only once, etc.  right now I got this as my XSL:

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
	<xsl:template match="/">
	<HTML>
	<BODY>
	<xsl:for-each select="Table/Partner"
order-by="Type;Division;ChannelRep">
		<UL><xsl:value-of select="Type"/>
			<UL><xsl:value-of select="Division"/>
				<UL><A>
				<xsl:attribute name="href">
	
http://W1116207/channel/echo.asp?value=<xsl:value-of select="Name"/>
				</xsl:attribute>
				<xsl:attribute
name="target">view</xsl:attribute>
				<xsl:value-of select="Name"/>
				</A></UL>
			</UL>
		</UL>
	</xsl:for-each>
	</BODY>
	</HTML>
	</xsl:template>
</xsl:stylesheet>

which will show:

HVAC 
	Chatham 
		ABC Heating 
HVAC 
	Chatham 
		DEF Heating 
Retail 
	London 
		XYZ Store 


Please help if you can, thanks!


Joseph Tam
Application Development Specialist
Union Gas Ltd.
Tel: 519-436-4600 ext 2735
Fax: 519-436-5263
Email: jtam@xxxxxxxxxxxx


 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.