-
-
Save vlad-ghita/4547378 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<data> | |
<current-game-rules> | |
<section id="9" handle="rules">Rules</section> | |
<entry id="12"> | |
<rule-brief handle="eat-a-serving-of-fruits-or-veggies">Eat fruits or veggies</rule-brief> | |
<points handle="1">1</points> | |
<game-link> | |
<item id="9" handle="2013-01-12-19-04-00" section-handle="games" section-name="Games">2013-01-12 19:04:00</item> | |
</game-link> | |
<date-created iso="2013-01-12T19:07:00-06:00" time="19:07" weekday="6" offset="-0600">2013-01-12</date-created> | |
</entry> | |
<entry id="11"> | |
<rule-brief handle="exercise-for-30-minutes">Exercise</rule-brief> | |
<points handle="2">2</points> | |
<game-link> | |
<item id="9" handle="2013-01-12-19-04-00" section-handle="games" section-name="Games">2013-01-12 19:04:00</item> | |
</game-link> | |
<date-created iso="2013-01-12T19:06:00-06:00" time="19:06" weekday="6" offset="-0600">2013-01-12</date-created> | |
</entry> | |
</current-game-rules> | |
<member-activity> | |
<section id="10" handle="activity">Activity</section> | |
<entry id="84"> | |
<member-link> | |
<item id="7" handle="jesse" section-handle="members" section-name="Members">Jesse</item> | |
</member-link> | |
<game-link> | |
<item id="9" handle="2013-01-12-19-04-00" section-handle="games" section-name="Games">2013-01-12 19:04:00</item> | |
</game-link> | |
<rule-link> | |
<item id="12" handle="eat-a-serving-of-fruits-or-veggies" section-handle="rules" section-name="Rules">Eat a serving of fruits or veggies</item> | |
</rule-link> | |
<date-created iso="2013-01-16T00:00:00-06:00" time="00:00" weekday="3" offset="-0600">2013-01-16</date-created> | |
</entry> | |
<entry id="81"> | |
<member-link> | |
<item id="7" handle="jesse" section-handle="members" section-name="Members">Jesse</item> | |
</member-link> | |
<game-link> | |
<item id="9" handle="2013-01-12-19-04-00" section-handle="games" section-name="Games">2013-01-12 19:04:00</item> | |
</game-link> | |
<rule-link> | |
<item id="11" handle="exercise-for-30-minutes" section-handle="rules" section-name="Rules">Exercise for 30 minutes</item> | |
</rule-link> | |
<date-created iso="2013-01-16T00:00:00-06:00" time="00:00" weekday="3" offset="-0600">2013-01-16</date-created> | |
</entry> | |
<entry id="79"> | |
<member-link> | |
<item id="7" handle="jesse" section-handle="members" section-name="Members">Jesse</item> | |
</member-link> | |
<game-link> | |
<item id="9" handle="2013-01-12-19-04-00" section-handle="games" section-name="Games">2013-01-12 19:04:00</item> | |
</game-link> | |
<rule-link> | |
<item id="12" handle="eat-a-serving-of-fruits-or-veggies" section-handle="rules" section-name="Rules">Eat a serving of fruits or veggies</item> | |
</rule-link> | |
<date-created iso="2013-01-16T00:00:00-06:00" time="00:00" weekday="3" offset="-0600">2013-01-16</date-created> | |
</entry> | |
</member-activity> | |
</data> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:exsl="http://exslt.org/common" | |
exclude-result-prefixes="exsl"> | |
<xsl:output method="xml" indent="yes" /> | |
<xsl:template match="/data"> | |
<!-- Get points for each activity --> | |
<xsl:variable name="points-per-activity"> | |
<xsl:for-each select="member-activity/entry"> | |
<points> | |
<xsl:value-of select="/data/current-game-rules/entry[@id = current()/rule-link/item/@id]/points"/> | |
</points> | |
</xsl:for-each> | |
</xsl:variable> | |
<xsl:text>Total Score: </xsl:text> | |
<!-- Use sum() function to find the total --> | |
<xsl:value-of select="sum(exsl:node-set($points-per-activity)/points)"/> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment