[xsl] Conditional use of <xsl:apply-imports> or <xsl:import> XSLT 2.0

Subject: [xsl] Conditional use of <xsl:apply-imports> or <xsl:import> XSLT 2.0
From: "Pankaj Chaturvedi" <pankaj.chaturvedi@xxxxxxxxx>
Date: Fri, 11 Jul 2008 19:25:57 +0530

I have a stylesheet, which imports 8-9 other stylesheet into it. I am using
<xsl:import> (with <>xsl:apply-imports>) element instead of <xsl:include>,
as I need to override matching rules of main (calling) stylesheet.

As I am importing the various stylesheet(basically different reference style
with same matching elements), I am trying to figure out whether a
conditional <xsl:apply-imports> can be done. I was looking into the
tutorials for using <xsl:apply-imports> and I don't think attribute
"use-when" will be of any help in my case.

Basically the conditional <xsl:apply-imports> for reference styles depends
upon the "journalcode". Below is what I am trying to achieve.


<xsl:template match="article/meta/journalcode[.='ABCD' | 'EFGH' | 'IJKL' |
<xsl:apply-imports/> <!--  Some thing I need to do here  -->

Another way of get it done is use of "mode" attribute <xsl:apply-templates
mode="Reference-style-1"/>, which infact I was using as of now, but I ending
up defining a huge stylesheet. This was reason I thought of having different
modules to make the things manageable.

My questions:

1. Can the conditional apply-imports can be done. Or even conditional import
of <xsl:import> instead of declaring all of them on top?
2. I have also noticed that my transformation taking much more time after
declaring (xsl:import) all the stylesheet on top. Do this have anything to
do with importing lots of stylesheet or this my incorrect clairvoyance? I am
using XMLSPY enterprise edition.
3. Finally, is this a correct method to approach?

Any suggestions will be highly appreciated.


Pankaj Chaturvedi


Confidentiality Notice:" This message and any attachment(s)
contained here are information that is confidential, proprietary to
IDS Infotech Ltd. and its customers.
Contents may be privileged or otherwise protected by law. The
information is solely intended for the individual or the entity it
is addressed to. If you are not the intended recipient of this
message, you are not authorized to read, forward, print, retain,
copy or disseminate this message or any part of it. If you have
received this e-mail in error, please notify the sender immediately
by return e-mail and delete it from your computer."

Current Thread