[xsl] Easy way to identify node type?

Subject: [xsl] Easy way to identify node type?
From: yguaba@xxxxxxxxxxxx
Date: Thu, 04 Dec 2003 14:23:16 -0200
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


Current Thread