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

Cra*_*lla 4 xml xslt xpath comments

给出以下xml文档

<root>
   <childnode0/>
   <childnode2/>
   <!--Comment1-->
   <childnode3/>
   <childnode4/>
   <!--Comment2-->
</root>
Run Code Online (Sandbox Code Playgroud)

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

string xPath = "/root/comment()";
Run Code Online (Sandbox Code Playgroud)

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

有任何想法吗?

谢谢

戴夫

Cor*_*ter 11

这个

/root/comment()[.='Comment2']
Run Code Online (Sandbox Code Playgroud)

似乎工作.