The XPath selector in the test attribute will select all child elements (*) of the current node of the for-each that have an isDoc attribute ([@isDoc]) and that hasn't got an umbracoNaviHide childnode set to 1 ([not(umbracoNaviHide = 1)]) - this always results in a nodeset (although it could be empty). Because this is a test attribute the final result will either be true() or false(), depending on the set containing any nodes.
So, it effectively checks to see if there are any childpages below the current.
Expand & Collapse Nav - Apply class if there is child nodes
Hi, Im having some trouble applying a class to an "a" tag for a collapse/expand nav.
Im trying to replicate the following jquery based nav...
http://www.mathachew.com/sandbox/collapsible-menu/
The problem im having is applying the "collapse" class to the "a" tag, only if there is child nodes.
Would be greatful if someone could help and steer me in the direct of a better way.
My xslt is...
Thanks
Martin
Hi.
should work I suppose. Since a nodeset evaluates to "true" if and only if it's not empty.
Hi Martin,
Create the <a> element like this:
(And remove the chunk right above where you use the count() function)
/Chriztian
- ah yes @Rodion, forgot to check if it was inside a for-each - this would be right, then (dot-slash isn't necessary here):
/Chriztian
Thanks guys,
Thats worked great.
Just for my learning, what is this line doing?
Martin
Hi Martin,
The XPath selector in the test attribute will select all child elements (*) of the current node of the for-each that have an isDoc attribute ([@isDoc]) and that hasn't got an umbracoNaviHide childnode set to 1 ([not(umbracoNaviHide = 1)]) - this always results in a nodeset (although it could be empty). Because this is a test attribute the final result will either be true() or false(), depending on the set containing any nodes.
So, it effectively checks to see if there are any childpages below the current.
Does that help?
/Chriztian
is working on a reply...