This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
How to build a drill-down list from XML using XSL?
- To: "'XSL-List at mulberrytech dot com'" <XSL-List at mulberrytech dot com>
- Subject: How to build a drill-down list from XML using XSL?
- From: Joseph Tak Kin Tam <JTam at uniongas dot com>
- Date: Fri, 14 Apr 2000 15:16:21 -0400
- Reply-To: xsl-list at mulberrytech dot com
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@uniongas.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list