Count child nodes and choose whether to display parent
This is a bit hard to describe ... I'm starting to wonder if I've "designed" it completely wrong!?
There are Members and there are Categories. A Member can belong to 1 or more Categories.
The Categories are defined as individual nodes under a parent (id = 1102). Members are defined as nodes under another parent (id = 1097). These two parents are at the same level (underneath "home"). I have created a "Member Categories" datatype using an "Ultimate Picker" pointed at node 1102.
I have a page that displays the list of Categories and is pointed at / starts at node 1102.
So far so good.
Now then, what I would like to do is only show Categories that have Members assigned. I can manage to get a count by calling a sub template, but I can't figure out how to actually act on the result. I.e. only display the Category title / link if the count of Members is > 1.
Here is the XSLT I have so far. The "countNodes" template correctly (I think!) counts the assigned Members and that value is output to the page.
The question is, how do I skip displaying anything for those where the count is zero?
Count child nodes and choose whether to display parent
This is a bit hard to describe ... I'm starting to wonder if I've "designed" it completely wrong!?
There are Members and there are Categories. A Member can belong to 1 or more Categories.
The Categories are defined as individual nodes under a parent (id = 1102). Members are defined as nodes under another parent (id = 1097). These two parents are at the same level (underneath "home"). I have created a "Member Categories" datatype using an "Ultimate Picker" pointed at node 1102.
I have a page that displays the list of Categories and is pointed at / starts at node 1102.
So far so good.
Now then, what I would like to do is only show Categories that have Members assigned. I can manage to get a count by calling a sub template, but I can't figure out how to actually act on the result. I.e. only display the Category title / link if the count of Members is > 1.
Here is the XSLT I have so far. The "countNodes" template correctly (I think!) counts the assigned Members and that value is output to the page.
The question is, how do I skip displaying anything for those where the count is zero?
[code]
]>
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
[/code]
is working on a reply...