Skip to content

Instantly share code, notes, and snippets.

@TheJester12
Created January 16, 2013 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TheJester12/4547317 to your computer and use it in GitHub Desktop.
Save TheJester12/4547317 to your computer and use it in GitHub Desktop.
<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>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<xsl:variable name="totalscore" select="0"/>
<xsl:for-each select="/member-activity/entry">
<xsl:variable name="ruleid" select="rule-link/item/@id"/>
<xsl:variable name="worth" select="//current-game-rules/entry[@id = $ruleid]/points"/>
<xsl:variable name="totalscore" select="$totalscore + $worth"/>
</xsl:for-each>
<p><xsl:text>Total Score: </xsl:text><xsl:value-of select="$totalscore"/></p>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment