开发者

Selecting Comments by their inner xml in xpath/xsl

开发者 https://www.devze.com 2022-12-12 01:32 出处:网络
Given the following xml document <root> <childnode0/> <childnode2/> <!--Comment1-->

Given the following xml document

<root>
   <childnode0/>
   <childnode2/>
   <!--Comment1-->
   <childnode3/>
   <childnode4/>
   <!--Comment2-->
</root>

I know the xpath to select all the 开发者_运维技巧comments at a particular level in xsl

string xPath = "/root/comment()";

However i'd like to select a comment where the inner xml is "Comment2".

Any ideas?

Thanks

Dave


This

/root/comment()[.='Comment2']

seems to work.


maybe this would work: /root/comment()[2]

0

精彩评论

暂无评论...
验证码 换一张
取 消