There are a couple of consderations here. The first is that xpathvalue returns xml text values, not the full xml. So unless your xml_in is encoded as character data xpathvalue will not give you what you want. See the XMLQUERY function instead.
The next issue of using xml in a comparison could be addressed by passing the value as a string (assuming that it is a small value). Otherwise I'd have to know more about how the value will be used to make other suggestions.