I would love to know too! I just was given the specification and that's what they wanted. The "root" thing was the missing link and although i'd solved this another way, it helped in another change that was asked!
Is there a way to see the XML that the XSLT is actually using? It seems a bit black magic as to what you get and what xsl to write.
Creating a sitemap - multiple root levels
I need to make a slightly different style sitemap. Basically the site structure is this:
This was a requirement, hence everything is not under the "homepage" page.
There could be more than the two levels, so would like it to be recursive.
Basically all I want is some xslt to do this
FOR EACH ROOT NODE
Display Node(Root)
NEXT
Display Node(Root)
<li>
<a href=NiceUrl()><h2>Node Name</h2></a>
FOR EACH ChildNode
Display node(child)
NEXT
</li>
I can work out the child node part, but really strugling to find something to get all root nodes
ancestor-or-self only seems to return a single top level node...
Thanks in advance!
Had an error editing this post (xslt error, it really is out to get me...)
This is for Umbraco 4.5 :-)
I'm not sure I would like to code a website with that structure, maybe will cause more trouble than it's worth.
However if that is how it has to stay, you should be able to work from the root node, like this
Rich
Will this return the set of nodes, so will be able to loop through? all the root pages?
Hi Simon,
Use the standard Umbraco SiteMap XSLT and change the following line
<xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level=1]"/>
to
<xsl:with-param name="parent" select="$currentPage/ancestor-or-self::root/*"/>
Not sure I understand what you're trying to do 100% so let me know if this works.
On a side note - I'd be interested to know why you have had to structure the site in the way you have.
Rich
I would love to know too! I just was given the specification and that's what they wanted. The "root" thing was the missing link and although i'd solved this another way, it helped in another change that was asked!
Is there a way to see the XML that the XSLT is actually using? It seems a bit black magic as to what you get and what xsl to write.
Many thanks
What was the other way you used to solve it out of curiosity?
Simon,
You can view the xml by going to App_Data and opening the umbraco.config file.
It's definitely a great learning tool.
Glad you got it sorted
Rich
is working on a reply...