【问题标题】:combine two xml files into one将两个xml文件合二为一
【发布时间】:2010-01-26 09:45:41
【问题描述】:
<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>

$pXml1 包含空格时,代码失败。 "a b c.xml"

如何解决??

是否需要一些编码?

【问题讨论】:

    标签: php xml xslt


    【解决方案1】:

    当被传递一个字符串时,document 函数需要一个URI。如果您的 XSLT 处理器支持它,您可以使用 EXSLT 中的 str:encode-uri 扩展函数对您的文件名进行 URI 编码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-05
      • 2012-04-24
      • 2010-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多