I hope I explain this properly.
What I currently have is a xml file (which looks something like this). We'll call it "index.xml":
I have the ability to display certain pieces of the XML file using XSL. I have one XSL file for each page in the XML file (Home, Contact, Legal, etc.). What I would like to accomplish is setting up my navigation to not change XML files but to change the XSL file it references to.Code:<?xml version="1.0" encoding="UTF-8"?> <site> <home> <page> <pagetitle>Home</pagetitle> <pagedata> <information>lorem ipsum...</information> <description>lorem ipsum...</description> </pagedata> </page> <home> [...] <contact> <page> <pagetitle>Contact</pagetitle> <pagedata> <information>lorem ipsum...</information> <description>lorem ipsum...</description> </pagedata> </page> <contact> <legal> <page> <pagetitle>Legal</pagetitle> <pagedata> <information>lorem ipsum...</information> <description>lorem ipsum...</description> </pagedata> </page> <legal> </site>
So I guess it'd be something along the lines of a link that triggers an event. The event is the change of the XSL stylesheet that the XML file references to. By doing so, you should now be able to display the data you want, without changing XML files.
What would be the best way to accomplish this?
I was thinking somewhere along the lines of making a master XSL file that includes all of page XSL files and using a javascript function to switch the XSL stylesheet (Similar to how you would change a CSS stylesheet).
Any ideas?
EDIT: For clarity and mistakes
I'm not into XML - XLS at all, but what if you just use different tags in the different pages? can't you load them all then?
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
Blah... I made a mistake in the way I structured the XML file in my example.. just let me edit that first.
I'm not trying to load them all though. I'm trying to load them separately. For instance, right now my "Home" XSL page would look something like this:
This will only select the info under the home/page's child nodes. Each XSL sheet shows different info from the same same XML file. I just want a way to give the user the ability to switch XSL stylesheets associated with the XML file.Code:[...] <xsl:for-each select="site/home/page"> <h1><xsl:value-of select="pagetitle" /></h1> </xsl:for-each> [...]
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks