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

Re: conditional XSL to XSL

Subject: Re: conditional XSL to XSL
From: Jeff Lansing <jeff@xxxxxxxx>
Date: Fri, 07 Apr 2000 13:18:39 -0700
jeff lansing
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


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.