Xslt 返回特定类型的子节点及其属性(Umbraco)
我正在尝试编写一些XSLT,基本上应该经过以下算法:Xslt 返回特定类型的子节点及其属性(Umbraco),xslt,umbraco,nodes,Xslt,Umbraco,Nodes,我正在尝试编写一些XSLT,基本上应该经过以下算法: if child of current node is of type Accordion if child of Accordion node is of type AccordionItem take the AccordionItem's title and content and display in <div> tags end if end if 如果当前节点的子节点是Accordio
if child of current node is of type Accordion
if child of Accordion node is of type AccordionItem
take the AccordionItem's title and content and display in <div> tags
end if
end if
如果当前节点的子节点是Accordion类型
如果Accordion节点的子节点的类型为AccordionItem
获取手风琴项目的标题和内容,并显示在标记中
如果结束
如果结束
这看起来很直截了当,但我目前拥有的代码似乎没有发挥应有的作用。我肯定错过了什么,但我不知道到底是什么。到目前为止,我的XSLT代码如下:
<xsl:for-each select="$currentPage/ancestor-or-self::Home//AccordionItem[@isDoc]">
<div id="accordion">
<h3><a href='#'><xsl:value-of select="accordionItemTitle"/></a></h3>
<div><xsl:value-of select="accordionItemContent" disable-output-escaping="yes" />
</div>
</div>
</xsl:for-each>
有没有人能提供一些建议,解释为什么这样做不正确?提前感谢 您的XPath似乎不像您在算法中定义的那样运行,并且正在导航到类型为
Home
的节点,这是有意的吗
如果没有,请尝试将XPath修改为以下内容:
我有一种感觉,就是这样。非常好用,非常感谢!