This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Testing for CDATA
- To: xsl-list at mulberrytech dot com
- Subject: Re: Testing for CDATA
- From: Oliver Becker <obecker at informatik dot hu-berlin dot de>
- Date: Tue, 8 Aug 2000 20:05:42 +0200 (MET DST)
- Reply-To: xsl-list at mulberrytech dot com
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@informatik.hu-berlin.de |
| op|qo WWW: http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list