|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I'm trying to find the best solution for what I'm trying to accomplish. I have an XML file that is a catalog of products (divided up by categories). I'd like a way (using client side javascript) to dynamically change what is displayed to the user based on their selections (i.e. The user is presented with a menu of product catagories, the user clicks "catagory A" and is then presented with a listing of products in "catagory A")... all using the same XML file, just filtered differently using XSL. My XML file is set up similar to this: <products> <catagory id="cat1"> <item></item> <item></item> </category> </products> (this is over-simplified on purpose) And I can manually specify what I want displayed in my XSL file like this: ... <xsl:template match="/products/catagory[@id='cat1']"> <table border="1"> <xsl:for-each select="item"> ... (and so on) I'm wanting a way to dynamically change that filter (" catagory[@id='cat1'] ") based off of, say, a user clicking a link which creates a querystring that can be read and applied to the XSL file. I've done things like this (without XML) with ASP, using querystrings to modify what is displayed on a page, but I'm in new territory with XML and Javascript (and I could be barking up the wrong tree ).The most important part is that it needs to be client side. I've poured over these forums and 2 different XML books, and I'm just having trouble figuring this out. Any help anyone could give would be greatly appreciated!! Thank you for your time! ~Noah~ |
|
#2
|
|||
|
|||
|
Has no one heard of doing something like this? Or is it just very complicated? Maybe it can be done by using XSLT variables, but I still need to know how to dynamically change them. My only other option is to create an individual XSL file to transform every possible option that the user would click on (which seems silly, redundant and defeats the purpose).
Perhaps it could be done by using Javascript and the DOM? Reading in the entire XML file, parsing out just the part I want, and then transforming the resultant XML with the XSL file? It makes sense to me... but I'm not sure how to do the first part (extracting just the XML section I want). Can anyone suggest a good reference for doing something like that? I'm doing a ton of reading, I just need a little push in the right direction, at least. Again, thanks for your time all. ![]() ~Noah~ |
|
#3
|
|||
|
|||
|
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSL & Javascript for Dynamic XSL filtering |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|