in reply to Accessing node attribute with XML::XPath
Your query returns elements, and those have an getAttribute method.
If you wanted to go the xpath route, the xpath to the attribute node would be attribute::type, for which @type is a shortcut.