[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Conditional xslt inclusions

Subject: Re: Conditional xslt inclusions
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 27 Oct 2010 08:34:02 +0100
Re:  Conditional xslt inclusions
xsl:include is a compile-time facility, it is done long before your stylesheet gets anywhere near a source document, so you can't make it conditional on the document content.

What you appear to need is a processing pipeline (implemented say using XProc, but there are many other possible vehicles) that looks at the document and decides which of 6 stylesheets to apply based on its content.

You could put all the logic into one stylesheet (e.g. using multiple modes) and then despatch at run-time based on the document content, but I think that would make your application less maintainable.

Michael Kay
Saxonica

On 27/10/2010 08:17, Siddhi Thakkar wrote:
Dear Experts,

I have 6 types of documents and their corresponding 6 xslts. What I want to do is create one main xslt and based on one of the attribute values of input, I want to give an xslt name that is to be included. For example, if the root element of input is<root a="1"> then I want to include 'one.xsl'. Similarly, if the root element is<root a="2"> then 'two.xsl'. I am using version 1.0 and Saxon/JDOM as xslt processor.

Please give your inputs on this problem.

Thanks very much,
Siddhi

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.