I am unsure how to go about this, initially I set postCount as a generic property for a thread and incremented this each time a comment was created within the thread but realise this is not ideal (if a comment is deleted, for example).
So my question is, is there an easy way to get a count of child nodes for a given node and would this be best achieved by using xslt?
Count the child nodes for a thread item
I am unsure how to go about this, initially I set postCount as a generic property for a thread and incremented this each time a comment was created within the thread but realise this is not ideal (if a comment is deleted, for example).
So my question is, is there an easy way to get a count of child nodes for a given node and would this be best achieved by using xslt?
Hi Bob
You can count anything in XSLT - e.g., to count the childnodes of the currentPage you can do this:
To count all nodes of the document type "BlogComment" below, regardless of hierarchy, just do:
/Chriztian
thanks Chriztian,
I will keep this answer for reference but as I am displaying the said data in an ASP.NET repeater I have decided to update the post count with
parentThread.getProperty("postCount").Value = parentThread.Children.Count();
for now. Although ideally maybe I could fit your solution into the repeater somehow.. ?
is working on a reply...