1
votes

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. My current page is FirstPage. How do I do that?? This is the xsl i wrote and he give me the first link in the top folder

<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: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? Thanks for your help...

1
It depends, is there only ever one folder of links, or can there potentially be many folders of links?Tim
Hi Tim, For the FirstPage this will be the only folder of links. But said that a page inside the tree can have a different folder of links. I will be glad to learn the two methods you are thinking of.Benjamin

1 Answers

0
votes

There are lots of helpful tips & tricks in the Umbraco WikiBook online (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).

For example looping round all nodes of a certain doc type (linkFolderDocType):

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