Some initial error checking in XPath
Strip commas from amounts so that floatval doesn't fail