在xpath / xsl中按内部xml选择注释

前端之家收集整理的这篇文章主要介绍了在xpath / xsl中按内部xml选择注释前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
给出以下xml文档

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

我知道xpath选择xsl中特定级别的所有注释

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

但是我想选择内部xml为“Comment2”的注释.

有任何想法吗?

谢谢

戴夫

解决方法

这个

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

似乎工作.

猜你在找的XML相关文章