Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the xpath expression "@*" mean?

Tags:

xml

xslt

xpath

Microsoft's XSLT template on Visual Studio has something like:

<xsl:template match="@* | node()">

What is @*?

like image 686
Eduardo Avatar asked Dec 28 '22 06:12

Eduardo


2 Answers

@* is short for attribute::* and selects all attributes of the context node (or, in an XSLT match pattern, it's more appropriate to say that it matches all attributes). From the XPath spec:

There is also an abbreviation for attributes: attribute:: can be abbreviated to @. For example, a location path para[@type="warning"] is short for child::para[attribute::type="warning"] and so selects para children with a type attribute with value equal to warning.

like image 146
Wayne Avatar answered Jan 01 '23 11:01

Wayne


That means match any attribute.

http://www.w3.org/TR/1999/REC-xpath-19991116/#path-abbrev

like image 21
Daniel Haley Avatar answered Jan 01 '23 11:01

Daniel Haley