2010-01-26 61 views
1
<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包含空格Ex时代码失败。 “a b c.xml”将两个xml文件合并为一个

如何解决?

需要编码吗?

回答

1

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

+0

非常感谢你 – brian 2010-01-29 02:50:24