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

creating a directory-like index

Subject: creating a directory-like index
From: Alexander Czernay <listen@xxxxxxxxxxx>
Date: Thu, 07 Aug 2003 15:00:19 +0200
index letters xsl
I wnat to create a directory like index from a list of names. I want to have section heading for each existing first-letter, followed by all names starting with that first letter, omitting non-existant letters.

Like this:

A
Alexander
Andrea

M
Martin
Max
Moritz
.
.
.

I made it this far:

<xsl:template match="/">
		<xsl:for-each select="artist[substring(name,1,1)]">
		<xsl:sort select="name"/>
		<div class="group">
			<h1><xsl:value-of select="substring(name,1,1)"/></h1>
			<xsl:call-template name="artistlist">
				<xsl:with-param name="letter" select="substring(name,1,1)"/>
			</xsl:call-template>		
		</div>
</xsl:template>

	<xsl:template name="artistlist">
		<xsl:param name="letter"/>
		<xsl:for-each select="artist[starts-with(name,$letter)]">
		<xsl:sort select="name"/>
			<div class="artist"><xsl:value-of select="name"/></div>
		</xsl:for-each>
	</xsl:template>

But this is creating an extra list for all names for every letter, that would be three times the list for M in my above example.

Any ideas on altering the code?

Thanks for your help,
Alexander


-- _________________________________ Alexander Czernay IT-Consulting & Media Development

fon +49-40-41096742
fax +49-40-41096743
icq 4773650

alexander@xxxxxxxxxxx
www.czernay.com
_________________________________



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.