I need an XPath that will elect all parent nodes a child with anattribute that constains at least one of a list of values.
Example XML
<mynodes>
<theParentNode>
<theChildNode name="one two" />
</theParentNode>
<theParentNode>
<theChildNode name="one all" />
</theParentNode>
<theParentNode>
<theChildNode name="two" />
</theParentNode>
<theParentNode>
<theChildNode name="all" />
</theParentNode>
</mynodes>
I want to select all nodes where name contains "one" OR "all" (or any other combination for that matter). So that the returned nodeList is:
<theParentNode>
<theChildNode name="one two" />
</theParentNode>
<theParentNode>
<theChildNode name="one all" />
</theParentNode>
<theParentNode>
<theChildNode name="all" />
</theParentNode>
So far my query looks like this (note im not using a schema):
//theChildNode[contains(tokenize(@name, '\s'), "one")]
Which will get me all the vendor elements containing "one" in their name attribute. But im unsure how to go about supplying multiple values in place of the "one", and then the best way to step back up to theParentNode
. I could always just do all of this in php but id rather just do it with a XPath if possible.