106jackie628wariner635
New Member
Extending this question...I have an XML feed that represents start and end times of presentation in the format: 2012-06-06 10:45, with each of those nodes being represented in this manner:<session id="9c4716c71f" name="Fault Handling" starttime="2012-06-06 10:45" endtime="2012-06-06 12:45" location="" chair="">In the previous question I only cared about grouping by times, however now I want to group all of these on the date as well (June 6th, 2012).So, ideally, I would have output that is grouped first by date, and then by time (as I will show in the following bits of code).I have a template that I apply in order to display that portion:<!-- formatting dateTime --><xsl:template name="formatDate"> <xslaram name="dateTime" /> <xsl:variable name="date" select="substring-before($dateTime, ' ')" /> <xsl:variable name="year" select="substring-before($date, '-')" /> <xsl:variable name="month" select="number(substring-before(substring-after($date, '-'), '-'))" /> <xsl:variable name="day" select="number(substring-after(substring-after($date, '-'), '-'))" /> <!-- output --> <xsl:choose> <xsl:when test="$month = '1'">January</xsl:when> <xsl:when test="$month = '2'">February</xsl:when> <xsl:when test="$month = '3'">March</xsl:when> <xsl:when test="$month = '4'">April</xsl:when> <xsl:when test="$month = '5'">May</xsl:when> <xsl:when test="$month = '6'">June</xsl:when> <xsl:when test="$month = '7'">July</xsl:when> <xsl:when test="$month = '8'">August</xsl:when> <xsl:when test="$month = '9'">September</xsl:when> <xsl:when test="$month = '10'">October</xsl:when> <xsl:when test="$month = '11'">November</xsl:when> <xsl:when test="$month = '12'">December</xsl:when> </xsl:choose> <xsl:value-of select="' '" /> <xsl:value-of select="$day" /> <xsl:value-of select="', '" /> <xsl:value-of select="$year" /></xsl:template><!-- formatting dateTime --><xsl:template name="formatTime"> <xslaram name="dateTime" /> <xsl:value-of select="substring-after($dateTime, ' ')" /></xsl:template>and I apply it in this manner:<h4> <!-- output DD-MM-YYYY --> <xsl:call-template name="formatDate"> <xsl:with-param name="dateTime" select="@starttime" /> </xsl:call-template></h4>Now, I'm currently grouping based on the Muenchian method, and my code looks like this:<xsl:key name="sessions-by-track-name-starttime-and-endtime" match="/event/eventsub/track/session" use="concat(parent::track/@name, ' ', @starttime, ' ', @endtime)" />...<xsl:for-each select="key('sessions-by-track-name-starttime-and-endtime', concat(parent::track/@name, ' ', @starttime, ' ', @endtime))"> ...I would also like to group my output by date as well as time, so I need to somehow extend my previous method to include templatized output. Is it possible to somehow take the applied template and create a similar key?I can include further XML if necessary, but my question is more directed at how to generate a key based on a returned template value.