以下是我的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"/>
希望问题已经清楚。也许我尝试做的事情是不可能的?谢谢。