0

XSLT2.0を使用しています。これが私の最初のファイルです。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xalan="http://xml.apache.org/xslt" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:IAAXML="http://www.ibm.com/industries/financialservices/IAAXML">
    <xsl:import href="address.xsl"/>
    <xsl:template match="/">
        <Claim>
            <Contact>
                    <xsl:variable name="contact" select="//IAAXML:Invoice/IAAXML:roleInFinancialStatement/IAAXML:party[@xsi:type='IAAXML:Organization']/IAAXML:subOrganisation"/>
                    <xsl:call-template name="address">
                        <!-- <xsl:param name="contactParam" select="$contact"/> -->
                        <xsl:with-param name="contactParam" select="$contact"/>
                    </xsl:call-template>
            </Contact>
        </Claim>
    </xsl:template>
</xsl:stylesheet>

これが私の2番目のファイルです。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xalan="http://xml.apache.org/xslt" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:IAAXML="http://www.ibm.com/industries/financialservices/IAAXML">
    <xsl:param name="contactParam" select="'default'"/>
    <!-- <xsl:param name="address" select="'default'"/> -->
    <xsl:template match="/" name="address" >
        <Address>
            <xsl:variable name="address" select="$contactParam[IAAXML:type/IAAXML:name='Department']/IAAXML:partyContactPreferences/IAAXML:contactPoints" />
            <AddressLine1>
                <xsl:value-of select="$address/IAAXML:addressLines" />
            </AddressLine1>
            <City>
                <xsl:value-of select="$address/IAAXML:city" />
            </City>
            <State>
                <xsl:value-of select="$address/IAAXML:state" />
            </State>
        </Address>
    </xsl:template>
</xsl:stylesheet>

次のエラーが発生します。IXJXE0781E:[ERR 0700] [ERRXTSE0680]トンネルパラメーター'contactParam'ではないパラメーターを、同じ拡張QNameを持つテンプレートパラメーターを持たないテンプレートに渡すことは静的エラーです。 。; SystemID:ファイル:/C:/p4/xslPlay/partyTx/test.xsl; 行番号:10; 列#62

私は何が間違っているのですか?パラメータを他のファイルに渡すにはどうすればよいですか?ありがとう。

4

1 に答える 1

1

この場合、テンプレートにcontactParamという名前のパラメーターを含めるべきではありませんか?:

<xsl:template match="/" name="address" >
    <xsl:param name="contactParam" select="'default'"/>

私はそれがエラーの原因だと感じています。

于 2013-01-10T19:03:27.193 に答える