|
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 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: '%' in output attributes?, David Carlisle | Thread | RE: How to build a drill-down list , Selva, Francis |
| RE: XSL-List admin query, Selva, Francis | Date | RE: Attribute test problem solved, Medina, Edward |
| Month |