You need to use fn:string(), which will return the value of its argument as xs:string. In case its argument is an attribute, it will therefore return the attribute’s value as xs:string.
test=$(xmllint --xpath "string(//body/value/@name)" test.xml)