I'm wanting to show all of the nodes that have the property showAsQuickLink. Sofar I can get the nodes I need at the root or homepage level, however as soon as I get into the other pages it soes not return anything.
Can someone please help me out with the syntax please?
unable to show nodes when at lower levels
Hi There,
I'm wanting to show all of the nodes that have the property showAsQuickLink. So far I can get the nodes I need at the root or homepage level, however as soon as I get into the other pages it soes not return anything.
Can someone please help me out with the syntax please?
Thanks in advance.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="parent" select="$currentPage/*" />
<xsl:template match="/">
<xsl:variable name="maxLevel" select="4"/>
<ul>
<xsl:for-each select="$parent/* [@isDoc and string(showAsQuickLink) = '1']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Hi,
The problem appears to be that you are selecting all nodes under the current page, rather than all nodes under the root/home page.
Try changing the "$parent" variable to this. This will cause the loop to check all nodes under the root page, no matter which page you are on
Note if you have multiple level one nodes you will probably want to use this instead to start from the content root
Hope this helps,
Tom
Hi Tom,
this one worked. Thanks very much.
is working on a reply...