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

Re: Re: Dynamic Filter Menus

Subject: Re: Re: Dynamic Filter Menus
From: brian.witgen@xxxxxxxxxxx
Date: Fri, 26 Oct 2001 16:56:34 -0500
javascript dynamic filter

Solution one looks like the best way to go , but unfortunately Im not up to
speed on DOM. Im assuming your solution is something like using
"xsl:script" with javascript outside the templates and before I create the
indexes and then use the function in the index creation. According to
w3.org, I should be able to use "xsl:script", but the tag isnt recognised.
I must be way off. Can you pass me a little more info about the
javascript/DOM solution. Im continuing to look for info/examples but not
finding too much.

Thanks for your help.

Dimitre Novatchev <dnovatchev@xxxxxxxxx>@lists.mulberrytech.com on
10/26/2001 11:59:09 AM

Please respond to xsl-list@xxxxxxxxxxxxxxxxxxxxxx

Sent by:  owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx

To:   xsl-list@xxxxxxxxxxxxxxxxxxxxxx

Subject:   Re: Dynamic Filter Menus

> ....and with those entries, I have created 3 keys based on the vendor,
> and version:
> <xsl:key name="venkey" match="entry" use="@vendor" />
> <xsl:key name="catkey" match="entry" use="@category" />
> <xsl:key name="verkey" match="entry" use="@version" />
> The menus are a unique list of the vendors, categories, or versions to
> select. I dont have any probelm with getting the initial unique list when
> no filters have been selected yet. I am trying to make the menus work in
> such a way that when one filter is selected, the other two menus that do
> not have a filter selected will show a unique list of only those values
> that match the selected filter.
> Example:  With the entries above, if I choose version 2.9 as a filter,
> only "newmanufacturer" will show up in the vendor menu (once being
> and "gorycat2" and "gorycat3" will both show up in the category menu.
> I have an xml file that is updated with the selected filter for each menu
> through javascript and pulled into the template as parameters:
>                <xsl:call-template name="filtermenus">
>                     <xsl:with-param name="pven" select
="/docs/vendorfilter" />
>                     <xsl:with-param name="pcat" select
="/docs/categoryfilter" />
>                     <xsl:with-param name="pver" select
="/docs/versionfilter" />
>                </xsl:call-template>

One solution is (because you're passing parameters from javascript) just to
the definitions of the "xsl:key" -s using DOM before performing the

 <xsl:key name="venkey" match="entry[fExp1 and fExp2 and fExp3]" use="
@vendor" />
 <xsl:key name="catkey" match="entry[fExp1 and fExp2 and fExp3]" use="
@category" />
 <xsl:key name="verkey" match="entry[fExp1 and fExp2 and fExp3]" use="
@version" />

Another solution is to construct an RTF (and convert it to a node-set)
only the "entry" elements that satisfy the filters. Then use the key()
function on
this document tree. Assuming that the "entry" elements are children of the

<xsl:variable name="vFiltered">
  <xsl:copy-of select="entry[fExp1 and fExp2 and fExp3]"/>

<xsl:variable name="vFilteredEntries" select="xx:node-set($vFiltered)"/>

<xsl:for-each select="$vFilteredEntries">
   <xsl:variable name="uven" select="entry[generate-id()
                                       = generate-id(key('venkey',
   <xsl:variable name="ucat" select="entry[generate-id()
                                       = generate-id(key('catkey',
   <xsl:variable name="uver" select="entry[generate-id()
                                       = generate-id(key('verkey',

<!--  Do whatever is necessary with the above 3 variables here -->

Here the "xx" prefix must be associated with the namespace in which the
vendor-supplied extension function node-set() is defined/implemented.

Hope this helped.

Dimitre Novatchev.

Do You Yahoo!?
Make a great connection at Yahoo! Personals.

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

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

Current Thread


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.
First Name
Last Name
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.