Developer forum
E-mail notifications
Get only active child nodes
Posted on 22/09/2009 08:55:44
When doing an xslt menu I whant to check if the node has any child nodes that are avtive and should be included in the menu. I have used the @ChildCount but it counts all nodes regardless of if the are to be included in the menu or not.
How can I count only active child nodes?
Replies
Posted on 14/10/2009 18:55:20
Hi Paul
You can do like this '.[page[@Active='True']]'
This checks if the current node has page-childnodes with a True Active attribute.
// Sebastian
You can do like this '.[page[@Active='True']]'
This checks if the current node has page-childnodes with a True Active attribute.
// Sebastian
Posted on 15/02/2010 17:06:57
Hi
Sorry to sneak in like this... we have the same problem with our DD-menu.
We tried something like <xsl:if test="@ChildCount > '0' and .[page[@Active='True']]' ">,
but got one of those horrible xslt errors, could you spell it out for us please?
My XSLT knowledge is pretty mediocre.
-thanks
Sorry to sneak in like this... we have the same problem with our DD-menu.
We tried something like <xsl:if test="@ChildCount > '0' and .[page[@Active='True']]' ">,
but got one of those horrible xslt errors, could you spell it out for us please?
My XSLT knowledge is pretty mediocre.
-thanks
Posted on 22/02/2010 11:07:36
Try it like this:
<xsl:if test="@ChildCount > '0' and .[Page[@Active='True']]">
Translation: Test if the attribute ChildCount of the current element is greater than 0, and if the current element has any childnodes named Page where the Active attribute is True
Or like this:
<xsl:if test="Page[@Active='True']">
Translation: Check if the current element has any childnodes named Page where the attribute Active is true
These 2 examples if's should check for the exact same thing though example 2 is a lot more simple.
<xsl:if test="@ChildCount > '0' and .[Page[@Active='True']]">
Translation: Test if the attribute ChildCount of the current element is greater than 0, and if the current element has any childnodes named Page where the Active attribute is True
Or like this:
<xsl:if test="Page[@Active='True']">
Translation: Check if the current element has any childnodes named Page where the attribute Active is true
These 2 examples if's should check for the exact same thing though example 2 is a lot more simple.
You must be logged in to post in the forum