I'm using a simple preceding statement to get a unique list of category names from a list of pages, however its not working as I'd expect. I have some data with an alias of 'productGroup' assigned to some nodes. When I do the preceding check to do the group by, it appears to be picking up ALL pages in the entire section, not just the ones under the current page for some reason.
It checks not only the preceding nodes underneath the current page, but the other nodes in other sections as well. Does anyone have any ideas why its doing this?
You should have a look at the difference between the preceding:: axis and the preceding-sibling:: axis - they yield very different results, and it seems you're using the first, when you actually mean to use the latter.
Using Preceding in XSLT For Group By
Hi,
I'm using a simple preceding statement to get a unique list of category names from a list of pages, however its not working as I'd expect. I have some data with an alias of 'productGroup' assigned to some nodes. When I do the preceding check to do the group by, it appears to be picking up ALL pages in the entire section, not just the ones under the current page for some reason.
So if I have:
$currentPage/node/data [@alias = 'productGroup'] [not(.=preceding::node/data [@alias = 'productGroup'])]
It checks not only the preceding nodes underneath the current page, but the other nodes in other sections as well. Does anyone have any ideas why its doing this?
I didn't even know you could do that! Learn something new everyday (Or in the case of XSLT every hour!)
How about this:
Thanks Morten, that did the trick!
:)
Hi Tim,
You should have a look at the difference between the preceding:: axis and the preceding-sibling:: axis - they yield very different results, and it seems you're using the first, when you actually mean to use the latter.
So probably:
/Chriztian
Doh, why didn't I think of that?
is working on a reply...