xml – 如何获取当前节点变量的父节点元素?
发布时间:2020-12-16 23:00:03 所属栏目:百科 来源:网络整理
导读:以下是我的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 nam
以下是我的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"/> 希望问题很清楚. 也许我想要做的是不可能的? 谢谢, 解决方法
只需使用: $currentPageBranchVariable/.. 这将选择$currentPageBranchVariable中包含的所有节点(在这种情况下只有一个)的父节点(每个节点). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ios – 如何将NSMutableArray添加到NSMutableArray Objecti
- objective-c – 在XCode中为多个目标添加编译标志
- Hacking Team数据中惊现第二枚Flash 0day漏洞
- Hirundo:在 OS X 上轻松获取 Swift 邮件列表
- flex中的endpoint
- c# – 使用crypt32.dll创建签名证书
- 设计模式六大原则(3):依赖倒置原则
- iphone – 左侧的PushViewController – 简单?
- Cocos2dx 中的CCCallFunc,CCCallFuncN,CCCallFuncND,CCCall
- 单元测试(1)--对xml进行对比