我遵循XSLT构建:
<xsl:template match="list">
<xsl:param name="tree"/>
<xsl:param name="accountStatement"/>
<xsl:for-each select="AccountStatementDetail">
<tr class="rowNormal">
<td width="4%" align="center">
<xsl:value-of select="position()"/>
</td>
<td width="4%">
<xsl:value-of select="entryDate"/>
</td>
<td width="4%">
<xsl:value-of select="valueDate"/>
</td>
<td width="17%">
<xsl:value-of select="concat(ISOBankTransactionCode/ISOBankTransactionCode/domainCode, ' ', ISOBankTransactionCode/ISOBankTransactionCode/familyCode, ' ', ISOBankTransactionCode/ISOBankTransactionCode/subFamilyCode)"/>
</td>
<td width="17%">
<xsl:value-of select="concat(ISOBankTransactionCode/ISOBankTransactionCode/proprietary/Proprietary/code, ' ', ISOBankTransactionCode/ISOBankTransactionCode/proprietary/Proprietary/issuer)"/>
</td>
<td width="17%" align="right">
<xsl:value-of select="signedAmount/MonetaryValue/amount"/>
</td>
<td width="3%">
<xsl:value-of select="$accountStatement/account/Account/currency"/>
</td>
<td width="17%">
<xsl:value-of select="$tree"/>
<xsl:value-of select="accountServicingInstitutionReference"/>
</td>
<td width="17%">
<xsl:value-of select="$tree"/>
<xsl:value-of select="referenceForAccountHolder"/>
</td>
</tr>
<xsl:choose>
<xsl:when test="not(string-length(informationDetail/InformationDetail/messageZone) = 0)">
<tr class="rowNormal">
<td width="4%"/>
<td colspan="8" width="96%" class="fixedWidth">
<xsl:value-of select="informationDetail/InformationDetail/messageZone"/>
</td>
</tr>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="count(AccountStatementDetailAccountStatementMessageDetail/list/AccountStatementMessageDetail) > 0">
<tr class="rowNormal">
<td width="4%"/>
<td colspan="8" width="96%" class="fixedWidth">
<xsl:for-each select="AccountStatementDetailAccountStatementMessageDetail/list/AccountStatementMessageDetail">
<xsl:choose>
<xsl:when test="not(position() = 1)">
<br/>
</xsl:when>
</xsl:choose>
<xsl:value-of select="information"/>
</xsl:for-each>
</td>
</tr>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="not(string-length(supplementaryDetails) = 0)">
<tr class="rowNormal">
<td width="4%"/>
<td colspan="8" width="96%" class="fixedWidth">
<xsl:value-of select="supplementaryDetails"/>
</td>
</tr>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="count(AccountStatementDetailAccountStatementFreeMessageDetail/list/AccountStatementFreeMessageDetail) > 0">
<tr class="rowNormal">
<td width="4%"/>
<td colspan="8" width="96%" class="fixedWidth">
<xsl:for-each select="AccountStatementDetailAccountStatementFreeMessageDetail/list/AccountStatementFreeMessageDetail">
<xsl:choose>
<xsl:when test="not(position() = 1)">
<br/>
</xsl:when>
</xsl:choose>
<xsl:value-of select="information"/>
</xsl:for-each>
</td>
</tr>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="ParentStatementDetailAccountStatementDetail/list">
<xsl:with-param name="tree"> \_ </xsl:with-param>
</xsl:apply-templates>
</xsl:for-each>
</xsl:template>
当我在我的Java代码中运行这个XSLT时,我得到一个XpathExpressionException,并显示错误消息:
引起:net.sf.saxon.trans.XPathException:必需的项类型 &#39; /&#39;的第一个操作数是node();提供的值具有项类型xs:string
通过一些调试我发现以下错误代码,我查找了一些信息并添加它:
错误:XPTY0019
It is a type error if the result of a step (other than the last step) in a path expression contains an atomic value.
如果我对,我使用的唯一原子价值是:&#34; $ accountStatement / account / Account / currency&#34;。
但这有什么不妥?