This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Conditional selection of Templates in XSL
- To: <xsl-list at mulberrytech dot com>
- Subject: RE: Conditional selection of Templates in XSL
- From: "Chris Bayes" <Chris at Bayes dot co dot uk>
- Date: Thu, 24 Aug 2000 22:27:08 +0100
- Reply-To: xsl-list at mulberrytech dot com
Try
<xsl:template match="TABLE">
<xsl:choose>
<xsl:when test="$isFile = 'true'">
<xsl:call-template name="extractTable"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="." />
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates/>
</xsl:template>
<xsl:template name="extractTable">
<xsl:value-of select="./text()"/>
</xsl:template>
Ciao Chris
XML/XSL Portal
http://www.bayes.co.uk/xml
>-----Original Message-----
>From: owner-xsl-list@mulberrytech.com
>[mailto:owner-xsl-list@mulberrytech.com]On Behalf Of ciaran byrne
>Sent: 25 August 2000 00:30
>To: XSL-List
>Subject: Conditional selection of Templates in XSL
>
>
>Hi all,
> I'm attempting to select certain templates in my XSL
>according to whether I've set a param to true or false.
>Allow me to explain as follows:
>In HTML tables can be nested. In my XML they can't.
>So, I have a param set in my XSL that I pass a value into
>using MSXML. If this value is set to 'true' then I want to
>just extract the text from the table i.e. TABLE/text()
>if it's false then I want to output the table and all the child
>nodes that go with it.
>Here is the type of XSL I'm attempting:
>
><xsl:template match="TABLE">
> <xsl:choose>
> <xsl:when test="$isFile = 'true'">
> <xsl:call-template name="extractTable"/>
> </xsl:when>
> <xsl:otherwise>
> <!-- Here I want to output the Table with all
> it's child nodes such as <tr>,<td> etc. -->
> </xsl:otherwise>
> </xsl:choose>
> <xsl:apply-templates/>
></xsl:template>
>
><!-- Does this mean that when called I only match against
>the text node ????? -->
><xsl:template name="extractTable" match="TABLE/text()">
> <xsl:value-of select="."/>
></xsl:template>
>
>I know this is wrong...but I was hoping it would give an idea of where
>I'm going.
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list