【发布时间】:2012-02-14 23:40:50
【问题描述】:
下面是我的xslt:
<xsl:template match="/">
<xsl:call-template name="generateLinks">
<xsl:with-param name="currentPageBranchVariable" select="//Item[@CurrentPageBranch='true']"></xsl:with-param>
</xsl:call-template>
</xsl:template>
还有:
<xsl:template name="generateLinks">
<xsl:param name="currentPageBranchVariable"></xsl:param>
<xsl:value-of select="$currentPageBranchVariable/@FullName"/>
// how to get the parent node of $currentPageBranchVariable?
</xsl:template>
可以看出,$currentPageBranchVariable 是包含 Item 节点的第二个模板的变量。
如何从那里获取其父元素?
我尝试了以下方法,但没有成功:
<xsl:value-of select="../$currentPageBranchVariable/@FullName"/>
<xsl:value-of select="parent::node()/$currentPageBranchVariable/@FullName"/>
<xsl:value-of select="parent($currentPageBranchVariable)/@FullName"/>
希望问题很清楚。
也许我想做的事情是不可能的?
谢谢,
【问题讨论】: