XPATH - (Node) Attribute (@)

About

In a template, the expression @type refers to the type attribute of the current node. Similarly, the expression @* refers to all the attributes for the current element.

To refer to an attribute, you prefix the attribute name with an @ sign.

Example:

LIST/@type
LIST/@*   
LIST/attribute::type

where:

  • LIST is an node with the name LIST
  • @type refers to the type attribute of an element.
  • @* refers to all the attributes for the current element (here LIST)

Because the expression does not begin with /, the reference specifies a list node relative to the current context-whatever position in the document that happens to be.


Powered by ComboStrap