Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/12.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中复制XMLN_Xslt - Fatal编程技术网

XSLT不在我的xml中复制XMLN

XSLT不在我的xml中复制XMLN,xslt,Xslt,在上面的xml中,我希望一切保持原样,但我的xsl没有复制它 i、 e无法从中复制元素xmlns:c=“urn:com:config” <?xml version="1.0"?> <c:configuration xmlns:c="urn:schemas-med-sadfens-com:config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:schemas-med

在上面的xml中,我希望一切保持原样,但我的xsl没有复制它

i、 e无法从中复制元素xmlns:c=“urn:com:config”

<?xml version="1.0"?>
<c:configuration xmlns:c="urn:schemas-med-sadfens-com:config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:schemas-med-sadfens-com:config D:\config.xsd">
<c:component c:name="FC1PLAZACS1-DEV [Central Server]" c:keywords="Server" c:helpriid="11f7b87d-52ae-434b-8ace-4ffb4ecbe080">
        <c:propertyelement c:name="System manufacturer" c:value="select Manufacturer from Win32_ComputerSystem" c:type="Wmi" xmlns:c="urn:schemas-med-siemens-com:config" />
        <c:propertyelement c:name="System model" c:value="select Model from Win32_ComputerSystem" c:type="Wmi" xmlns:c="urn:schemas-med-siemens-com:config"/>
</c:component>
</c:configuration>

请找到我的XSl

<c:propertyelement c:name="System manufacturer" c:value="select Manufacturer from Win32_ComputerSystem" c:type="Wmi" xmlns:c="urn:schemas-med-siemens-com:config" />


请尽快告诉我答案。我使用类似于以下的方法将节点迁移到一个新名称空间YMMV:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:c="urn:schemas-med-siemens-com:config" >

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

</xsl:stylesheet>


您使用的XSLT处理器是什么?我刚刚用
xsltproc
对其进行了测试,它确实正确地复制了名称空间声明
<xsl:stylesheet 
  version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
  xmlns:c="urn:schemas-med-siemens-com:config" >
  <xsl:param
     name="new-ns"
     select="'http://my.new.ns'"
     />

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

  <xsl:template match="*">
    <xsl:element name="{local-name()}" namespace="{$new-ns}">
      <xsl:apply-templates select="node()|@*"/>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>