xpath_string
xpath_string (expr[, doc])
This function evaluates an XPath expression with respect to a document and returns the result of expr converted to a string.
• expr — A valid XPath expression.
Do not use expressions that contain position() or last(). They do not work in this context. Use the preceding-sibling or following-sibling axes instead to achieve the desired results. For example:
◦ count(preceding-sibling::*)=0 will test that the context node is the first child of its parent.
◦ count(preceding-sibling::para)=1 will test that the context node is the second para child of its parent.
◦ count(following-sibling::*)=0 is a viable alternative to position()=last()
• doc — The identifier of the document tree to use as the context node. If omitted or 0, the current document is used.
Non-string results are converted to strings using standard XPath rules:
• Boolean expressions are converted to the string “true” or “false”
• Node set expressions return the string value of the first node, or an empty string if the node set is empty.
• Numbers are not specially formatted.
To handle errors, call this function from within a catch.
Related Topics