Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have the XSLT below which always create three levels of menu, always starting at a specific level. I want to change it so that:
If the current page (no matter how deep) has children, show PARENT / SELF / CHILDREN as the three levels.
If the current page (no matter how deep) has no children, show GRANDPARENT / PARENT / SELF as the three levels.
In both cases, never go any higher than the highest page using template=1165.
<?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:template match="/"> <xsl:if test="count($currentPage/ancestor-or-self::* [@template=1165 and string(umbracoNaviHide) != '1']) > 0"> <div class="block"> <xsl:for-each select="$currentPage/ancestor-or-self::* [@template=1165 and string(umbracoNaviHide) != '1']"> <h3> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </h3> </xsl:for-each> <ul class="products"> <xsl:for-each select="$currentPage/ancestor-or-self::* [@template=1165 and string(umbracoNaviHide) != '1']/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:variable name="subItems" select="umbraco.library:GetXmlNodeById(@id)/child::* [@isDoc and string(umbracoNaviHide) != '1']"/> <li> <xsl:if test="count($subItems)"> <xsl:attribute name="class">open</xsl:attribute> </xsl:if> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> <xsl:if test="count($subItems)"> <ul> <xsl:for-each select="$subItems"> <xsl:variable name="subSubItems" select="umbraco.library:GetXmlNodeById(@id)/child::* [@isDoc and string(umbracoNaviHide) != '1']"/> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> <xsl:if test="count($subSubItems)"> <ul> <xsl:for-each select="$subSubItems"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:for-each> </ul> </xsl:if> </li> </xsl:for-each> </ul> </xsl:if> </li> </xsl:for-each> </ul> </div> </xsl:if></xsl:template></xsl:stylesheet>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Help with dynamic XSLT for menus
I have the XSLT below which always create three levels of menu, always starting at a specific level. I want to change it so that:
If the current page (no matter how deep) has children, show PARENT / SELF / CHILDREN as the three levels.
If the current page (no matter how deep) has no children, show GRANDPARENT / PARENT / SELF as the three levels.
In both cases, never go any higher than the highest page using template=1165.
is working on a reply...