RE: [xsl] using variable in xsl:include ?

Subject: RE: [xsl] using variable in xsl:include ?
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Thu, 26 Feb 2004 11:55:00 -0000
> is it possible to use a variable in xsl:include like e.g. 
> <xsl:variable name="home_directory" 
> select="document('../../XML/config.xml')//iese.config:home_dir
> ectory"/>
> <xsl:include 
> href="concat('file://',$home_directory,'class/Person/XSL/perso
> n_short.xs
> l')"/>
> 
> This example does not work! Does anyone know why? The parser 
> says something like wrong syntax for pathnames,... Any suggestions?

xsl:include must be able to be resolved at compile time, so it cannot
come from a variable.

The usual technique here is to put the variable code into stylesheets
that import the common code, rather that have a stylesheet that imports
stylesheets based on the variable.

Currently you are trying to do:

      A
    / | \
   /  |  \
  B   C   D

Where A imports B, C, or D based on some variable.  Whereas you want to
do:

  B   C   D
   \  |  /
    \ | /
      A

Where B, C, or D imports A.  You can then decide which stylesheet to
apply to your source (b c or d) based on the variable.

cheers
andrew

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread