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 February 20th, 2008, 11:42 AM
Authorized User
 
Join Date: Oct 2007
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default extending xslt

I have made an xslt stylesheet wich works great.

In this stylesheet there are includes to other stylesheets.
What i want is to 'extend' xslt to be able to give the user choises for different 'themes' in a website.
The stylesheet i made now is really basic, it has no css, no javascript, etc.

I was wondering what the best way is to extend this stylesheet to add for example some css or javascript without having to copy the entire xslt directory to another directory and make the changes there. When i do that i have to edit my basic theme, then copy my changes to my other 'theme' wich is kinda stupid i think.

My problem is i can let my php check if a file exists (for example my Advanced file) and if it doesn't exist, fall back on the Basic file, but then all the includes in my xslt files should also do this and i don't know if this is possible and if it is a smart choice.

If anyone has some idea or has already done this please explain to me how to do it, my xslt sheet isn't too big so i can make drastic changes if needed.

I hope i explained my problem good enough for you guys to understand :)

 
Old February 20th, 2008, 11:47 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Use xsl:import. You can define a number of specializations of your stylesheet, each of which overrides some or all of its templates and other declarations. Each should import the common generic code that you have already written. You then start the processing by invoking the "special-purpose" stylesheet, which in turn invokes the general-purpose stylesheet.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 22nd, 2008, 05:38 AM
Authorized User
 
Join Date: Oct 2007
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much for the info michael, i think i understand the concept, looking forward to try it out, will do so this weekend!

 
Old February 28th, 2008, 05:52 PM
Authorized User
 
Join Date: Oct 2007
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wow, this works like a charm. I can extend my themes fully now. I can develop in the 'Basic' theme and then add some styles in my 'Styled' theme. Thanks for the info michael, i finnaly get this import tag, it's awsome!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Extending the CMS retroviz BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 April 23rd, 2008 07:00 AM
Extending the Replace Function designdawg Access 9 February 19th, 2008 12:39 PM
Extending DataGridItem Phrozen ASP.NET 2.0 Professional 0 March 11th, 2007 09:17 AM
Help: problem extending DataGrid tinlong ASP.NET 1.0 and 1.1 Professional 1 December 5th, 2005 11:48 PM
classes extending and inheriting jlong Beginning PHP 2 July 7th, 2003 02:32 PM





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