RE: [xsl] Question about Including external stylesheets

Subject: RE: [xsl] Question about Including external stylesheets
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Thu, 9 Aug 2001 10:05:34 +0100
> In my client application, I am using a certain stylesheet to
> transform the
> output from our app. server. Depending on the content of the
> XML I want to
> include(import actually) one of several stylesheets dynamically. I've
> noticed that it is not possible to use a variable in the call to an
> xsl:include statement (I don't think) and certainly not with
> an import since
> it has to be the first thing in the stylesheet. Does anyone
> have any ideas
> about how I can link a stylesheet with another stylesheet dynamically?

As you say, include and import are static facilities, like #include in C,
they can't be used to modify your stylesheet on the fly.

I think the best approach to this problem is a two-stage transformation. The
first stage does any generic processing and selects the stylesheet to be
used for the second stage (e.g. by writing an <?xml-stylesheet?> processing
instruction to the result document). The second stage then uses a different
stylesheet depending what decisions were made during the first stage.

Mike Kay
Software AG


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


Current Thread