I have this snippet of XSLT code:
<xsl:variable name="key" select="@*[1]"/>
But I need it to actually set key to be the first attribute (if it exists) that doesn’t have a special name. So both of these nodes would have the same key, and special_attr is ignored if it exists.
<MyNode var="1" />
<MyNode special_attr="foo" var="1" />
What is the proper select syntax to get the first attribute’s value whose name isn’t special_attr?
1 Answer