1
<row type="header">
<column>href</column>
<column>other</column>
</row>
<row type="data">
<column>a</column>
<column>b</column>
</row>
XSLT:(我确保我行[@类型=“数据”] /在模板列下面)
<xsl:template match="column" mode="panelTabsBody">
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="../../row[@type='header']/column[text()='href'][position()]" />
</xsl:attribute>
</a>
</td>
</xsl:template>
如何获得文本()等于href的列位置?如果更容易,我可以给列的值'href'一个属性。例如:<column type='link'>href</column>
编辑:
我尝试以下,但没有工作
XSLT:
<xsl:template match="column" mode="panelTabsBody">
<xsl:variable name="testt" select="count(../../row[@type='header']/column[text()='href']/preceding-sibling::column) + 1" />
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="../../row[@type='header']/column[position() = testt]" />
</xsl:attribute>
</a>
</td>
</xsl:template>
哇,这是一个愚蠢的错误。非常感谢。 – Grafit 2014-12-08 09:17:46