gpt4 book ai didi

xml - 你能在 xsl 的模板中调用模板吗

转载 作者:数据小太阳 更新时间:2023-10-29 02:00:55 26 4
gpt4 key购买 nike

你能在模板中调用模板吗?例如:

如果我想使用

<xsl:choose>
<xsl:when test="//*[local-name()='RetrieveCCTransRq']">
<xsl:call-template name="SOAPOutput"/>
</xsl:when>
</xsl:choose>

<xsl:template name="SOAPOutput">
<SOAP-ENV:Envelope>
<SOAP-ENV:Body>
<OutputPayload>
<TotalTransactions>
<xsl:value-of select="count(//Transaction)"/>
</TotalTransactions>
<Transactions>
<xsl:apply-templates/>
</Transactions>
</OutputPayload>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<xsl:template match="Transaction">
<xsl:choose>
<xsl:when test="contains(Type,'Debit')">
<Debit>
<xsl:apply-templates select="Date"/>
<xsl:apply-templates select="PostDate"/>
<xsl:apply-templates select="Description"/>
<xsl:apply-templates select="Amount"/>
</Debit>
</xsl:when>
<xsl:otherwise>
<Credit>
<xsl:apply-templates select="Date"/>
<xsl:apply-templates select="PostDate"/>
<xsl:apply-templates select="Description"/>
<xsl:apply-templates select="Amount"/>
</Credit>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="Date">
<Date>
<xsl:value-of select="."/>
</Date>
</xsl:template>

<xsl:template match="PostDate">
<PostDate>
<xsl:value-of select="."/>
</PostDate>
</xsl:template>

<xsl:template match="Description">
<Description>
<xsl:value-of select="."/>
</Description>
</xsl:template>

<xsl:template match="Amount">
<Amount>
<xsl:value-of select="."/>
</Amount>
</xsl:template>
</xsl:template>

最佳答案

您可以从另一个模板调用一个模板,您不能像您所做的那样嵌套模板定义。将所有内部模板定义移至顶层,然后重试。

关于xml - 你能在 xsl 的模板中调用模板吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3195624/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com