Subject: RE: Xsl:import and param
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 1 Oct 2003 11:31:10 +0100
|
> i would like to import an xsl file according to the value of a param :
>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>
> <xsl:param name="xsl_criteria"/>
> <xsl:import>
> <xsl:attribute name="href">
> <xsl:text>file:</xsl:text><xsl:value-of
> select="$xsl_criteria"/>
> </xsl:attribute>
> </xsl:import>
>
Come on, stop and think. Since when did xsl:attribute ever write
anything *to the stylesheet*?
>
> Is there a solution for my problem ?
>
You haven't told us anything about your problem, only your highly
imaginative attempt to solve it.
xsl:import is a compile-time facility. It takes effect long before the
stylesheet is evaluated, which is when parameters are examined and
instructions like xsl:attribute are executed. You can't modify your
source code while the program is running.
You could write a stylesheet that generates a new stylesheet, but I
suspect you don't need to. Usually when people ask for dynamic
xsl:import it's because they are doing import the wrong way around. You
should import the general-purpose stylesheet modules into the
special-purpose modules, not the other way around.
Michael Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|