I\'m interested in assigning the tag name of the root element in an xml document to an xslt variable. For instance, if the document looked like (minus the DTD):
<
Use the XPath name() function.
One XPath expression to obtain the name of the top (not root!) element is:
name(/*)
The name() function returns the fully-qualified name of the node, so for an element the string "bar:foo" will be returned.
In case only the local part of the name is wanted (no prefix and ":"), then the XPath local-name() function should be used.