Javascript And Xpath
I am using plain old school Javascript - So no jQuery responses please!.
I have loaded in an xml document which kind of looks like this
<node>
<child tags='Foo,Bar'>
------ GrandChild Nodes Here
</child>
<child tags='Nuts,Bolts'>
------ GrandChild Nodes Here
</child>
<child tags='Bacon,Eggs'>
------ GrandChi开发者_运维知识库ld Nodes Here
</child>
</node>
What I need to know is if I wanted to get all the children of a node that had been tagged in Foo for example how what I do this using xPath.
Cheers
Steve
Use this XPath 1.0 expression:
/node/child[
contains(
concat(',',@tags,','),
',Foo,'
)
]/node()
精彩评论