Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.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
Xml 如何使用xsl:copy of获取除特定元素下的节点外的所有节点?_Xml_Xslt - Fatal编程技术网

Xml 如何使用xsl:copy of获取除特定元素下的节点外的所有节点?

Xml 如何使用xsl:copy of获取除特定元素下的节点外的所有节点?,xml,xslt,Xml,Xslt,输入xml: <ce:author-group xmlns:ce="http://tempuri.org/ce" xmlns:sa="http://tempuri.org/sa"> <ce:author> <ce:given-name>Rafael</ce:given-name> <ce:surname>Torres</ce:surname> <orfid>a</orfid>

输入xml:

<ce:author-group xmlns:ce="http://tempuri.org/ce" xmlns:sa="http://tempuri.org/sa">
  <ce:author>
    <ce:given-name>Rafael</ce:given-name>
    <ce:surname>Torres</ce:surname>
    <orfid>a</orfid>
    <ce:e-address type="email">rtorres@sissa.it</ce:e-address>
  </ce:author>
  <ce:affiliation>
    <ce:label>a</ce:label>
    <sa:organization>Scuola Internazionale Superiori di Studi Avanzati, Via Bonomea 265, I-34136, Triest</sa:organization>
    <sa:country>Italy</sa:country>
  </ce:affiliation>
</ce:author-group>
<ce:author-group xmlns:ce="http://tempuri.org/ce" xmlns:sa="http://tempuri.org/sa">
  <ce:affiliation>
    <ce:label>a</ce:label>
    <sa:organization>Scuola Internazionale Superiori di Studi Avanzati, Via Bonomea 265, I-34136, Trieste</sa:organization>
    <sa:country>Italy</sa:country>
  </ce:affiliation>
</ce:author-group>

拉斐尔
托雷斯
A.
rtorres@sissa.it
A.
阿凡扎蒂研究院国际高等专科学校,经特里斯特I-34136号博诺米亚265号
意大利
所需的输出xml:

<ce:author-group xmlns:ce="http://tempuri.org/ce" xmlns:sa="http://tempuri.org/sa">
  <ce:author>
    <ce:given-name>Rafael</ce:given-name>
    <ce:surname>Torres</ce:surname>
    <orfid>a</orfid>
    <ce:e-address type="email">rtorres@sissa.it</ce:e-address>
  </ce:author>
  <ce:affiliation>
    <ce:label>a</ce:label>
    <sa:organization>Scuola Internazionale Superiori di Studi Avanzati, Via Bonomea 265, I-34136, Triest</sa:organization>
    <sa:country>Italy</sa:country>
  </ce:affiliation>
</ce:author-group>
<ce:author-group xmlns:ce="http://tempuri.org/ce" xmlns:sa="http://tempuri.org/sa">
  <ce:affiliation>
    <ce:label>a</ce:label>
    <sa:organization>Scuola Internazionale Superiori di Studi Avanzati, Via Bonomea 265, I-34136, Trieste</sa:organization>
    <sa:country>Italy</sa:country>
  </ce:affiliation>
</ce:author-group>

A.
的里雅斯特I-34136博诺梅亚265号国际高级研究院
意大利
如何在xslt中使用单个
来获取输出xml

我不想要
作者
信息,我只想获得
从属关系
信息。

你不能只使用
的一个
副本,因为输出不是输入的任何部分的副本-它是一个新的
ce:author-group
元素,其中包含作为其唯一子元素的输入部分的副本

你能找到的最近的是

<xsl:template match="ce:author-group">
  <xsl:copy>
    <xsl:copy-of select="ce:affiliation" />
  </xsl:copy>
</xsl:template>

您不能只使用一个
副本来完成,因为输出不是输入的任何部分的副本-它是一个新的
ce:author group
元素,其中包含一个作为其唯一子元素的输入部分副本

你能找到的最近的是

<xsl:template match="ce:author-group">
  <xsl:copy>
    <xsl:copy-of select="ce:affiliation" />
  </xsl:copy>
</xsl:template>

如何在xslt中使用single获取输出xml

不可能<代码>
创建所选节点的完整、直接副本。您不能使用它来制作部分副本

您需要的是使用单个额外模板进行身份转换:

<xsl:template match="ce:author" />

如何在xslt中使用single获取输出xml

不可能<代码>
创建所选节点的完整、直接副本。您不能使用它来制作部分副本

您需要的是使用单个额外模板进行身份转换:

<xsl:template match="ce:author" />


你真的要删除整个
ce:author
节点?你真的要删除整个
ce:author
节点?