Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 20th, 2006, 10:47 AM
Registered User
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple xsl styles applied to central xml doc


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!


Old March 20th, 2006, 11:52 AM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

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
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

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

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