xsl-list
[Top] [All Lists]

Easy way to identify node type?

2003-12-04 09:23:16
Is there an easy way (or any way at all) to identify the type of the  
node being processed? Suppose, for instance, that you wanted to 
produce different output for different node types, as in the 
*fictitious* example below:

<xsl:template match="root">
        <xsl:for-each select="node()">
                <xsl:choose>
                        <xsl:when test="node-type() = 'ELEMENT'">
                                <xsl:text>blah, blah</xsl:text>
                        </xsl:when>
                        <xsl:when test="node-type() = 'TEXT'">
                                <xsl:value-of select="."/>
                        </xsl:when>
                        ...
                </xsl:choose>
        </xsl:for-each>
</xsl:template>

Is there a way to do that?

Thanks in advance for your input,

Erik

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



<Prev in Thread] Current Thread [Next in Thread>