Download Delve® SOA Fast-Prototyping Toolkit (Beta 1.0)
| Tutorials - How To Use XPath to Set and Get Attribute Values |
Page 1 of 3 |
In “How to Use XPath to Set and Get Element Values,” we took a look at how the accessor operator can be used to manipulate and obtain XML element contents. Tectonic allows attribute values to be set and obtained in much the same way. If you haven’t already read “How to Use XPath to Set and Get Element Values” you’ll probably want to take a look at that lesson before continuing.
Suppose we have a “dimen” element that defines a default “units” attribute which may be overridden by units attributes in its child nodes.

We can display the value of the units attribute of dimen like so…

…and the units attribute of depth like so…

Just like XPath, Tectonic uses the “@” character to indicate specification of an attribute. |
|
|