Re: [xsl] Finding the current node type

Subject: Re: [xsl] Finding the current node type
From: Abel Braaksma <>
Date: Wed, 01 Aug 2007 16:13:42 +0200
Mark Anderson wrote:
Thanks Guys

In my application, I will only need to process a few hundred nodes and
about 20-30 of the type where I need to use the choose statement.

Sounds like you want a copy idiom with some template matches instead of xsl:choose (or remove the copy if you meant with the above that you want to remove all the things not in the xsl:choose)

I went with the <xsl:if test=self::speaker> option as I still use the
namespace (e.g. <xsl:if test=self::abc:speaker>). Whereas localname
returned the node name without the ns prefix

Correct, as already been stated in this thread. If you find yourself doing test="self::ns:speaker" or similar, it is almost always better to do xsl:apply-templates with xsl:template matching. XSLT code only rarely really needs xsl:choose or xsl:if statements. Note that apply-templates automatically does nothing when the selected node set is not there.

-- Abel Braaksma

Current Thread