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

Re: Alphabetical Index Problem

Subject: Re: Alphabetical Index Problem
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 03 Oct 2000 18:02:32 +0100
xsl alphabetical index
Lee,

Not sure if you're still working on this, but I haven't spotted a reply
from the last two weeks, so:

>I have a long list of data arranged alphabetically,
>and would like to reveal parts of it as a user
>types in a string, rather like an MSHelp index.

I'm assuming you're using client-side processing?

Given a filter string it's easy to only apply templates to those items in
the list that have a content beginning with that filter string:

<xsl:template match="list">
  <xsl:apply-templates select="item[starts-with(., $filter)]" />
</xsl:template>

<xsl:template match="item">
  <a href="{@href}"><xsl:value-of select="." /></a><br />
</xsl:template>

You could use a frameset, with a form containing a text box for the filter
string in the top and the resulting list underneath.  Whenever a change is
made to the filter string within the form (i.e. an onchange event), you
could reprocess the data with the stylesheet, using the content of the text
box as the value of the filter parameter.

At a generic level, you could pass the filter parameter into the stylesheet
using addParameter and display the entire content of the result as a new
page within the file.  However, it would probably be more efficient if you
have a script that loads the XML data and the stylesheet when the page is
first loaded, and have the script attached to the onchange attribute of the
text box change the parameter through manipulating the stylesheet DOM, then
display the content using transformNode.  This would prevent the stylesheet
and the data being parsed and processed every time the user typed a character.

Hope that gives you some ideas,

Jeni

Jeni Tennison
http://www.jenitennison.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.