def getValues(cat):
    return [attr.content for attr in doc.xpathEval(
        "/elements/parent[@name='%s']/child/@value" % cat)]
print(getValues('CategoryA'))
Get list of XML attribute values in Python