如何在XSL中区分两个模板?

yeg*_*256 2 xml xslt

这就是我在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>
Run Code Online (Sandbox Code Playgroud)

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

Ode*_*ded 5

使用该mode属性.

<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>
Run Code Online (Sandbox Code Playgroud)