That's fantastic, thanks a lot guys.
The only minor things I need to resolve now are how to cater for scoreâs that are the same. So if 2 players have the same time then they should get the same medal. I couldn't see a way to use sort to resolve this so will I'll have to check each score manually?
The other issue is that I've changed the xml to have 2 score tags per player for some events but not all <record-score-a> and <record-score-b>.
Which lead me to create a record-tag variable but I was having trouble passing this between templates as it's value get's cleared.
Example below:
.
.
.
<xsl:template match="records">
<xsl:variable name="tag-name">
<xsl:choose>
<xsl:when test="@type = 'Type2'">record-score</xsl:when>
<xsl:when test="@type = 'Type3'">record-mixed</xsl:when>
<xsl:otherwise>recordAB</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:apply-templates select="events/event">
<xsl:with-param name="record-tag">$tag-name</xsl:with-param>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="events/event">
<xsl:param name="record-tag"/>
<xsl:choose>
<xsl:when test="$record-tag = 'recordAB'">
<xsl:apply-templates select="player">
<xsl:sort data-type="number" order="{$sortDirection}" select="record-score-a"/>
</xsl:apply-templates>
<xsl:apply-templates select="player">
<xsl:sort data-type="number" order="{$sortDirection}" select="record-score-b"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="player">
<xsl:sort data-type="number" order="{$sortDirection}" select="$record-tag"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
.
.
.
Any further help would be much appreciated.
Ally
|