Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 20th, 2006, 10:47 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple xsl styles applied to central xml doc

Hi.

I'm new to XML and I'm having a problem filtering the data from a central XML file. I have a website that catalogues history-related web resources and categorises them by period, and I've created an xml file to hold this data. My website's navigation is based on the period categories of the web resources I've catalogued (Roman, Medieval, etc). I need a way to filter the data from the central xml file based on the link the user follows - so if they click on the 'Roman' menu option, only the records that have 'Roman' as their <period> element are returned in the resulting page.

At present, the central xml file links to an xsl file for formatting, but I can only filter one thing at a time via this. Is there a way of linking several xsl files - each filtering a different period category depending on the user's navigation choice - that can be applied to the central xml file independantly? Sort of like:

Menu Option 1 - catalogue.xml + roman.xsl
Menu Option 2 - catalogue.xml + medieval.xsl

I'm trying to be as cross-browser friendly as possible. I can only think of the following solutions (but don't really know how to go about any of them!!)

1. Pass a variable via the menu option url that can be used to specify the xsl styles to be used.

2. Somehow link the central xml document's content to xml sub-documents - each of which link to a different xsl stylesheet.

Apologies if this topic has been discussed before - I've had a good search but can't really find anything that helps me! Any help much appreciated!

Thanks,

Pat
Reply With Quote
  #2 (permalink)  
Old March 20th, 2006, 11:52 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You don't want to select the stylesheet to be applied in a link from the source document, you want to select it from script on your HTML page. For a cross-browser API for invoking XSLT transformations, see Sarissa on Sourceforge.

Rather than using different XSLT stylesheets, you probably want to invoke the same XSLT stylesheet with a parameter.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating XML doc ; writing string(xml format) into KamalRaturi XML 5 May 28th, 2008 05:51 AM
Using XSL to generate single pdf doc bhavanimachani XML 2 March 24th, 2008 11:57 PM
How to control Styles in Multiple Xsl srkumar XSLT 9 January 9th, 2008 04:25 PM
multiple documentElement (html) objects in one doc hussainm HTML Code Clinic 2 July 14th, 2006 02:40 PM
Grouping multiple paragraph styles under 1 parent ROCXY XML 0 January 4th, 2006 09:42 AM



All times are GMT -4. The time now is 07:36 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.