From the current page, go up until you hit the root, then go one level down to a node type of PageBanners and then count all the immediate children of this node.
This returns a count of 5 when there are only 3 children.
This really confuses me, I have tried re-publishing the entire site, still says there are 5 children.
If I change the select statement to the following it returns a count of 3, PageBanner is the only type allowed under the PageBanners node and only has 3 items in.
xslt not giving correct count response
I have the following xslt expression
My understanding of this is as follows:
From the current page, go up until you hit the root, then go one level down to a node type of PageBanners and then count all the immediate children of this node.
This returns a count of 5 when there are only 3 children.
This really confuses me, I have tried re-publishing the entire site, still says there are 5 children.
If I change the select statement to the following it returns a count of 3, PageBanner is the only type allowed under the PageBanners node and only has 3 items in.
Can someone please explain why my initial statement is returning a count of 5??
Thanks in advance.
Jim
First one is counting root node and PageBanners node along with each pagebanner node due to *
I thought it might be doing something like that but thought that would be wrong....
Surely if you used that statement in a foreach, you would only iterate 3 times, not 5??
Can you try count($currentPage/ancestor::root/PageBanners/*[@isDoc])?
It could be counting the fields within the nodes, and not just the nodes themselves. I could be wrong though, so it may be worth a test.
is working on a reply...