[xsl] Testing if attribute node

Subject: [xsl] Testing if attribute node
From: Marcus Andersson <marcan@xxxxxxx>
Date: Tue, 20 Jan 2004 02:17:17 +0100
Hi

I'm genenerating stylesheets (with XSLT) from the following XML fragment (example):

<rule match="elt"/>
<rule match="elt/@someattr"/>

Those rules gives me templates after a transform:

<xsl:template match="elt">
...
</xsl:template>

<xsl:template match="elt/@someattr">
...
</xsl:template>

I want to do some conditionals inside the templates based on whether the current node is an attribute or not. Is that possible to do?

My alternative, as I see it, is to parse the match attribute when I generate the stylesheet and put a variable inside the templates but I really don't want to do that.

Any suggestions are welcome (even those that completely alters my approach :)

/Marcus

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


Current Thread