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

Subject: RE: How to build a drill-down list from XML using XSL?
From: "Selva, Francis" <Francis.Selva@xxxxxxxxxxxxxxx>
Date: Wed, 19 Apr 2000 17:03:06 -0700
Try this

<xsl:template match="/">
	<HTML>
	<BODY>
	<xsl:for-each select="Table/Partner//Type[not(. = following::Type)]
| Table/Partner//Division[not(. = following::Division)] |
Table/Partner//ChannelRep[not(. = following::ChannelRep)]">  
 		<UL><xsl:value-of select="Type"/>
			<UL><xsl:value-of select="Division"/> 
		    	<UL><xsl:value-of select="."/>
		    	<xsl:for-each
select="//Partner[ChannelRep=current()]">
			        <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>
			 	</xsl:for-each>
				</UL>  
		 	</UL>
		</UL> 
	</xsl:for-each> 
		
	</BODY>
	</HTML>
</xsl:template>

 
Francis








> 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
> 
 
> Joseph Tam


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread