2010-01-26 6 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에 공백이있을 경우 코드가 실패합니다. "a b c.xml"두 xml 파일을 하나로 결합하십시오.

어떻게 해결합니까 ??

일부 인코딩 필요 여부가 궁금하십니까?

답변

1

문자열을 전달할 때 document 함수는 URI을 필요로합니다. XSLT 프로세서가 지원하는 경우 EXSLT의 str:encode-uri 확장 기능을 사용하여 파일 이름을 URI 인코딩 할 수 있습니다.

+0

고맙습니다. – brian

관련 문제