Before issuing an attr tag, check with XPath that the node exists.

Documentation sometimes refers to an override method that the developer
may implement, but it doesn't actually exist in the library (mostly
event handlers to extend behavior).