this is a german Web-Mirror of MHONARC.ORG powered by Domainunion AG

[Top] [All Lists]

Re: [xsl] Dynamically determine which XSLT files to include and import?

2013-07-29 11:08:48
Have you considered massaging your XSLT before running it? Since an XSLT file is an XML file, it can be the input to another XSLT.

Step 1 - XSLT-A.xsl:
 - read input XML into a tree
 - process XSLT-B-RAW.xsl based on value X to synthesize <xsl:include>
   instructions when writing out stylesheet XSLT-B.xsl

Step 2 - XSLT-B.xsl:
 - read input XML into a tree
 - use massaged stylesheet

This may satisfy your requirement.

. . . . . .  Ken

At 2013-07-29 11:36 -0400, I wrote:
At 2013-07-29 15:34 +0000, Costello, Roger L. wrote:
Is there a way for an XSLT program to, at runtime, decide which XSLT files to include and import?

Only based on environment issues at runtime by using use-when=, not by any data information.

I imagine something like this at the top of the XSLT program:

    if the input file has value X set then
        include A.xsl, B.xsl
        include C.xsl, D.xsl

Any way to do this?

No, the source tree is not even built until the entire stylesheet has been interpreted because there are stylesheet instructions that impact on the building of the tree.

So by the time you have any input data in your tree, all stylesheet building has been completed.

I hope this helps understand the situation.

. . . . . . . . . . Ken

Public XSLT, XSL-FO, and UBL classes in the Netherlands     Oct 2013 |
Public XSLT, XSL-FO, UBL and code list classes in Australia Oct 2013 |
Contact us for world-wide XML consulting and instructor-led training |
Free 5-hour lecture: |
Crane Softwrights Ltd.   |
G. Ken Holman                   mailto:gkholman(_at_)CraneSoftwrights(_dot_)com 
Google+ profile: |
Legal business disclaimers: |

XSL-List info and archive:
To unsubscribe, go to:
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>