Working on an XSLT sheet, I end up in a template with some current() xpath. I would like to know if it refers to an attribute or to an element.
Actually, I do not manage to do what I want using the template filters select="./@*"or select="./*", because I want to get all the elements or attributes in one shot, and apply a different treatment depending on the type, in the same template.
It sounds rather as if you want to set up different templates for the different nodes with e.g. match="* and match="@*".
If you really want to check inside a template then you can use <xsl:if test="self::*"> to test whether it is an element node and in XSLT 2 and later also with <xsl:if test="self::attribute()"> whether it is an attribute. In XSLT/XPath 2 and later there is also the . instance of element() respectively . instance of attribute() test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With