If a page, has one or more sub pages then a nested UL is created, This part is not working, I think the following line is the issue, but do not know how to rewrite the count test for the new schema.
<xsl:if test="count(node) > 0 and * [@isDoc][not(umbracoNaviHide = 1)]">
The result is equivalent to the upmost notation (only one pair of square brackets) but what you're actually saying is:
First, return me the set of nodes that has property "isDoc"
Second, refine this returned set by returning me the nodes of this set that not have an "umbracoNaviHide" property that is "1".
So although the result is the same, I would opt for the notation with one [ ] pair, because this actually tells the XSLT processor to only process nodes with a property "isDoc" and a property "umbracoNaviHide" that should not be "1" in one step.
This is because the result of a test attribute will be put through the boolean() function to return either true() or false() - since the boolean result of an empty node set is false() the test will work without having to count the nodes in the set.
@Thijs: I've done some testing on the case of using multiple predicates vs. a single predicate with and operators, which (using xsltproc on a MacBook Pro) suggests that the former (multiple predicates) is faster - but that's of course entirely up to the XSLT processor being used.
Well, that just shows why you should never just predict but always verify as well. Goes entirely against my gut-feeling, but I can't argue with plain and simple results. Although… xsltproc on a MBP? :) Thanks for the info.
Check for sub page, with new schema.
Hi All,
Still getting use to the new schema. The following is an old xslt which displays the main menu (got this part working).
If a page, has one or more sub pages then a nested UL is created, This part is not working, I think the following line is the issue, but do not know how to rewrite the count test for the new schema.
Thanks in advance,
Eddie
I think you would want to have something like:
By the way, when you're doing this (I'm referring to the bits with square brackets [ ] ):
The result is equivalent to the upmost notation (only one pair of square brackets) but what you're actually saying is:
Hi Eddie,
You actually don't need to do any counting for this to work - this will work with the new schema:
This is because the result of a test attribute will be put through the boolean() function to return either true() or false() - since the boolean result of an empty node set is false() the test will work without having to count the nodes in the set.
@Thijs: I've done some testing on the case of using multiple predicates vs. a single predicate with and operators, which (using xsltproc on a MacBook Pro) suggests that the former (multiple predicates) is faster - but that's of course entirely up to the XSLT processor being used.
/Chriztian
@Chriztian
Well, that just shows why you should never just predict but always verify as well. Goes entirely against my gut-feeling, but I can't argue with plain and simple results. Although… xsltproc on a MBP? :) Thanks for the info.
is working on a reply...