This has got to be a simple one but I just can't get it. I'm trying to add a class of 'tree' to just the first <ul> tag in my multilevel sitemap. The code I have so far is this:
In your example you are passing in nodes where @level = 1 so it will never equal Zero :)
What you can do is fix that ;-)
Or...
One way you can do this is pass into your drawNodes function another
parameter, which is only passed in from the main template and not when
the function calls itself.
Add class to first item in WebSitemap XSLT list
Hi,
This has got to be a simple one but I just can't get it. I'm trying to add a class of 'tree' to just the first <ul> tag in my multilevel sitemap. The code I have so far is this:
I've added the line:
But this hasn't worked. It doesn't error but it just doesn't add the class at all.
Any ideas anyone?
Hi Dan,
In your example you are passing in nodes where @level = 1 so it will never equal Zero :)
What you can do is fix that ;-)
Or...
One way you can do this is pass into your drawNodes function another parameter, which is only passed in from the main template and not when the function calls itself.
Add:
Then check for it:
Cheers,
Chris
Try testing for the level of the parent - if it's level one then add your class
Parent node is from level 1, so you can never get to a node having level = 0 using the code above.
Cheers,
/Dirk
Thanks Chris, regarding the first solution, I've tried changint this to:
But this doesn't work either. I'm absolutely useless at XSLT (as you might have gathered!) so I appreciate your patience!
I also tried the second solution but I get an error - presumably because the new parameter is defined in the wrong place?
Thanks
Dan's solution works a treat. Thanks everyone.
is working on a reply...