Is there a way to correctly concatenate three arbitrary XPath expressions to result in a new valid XPath expression?
Is there a way to correctly concatenate three arbitrary XPath expressions to result in
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Update: The OP has indicated in a comment that the three expressions select text nodes.
In this case using the union operator (
|) seems most appropriate.There are many possible ways to do this and some of these may benefit from knowing the return type of the evaluation.
One of the combinator that always “works” (although maynot always be meaningful) is:
Other examples:
In case the expressions are guaranteed to select a node-set, then this expression (the union of the node-sets) would also combine them:
In XPath 2.0 this expression should always work (concatenation to a sequence of items):
or this one: