Re: Conditinally including an XSL module

Subject: Re: Conditinally including an XSL module
From: uche.ogbuji@xxxxxxxxxxxxxxx
Date: Tue, 25 Jul 2000 10:55:41 -0600
Still having troubles posting to the list.  Re-send...

> So what's the underlying requirement that people would like a "run-time
> include" to satisfy? Presumably it's to have a different set of template
> rules depending on what you find in the source document, and perhaps to have
> different sets of template rules in force at different times. That looks
> rather like an extension of the "mode" concept, with the ability to select
> the processing mode dynamically, and to make it "sticky". Perhaps even to
> set the default mode, so that <xsl:apply-templates/> will only look for
> rules with "mode='xyz'". Am I right?

I'm about a week behind, but I'll note that the latest release of 4XSLT (which 
I just announced) includes just such a capability, indirectly.

We've added an extension called set-mode which accepts an AVT so that one can 
piggy-back off global parameters to set a default mode.

It's used as in the following:

<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:ft="http://Fourthought.com/4Suite/XPath/Extensions";
  extension-element-prefixes='ft'
  version="1.0"
>
  <xsl:param name='start-mode' select='"mode-1"'/>

  <xsl:template match="/">
    <doc>
      <xsl:apply-templates>
        <ft:set-mode select='{$start-mode}'/>
      </xsl:apply-templates>
    </doc>
  </xsl:template>

  <xsl:template match='*' mode='mode-1'>
    <mode-one/>
    <xsl:message>In Mode 1<xsl:message>
  </xsl:template>

</xsl:stylesheet>

Then one can use the command-line or API inteface to override the default 
value of $start-mode


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji@xxxxxxxxxxxxxxx               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python



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


Current Thread