XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 3rd, 2004, 11:22 AM
noahwesley noahwesley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 5 noahwesley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question XSL & Javascript for Dynamic XSL filtering

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~

Reply With Quote
  #2  
Old June 4th, 2004, 10:40 AM
noahwesley noahwesley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 5 noahwesley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy

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~

Reply With Quote
  #3  
Old June 17th, 2004, 08:22 AM
kid23 kid23 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 62 kid23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
See my answer to this post, this is the same problem.

http://forums.devshed.com/t154587/s.html

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSL & Javascript for Dynamic XSL filtering


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT