I would like to display the number of child pages on a parent page, i don't want any other data from them like page names or content or anything, i just want a macro to count the number of child pages and return a number on the parent page.
1) Peter: your example gives me three links to the three subpages, "link link link" not a number of how many pages there are "3". I used the "List subpages from a changeable source" macro as a template and replaced the line here: <xsl:value-of select="@nodeName"/> with your line of code.
2) Sebastiaan: your example gives me an error- "The variable or parameter 'level' is either not defined or it is out of scope." i copy/pasted your code into a clean macro and replaced the <!-- start writing XSLT --> with your code.
sorry for the hassle, i appreciate the help dudes!
Display number of child pages?
I would like to display the number of child pages on a parent page, i don't want any other data from them like page names or content or anything, i just want a macro to count the number of child pages and return a number on the parent page.
i.e.:
PAGE A "this page has three child pages"
-page1
-page2
-page3
PAGE B "this page has one child page"
-page4
Can anyone point me in a helpful direction?
TIA!
You could create a xslt-macro. Put something like this in the macro:
HTH,
Peter
In XSLT you can do something like this:
My solution actually lists all the subpages and their subpages, so if you have:
Page C
- page5
- page6
--page7
--page8
Then it will say there is 4 childpages.
Not sure if you will need this, but it could come in handy!
Thanks to both of you! a few questions though:
1) Peter: your example gives me three links to the three subpages, "link link link" not a number of how many pages there are "3". I used the "List subpages from a changeable source" macro as a template and replaced the line here: <xsl:value-of select="@nodeName"/> with your line of code.
2) Sebastiaan: your example gives me an error- "The variable or parameter 'level' is either not defined or it is out of scope." i copy/pasted your code into a clean macro and replaced the <!-- start writing XSLT --> with your code.
sorry for the hassle, i appreciate the help dudes!
Sebastian: i put this: <xsl:param name="level"/> in the macro and now it doesn't give an error, but it doesn't display anything :(
Matthew, sorry mate, I forgot to give you this as well:
Sebastian, thanks! :) here's what i ended up using:
this way i can choose which page i want the number of child pages counted from. awesome!
is working on a reply...