[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] mulitple xsl:import from different directories

Subject: Re: [xsl] mulitple xsl:import from different directories
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 09 Jul 2012 18:52:53 -0400

At 2012-07-09 23:57 +0200, Olivier XILLO wrote:
I have a master XSL file that need to include/import several xsl files located in a directory 'xsl_dir'.
However, I don't know in advance the number and names of xsl files.
So, I basically need to do something like :
<xsl:include href="xsl_dir/*.xsl"/>

I'm using XSLT2.0 with Saxon 9.3 HE.

Any idea on how I could achieve this ?

Use XSLT to create a single file of multiple <xsl:include> statements by using Saxon's implementation of collection(), and then have a single <xsl:include> in your stylesheet that includes the generated file.

I can't see a way of doing it all at compile time ... I'm sure you'll need the pre-step of creating the intermediate file of include statements. At least you won't have to change your stylesheet as the one include need never change.

I hope this helps.

. . . . . . . . . . Ken

-- Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012 Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread