Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.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

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
Php 将两个xml文件合并为一个_Php_Xml_Xslt - Fatal编程技术网

Php 将两个xml文件合并为一个

Php 将两个xml文件合并为一个,php,xml,xslt,Php,Xml,Xslt,当$pXml1包含空格例如“a b c.xml”时,代码失败 怎么解决呢 是否需要一些编码?当传递字符串时,函数需要一个字符串。如果XSLT处理器支持,则可以使用EXSLT到URI的扩展函数对文件名进行编码。当传递字符串时,该函数需要一个字符串。如果XSLT处理器支持,则可以使用EXSLT到URI的扩展函数对文件名进行编码 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

$pXml1
包含空格例如“a b c.xml”时,代码失败

怎么解决呢


是否需要一些编码?

当传递字符串时,函数需要一个字符串。如果XSLT处理器支持,则可以使用EXSLT到URI的扩展函数对文件名进行编码。

当传递字符串时,该函数需要一个字符串。如果XSLT处理器支持,则可以使用EXSLT到URI的扩展函数对文件名进行编码

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="pXml1" select="''" />
  <xsl:param name="pXml2" select="''" />
  <xsl:param name="pRoot" select="'root'" />

  <xsl:template match="/">
    <xsl:variable name="vXml1" select="document($pXml1)" />
    <xsl:variable name="vXml2" select="document($pXml2)" />

    <xsl:element name="{$pRoot}">
      <xsl:copy-of select="$vXml1/*/*" />
      <xsl:copy-of select="$vXml2/*/*" />
    </xsl:element>
  </xsl:template>

</xsl:stylesheet>