﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration ="yes" indent ="no"/>
    <xsl:template match="/">
        <xsl:variable name ="DivID" select ="normalize-space(AjaxRequest/Params/DivID)"></xsl:variable>
        <xsl:variable name="WorkoutItemID" select="AjaxRequest/Params/ItemID"></xsl:variable>
        <xsl:variable name="ItemID" select="AjaxRequest/ActiveGoals/SourceItemID"></xsl:variable>
        <xsl:variable name="TypeID" select="AjaxRequest/ActiveGoals/SourceItemType"></xsl:variable>
        <xsl:variable name="ResponsibleID" select="AjaxRequest/ActiveGoals/ResponsibleID"></xsl:variable>
        <xsl:variable name="SelectedDate" select="AjaxRequest/Params/SelectedDate"></xsl:variable>
        <xsl:variable name="Mode" select="AjaxRequest/Params/Mode"></xsl:variable>
        <div id="divPlanner_GoalList" style="height: 250px;overflow-x: scroll">
            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td>
                        <div style="padding-left:10px;">
                            <xsl:choose>
                                <xsl:when test="count(AjaxRequest/ActiveGoals/Items)&gt;0">
                                    <xsl:for-each select ="AjaxRequest/ActiveGoals/Items[not(following::LifeSpaceID = LifeSpaceID)]">
                                        <xsl:variable name="LifeSpaceID" select="LifeSpaceID"></xsl:variable>

                                        <div class="seperatorLine">
                                            <span class="labelBoldItalic" style="color:#003366;">
                                                <xsl:value-of select="LifeSpaceName"/>
                                            </span>
                                        </div>
                                        <div id="divPlanner_GoalList_{GoalID}" style="display:block;margin-bottom:20px;">
                                            <xsl:for-each select ="../Items[LifeSpaceID = $LifeSpaceID]">
                                                <div id="divPlanner_{GoalID}">
                                                    <span class="link" onclick='DisplayWorkoutPrograms("div_item_0_SummaryType",
                                                                "div_item_0_ActionType",
                                                                "lbl_Item_0_Sibling_Title",
                                                                "{$DivID}",
                                                                "{GoalID}","{$ResponsibleID}","0","Planner","{$SelectedDate}")'>
                                                        <xsl:value-of select ="GoalName"/>
                                                    </span>
                                                </div>
                                            </xsl:for-each>
                                        </div>
                                    </xsl:for-each>
                                </xsl:when>
                            </xsl:choose>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </xsl:template>
</xsl:stylesheet>
