[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

simulating conditional <xsl:include> behavior?

Subject: simulating conditional <xsl:include> behavior?
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Wed, 3 Nov 1999 01:07:03 -0700
conditional xsl include
I am wondering if there is an obvious solution that I'm overlooking here,
perhaps involving XML parameter or general entities or something.

What I would like to do is the equivalent of wrapping <xsl:include> in an
<xsl:if> or <xsl:for-each>. I want to pull into my stylesheet certain XSLT
templates only when certain conditions are true -- namely, the presence of
certain data in a source document. The goal is to cut down on the overhead
of parsing myriad XSLT documents before the meat of the XSLT processing can
begin.

sample XML fragment that lists all possible templates:
<myXML>
    <templates>
        <template name="foo" URI="bar.xsl">
        <template name="baz" URI="maz.xsl">
        <template name="hello" URI="world.xsl">
    </templates>
    <data>
        <foo>process me</foo>
        <baz>process me</baz>
    </data>
</myXML>

sample XSL fragment illustrating the effect I'd like to achieve:
<xsl:for-each select="/myXML/data/*">
    <xsl:include href="{/myXML/template[@name=.]/@URI}"/>
</xsl:for-each>

Of course, the href attribute on <xsl:include> is not an attribute value
template and <xsl:for-each> isn't allowed at the top level, so this isn't
the right approach. Any suggestions appreciated. I'm using XT.

-Mike


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.