You don't show us your code, you don't show us your data, and you don't show us the error message you get. My crytal ball claims that maybe you're just running double quoted strings where you should be using single quoted strings. See perlop about how these differ - one interpolates and the other doesn't.
For the record, I had no problems using the XPath implementation of XML::LibXML. Accessing an attribute of a root node (or rather, getting the node containing it) would be done using
/root@foo
as the XPath expression. A likely sample could be:
...
my $query = '/root@foo';
my @nodes = $document->find_nodes($query);
|