Subject: Re: [xsl] Re: Dynamic Filter Menus From: brian.witgen@xxxxxxxxxxx Date: Fri, 26 Oct 2001 16:56:34 -0500 |
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 cc: Subject: [xsl] Re: Dynamic Filter Menus > ....and with those entries, I have created 3 keys based on the vendor, category, > 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, then > only "newmanufacturer" will show up in the vendor menu (once being unique) > 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 update the definitions of the "xsl:key" -s using DOM before performing the transformation: <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) containing 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 current node: <xsl:variable name="vFiltered"> <xsl:copy-of select="entry[fExp1 and fExp2 and fExp3]"/> <xsl:variable> <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', @vendor)[1])]"/> <xsl:variable name="ucat" select="entry[generate-id() = generate-id(key('catkey', @category)[1])]"/> <xsl:variable name="uver" select="entry[generate-id() = generate-id(key('verkey', @version)[1])]"/> <!-- Do whatever is necessary with the above 3 variables here --> </xsl:for-each> 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. Cheers, Dimitre Novatchev. __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Dynamic Filter Menus, Dimitre Novatchev | Thread | Re: [xsl] Re: Dynamic Filter Menus, brian . witgen |
[xsl] Please check !!, kalpana rawat | Date | RE: [xsl] Please check !!, Chris Bayes |
Month |