代码之家  ›  专栏  ›  技术社区  ›  CraftyFella

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

  •  4
  • CraftyFella  · 技术社区  · 16 年前

    给定以下xml文档

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

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

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

    戴夫

    2 回复  |  直到 16 年前
        1
  •  11
  •   Corey Porter    16 年前

    这

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

    似乎有效。

        2
  •  1
  •   Andrei    16 年前

    也许这会奏效: /root/comment()[2]