Note that I've included three ways of getting to the "News" node - the best way is the one using the DocumentType Alias, but we can't know that from your screenshot, so it's commented out. But it's the one that'll work even if the client decides to change the name of the node (or if the macro should work in multiple language versions).
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="umbraco.library"
>
<xsl:output method="hml" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="currentPage" />
<!-- Find the topmost node regardless of where the macro runs -->
<xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
<!-- Find the News node by DocumentType Alias -->
<!-- <xsl:variable name="newsRoot" select="$siteRoot/News" /> -->
<!-- Find the News node by its name -->
<xsl:variable name="newsRoot" select="$siteRoot/*[@nodeName = 'News']" />
<!-- Find the News node by id -->
<!-- <xsl:variable name="newsRoot" select="$siteRoot/*[@id = 1234]" /> -->
<xsl:template match="/">
<!-- Process all the News node's children (that are not hidden) -->
<xsl:apply-templates select="$newsRoot/*[@isDoc][not(umbracoNaviHide = 1)]" />
</xsl:template>
<!-- Generic template for any document -->
<xsl:template match="*[@isDoc]">
<p>
<xsl:value-of select="@nodeName" />
</p>
</xsl:template>
</xsl:stylesheet>
Wanna Get Children Nodes Of A Child Of The Parent From The Parent Page
I need to fet all the children of News Node While Staying in The Top Most Parent?
any help?
Hi Hudhaifa,
Here's the basics of doing something like that:
Note that I've included three ways of getting to the "News" node - the best way is the one using the DocumentType Alias, but we can't know that from your screenshot, so it's commented out. But it's the one that'll work even if the client decides to change the name of the node (or if the macro should work in multiple language versions).
/Chriztian
is working on a reply...