Add support for a serialized value of the XPath result

Previous behavior of the XPathFilter was to always return text content
of the matched nodes. But one may want to capture the serialized value
instead. In XPath 3.0 (not out yet), there's the function serialize to
do exactly that so I'm attempting to mimic this behavior.

Similarly, I've added support for the string() function but it doesn't
add any new behavior.

Note that there was a bug in the previous code where it would iterate
over the NodeList but keep using the first node to get the string value