This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: conditional XSL to XSL
- To: xsl-list at mulberrytech dot com
- Subject: Re: conditional XSL to XSL
- From: Jeff Lansing <jeff at dtai dot com>
- Date: Fri, 07 Apr 2000 13:18:39 -0700
- References: <md5:B39C2E26EF7B79A45CF42274D1C778E2>
- Reply-To: xsl-list at mulberrytech dot com
Michael Kay wrote:
> > <xsl:template match="{$match-value}">
>
> The match attribute of xsl:template is not one of the (small number of)
> attributes that are interpreted as attribute value templates.
>
Yes. I guess this is covered by the 7.6.2 NOTE. But what is misleading
me is the fact that it works exactly as might be expected by not-readers
of this note; for example, the template:
<x:template match="el">
<x:variable name="match-value">
<x:if test="@attr = 'x'">
<x:value-of select="'value1'"/>
</x:if>
<x:if test="not(@attr = 'x')">
<x:value-of select="'value2'"/>
</x:if>
</x:variable>
<xsl:template match="{$match-value}">
<xsl:value-of select="foo"/>
<!--whole bunch of other complicated stuff-->
</xsl:template>
</x:template>
produces (given the input I previously mentioned), the 2 templates:
<xsl:template match="value1">
<xsl:value-of select="foo"/>
</xsl:template>
<xsl:template match="value2">
<xsl:value-of select="foo"/>
</xsl:template>
in all of xalan/saxon/xt/oracle xsl. So at least for the non-readers
of the note (whose carelessness I am not trying to excuse),
the only problem would seem to be getting the right stuff
into these 'value1' and 'value2' strings.
>
> The only way you can achieve the effect you are after (at least, in the way
> you are trying to do it) is to write a stylesheet that generates another
> stylesheet as output.
>
Er, how is that different from what I'm doing here?
Jeff
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list