gpt4 book ai didi

xml - 如何区分 XSL 中的两个模板?

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

这就是我在 XSL 中尝试做的事情:

<xsl:apply-templates select="document('a.xml')//row"/>
<xsl:apply-templates select="document('b.xml')//row"/>

<xsl:template match="row">
<!-- for document a.xml -->
</xsl:template>

<xsl:template match="row">
<!-- for document b.xml -->
</xsl:template>

由于显而易见的原因,不能像现在这样工作。如何区分这两个模板?文档 a.xmlb.xml 在 XML 结构方面完全相同。

最佳答案

使用 mode attribute .

<xsl:apply-templates select="document('a.xml')//row" mode="a"/>
<xsl:apply-templates select="document('b.xml')//row" mode="b"/>

<xsl:template match="row" mode="a">
<!-- for document a.xml -->
</xsl:template>

<xsl:template match="row" mode="b">
<!-- for document b.xml -->
</xsl:template>

关于xml - 如何区分 XSL 中的两个模板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6116912/

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