Hi, Im having some issues with looping and applying a list to my menu structure. I want to group the sub-pages into 5 items with a <ul> tag. So my html would be,
I've had a look through the forum to find something similar and found some xslt, which ive applied. But im getting some strange html output, with empty <ul> and <li> produced.
Loop & Group Navigation List - Mega Menu
Hi,
Im having some issues with looping and applying a list to my menu structure.
I want to group the sub-pages into 5 items with a <ul> tag. So my html would be,
I've had a look through the forum to find something similar and found some xslt, which ive applied.
But im getting some strange html output, with empty <ul> and <li> produced.
Any help would be grateful.
The XSLT that Ive added is:
My full XSLT is
There're several way to do it. Personally I usually do it with such a snippet (I'm skipping the outer <ul> and so on for brevity) :
I hope it will help.
Thanks Rodion, Im getting a little lost on the xslt. Im just getting to grips with xslt.
Ive added the the following variables with the following code, but im getting an error
Missing mandatory attribute 'select'.
<xsl:variable name="nodes" select="$currentPage/ancestor-or-self::node"/>
<xsl:variable name="N" select="$nodes" />
<!-- DROP DOWN -->
Sorry. My fault. Rewrite both "xsl:value-of" as:
and
(Note apos around strings - they are important)
Also if you want to select all ancestor nodes up to the root from the current one you will need (if you use a new umbraco schema, as I suppose):
(i.e. node() not just node). Or even simpler just:
And yet another - "N" is supposed to be a desirable group size. So that in you case (5 items in a group) you will need:
Happy XSLT coding :-)
is working on a reply...