Re: Testing for CDATA

Subject: Re: Testing for CDATA
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 8 Aug 2000 20:05:42 +0200 (MET DST)
Hi Allan,

> Can I test for a text node?
> 
> I've tried using,
> <xsl:choose>
>    <xsl:when test="text()">
>       <xsl:call-template name="displayText"/>
>    </xsl:when>
>    <xsl:otherwise>
>       <xsl:apply-templates/>
>    </xsl:otherwise>
> </xsl:choose>
> .
> .
> <xsl:template name="displayText">
>    <xsl:value-of select="." display-output-escaping="yes"/>
> </xsl:template>
> 
> But since there is a text node as a child, it's always true.
> Any ideas?

Why not simply use
<xsl:template match="text()">
    <xsl:value-of select="." display-output-escaping="yes"/>
</xsl:template>
?

In case you need output escaping only at certain circumstances you may
use different modes.

Cheers,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


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


Current Thread