I need to point the macro somehow to read from a specific page structure ? My folders are as such
Root Webpage (only visible page) PollList Poll Group 1 (contains property "votes") Group 2 (contains property "votes") Group 3 (contains property "votes") Group 4 (contains property "votes")
i need to get the values from the groups (they contain a property with a numerial value) so how do i write the macro to pick up the values from all "pages" under the poll folder
none of these pages are visible its only the webpage itself that has a macro that shows the poll results - (a package i installed which unfortunately doesnt add up total value)
Macro = Adding values from different pages together
hey - pretty noobish with this here xslt
i got some pages that each have a value "votes"
i need to get all these values from every pages added together
is there a way to do that with a macro ? collect all values and add them together?
Hi Jan,
You can do that with the sum() function - something like this (assuming 'votes' is a property):
or, if you're using Umbraco 4.5:
It's a 'heavy' call because of the descendant axis, but having no further details regarding the structure, this is how you'd do it.
/Chriztian
I need to point the macro somehow to read from a specific page structure ?
My folders are as such
Root
Webpage (only visible page)
PollList
Poll
Group 1 (contains property "votes")
Group 2 (contains property "votes")
Group 3 (contains property "votes")
Group 4 (contains property "votes")
i need to get the values from the groups (they contain a property with a numerial value)
so how do i write the macro to pick up the values from all "pages" under the poll folder
none of these pages are visible its only the webpage itself that has a macro that shows the poll results - (a package i installed which unfortunately doesnt add up total value)
hope you can help thanx!
<xsl:for-each select="umbraco.library:GetXmlNodeById(1363)/node [string(data [@alias='umbracoNaviHide']) != '1']">
<xsl:value-of select="sum(//data[@alias = 'votes'])" />
</xsl:for-each>
this is what i have gotten so far - unfortunately it shows the results Each time for each vote type. need to only show it once
Hi again,
First, grab the nodes to summarize votes from in a variable:
Output sum of votes:
/Chriztian
Thanx a bunch Chriztian that did it
is working on a reply...