Obtaining the Name of a Node

The name() function returns a string that contains the tag name of the node, including the namespace prefix, if any.

The following query returns the name of the third element in bookstore, which is "magazine".

name(/bookstore/*[3])
               

            

Wildcards

An asterisk ( * ) specifies a wildcard name for element names. If there are comments before the third element in the preceding example, this query does not include them in the count. See Filtering Results of Queries.

Note

 

Remember, an asterisk that is not preceded by an at sign (@) never returns attributes. The XPath processor does not include attributes in node counts. See Attributes and Wildcards.

 
Free Stylus Studio XML Training: