简体   繁体   English

CMS umbraco-XSL后代

[英]CMS umbraco - xsl descendant

I have a page with a folder and links inside 我有一个带有文件夹和链接的页面

-FirstPage
  +folder
  -page
  -page
  -folder
    -link1
    -link2
    -link3
  -page

I want to reach the link1,link2,link3 in the tree. 我想到达树中的link1,link2,link3。 My current page is FirstPage. 我当前的页面是FirstPage。 How do I do that?? 我怎么做?? This is the xsl i wrote and he give me the first link in the top folder 这是我写的xsl,他给我顶层文件夹中的第一个链接

<xsl:template match="/">
<xsl:for-each select="$currentPage/descendant-or-self::* [@isDoc][@level=2]">
<xsl:if test="count(current()/descendant::* [@isDoc]) &gt; 0">
<xsl:variable name="descendantPage" select="current()/descendant::* [@isDoc]"/>   
<xsl:value-of select="$descendantPage/text"/>
</xsl:if>
</xsl:for-each>
</xsl:template>

Thank you for your help. 谢谢您的帮助。

edit:new xsl I use... 编辑:我使用的新xsl ...

<xsl:variable name="fId" select="number(1395)" />
<xsl:variable name="linksFolder" select="$currentPage/descendant-or-self::* [@isDoc][@level=2][@id='$fId']">
<xsl:template match="/">
  <xsl:for-each select="$linksFolder/* [@isDoc]">
    <xsl:value-of select="./text">
  </xsl:for-each>
</xsl:template>

How can i avoid to use a output (like the id of the folder) to get the folder i want to? 如何避免使用输出(例如文件夹的ID)来获取我想要的文件夹? Thanks for your help... 谢谢你的帮助...

There are lots of helpful tips & tricks in the Umbraco WikiBook online ( http://en.wikibooks.org/wiki/Umbraco/Various_useful_XSLT_methods_in_Umbraco ). 在线Umbraco WikiBook( http://en.wikibooks.org/wiki/Umbraco/Various_useful_XSLT_methods_in_Umbraco )中有很多有用的提示和技巧。 You can use the doc type of the folder node to find the links (instead of the id). 您可以使用文件夹节点的doc类型来查找链接(而不是id)。

For example looping round all nodes of a certain doc type (linkFolderDocType): 例如,循环处理某个文档类型(linkFolderDocType)的所有节点:

<xsl:for-each select="$currentPage/ancestor-or-self::root//node [@nodeTypeAlias='linkFolderDocType']">
  <xsl:value-of select="./text">
</xsl:for-each>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM