This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Testing for CDATA


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]