[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Alphabetical Index Problem
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|