下面我试图匹配某些节点。XSLT:在当前处理方式下使用不同的处理方式
<xsl:template match="nodes">
<element>
<xsl:apply-templates select="nodes" mode="different" />
</element>
</xsl:template>
现在,对于相同的节点有多种处理方式。我想用这种不同的方式处理内目前的处理方式。这就是为什么我执行apply-templates
在同一选择,这是nodes
,但mode
现在是不同的。
这里是如何的不同模式可能看起来像:
<xsl:template match="nodes" mode="different">
<!-- another way of processing these nodes -->
</xsl:template>
现在,这是行不通的。只处理第一种类型的处理,简单地不应用apply-templates
调用。
更有点特殊:
<xsl:template match="Foundation.Core.Association.connection">
<xsl:for-each select="Foundation.Core.AssociationEnd">
<someElement>
<xsl:apply-templates select="Foundation.Core.Association.connection" mode="different" />
</someElement>
</xsl:for-each>
</xsl:template>
正如你所看到的,我选择Foundation.Core.Association.connection
。当然这是错误的,但是如何在给定当前元素和位置的情况下引用这个元素?鉴于德里克的评论,这应该做到这一点。
我在做什么错,我怎样才能得到我想用XSLT?有什么可以解决这个问题的另一种方法?
谢谢。
你的xml是什么样的? – derek 2010-05-03 15:18:54
xml输入是非常复杂的..我使用for-each中的for-each,并且需要使用属性从第一个for-each在我的第二个for-each .. – 2010-05-03 15:21:30