Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用xslt删除xml节点_Xml_Xslt 1.0 - Fatal编程技术网

使用xslt删除xml节点

使用xslt删除xml节点,xml,xslt-1.0,Xml,Xslt 1.0,我相信这个样式表应该删除COG标识符为35806的COG元素,但事实并非如此。请帮忙 <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes"/> <xsl:template match

我相信这个样式表应该删除COG标识符为35806的COG元素,但事实并非如此。请帮忙

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>


  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

  <!--this should remove the cogs with the specified ID but it is not. bug-->
  <xsl:template match="//TRAN/DAY/COG[CogIdentifier/text()='35806']">
  </xsl:template>


</xsl:stylesheet>

您可以使用此

<xsl:template match="COG[CogIdentifier='35806']"/>


请向我们展示输入XML,这样我们就有了一个可复制的示例(请参见:)@Ober:CogIdentifier是子元素还是attributePerhaps输入中有一个名称空间(但为什么让我们猜测?)如果
不起作用,为什么你的建议有效?因为没有提供输入源,我们如何假设绝对路径正确与否。如果你不能重现问题,你如何假设?评论中还提出了其他建议。你只是在黑暗中射击。