I. AN XSLT 1.0 solution using FXSL 1.x
This transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ext="http://exslt.org/common"
exclude-result-prefixes="ext"
>
<xsl:import href="strSplit-to-Words.xsl"/>
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/*">
<xsl:variable name="vDates">
<xsl:for-each select="node">
<nodeData name="{data[@alias = 'Show']}">
<xsl:call-template name="str-split-to-words">
<xsl:with-param name="pStr" select="data[@alias = 'Dates']"/>
<xsl:with-param name="pDelimiters"
select="','"/>
</xsl:call-template>
</nodeData>
</xsl:for-each>
</xsl:variable>
<xsl:apply-templates select="ext:node-set($vDates)/*/*[text()]">
<xsl:sort data-type="number" select="substring(.,7)"/>
<xsl:sort data-type="number" select="substring(.,4,2)"/>
<xsl:sort data-type="number" select="substring(.,1,2)"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="word">
<show>
<name>
<xsl:value-of select="../@name"/>
</name>
<date>
<xsl:value-of select="."/>
</date>
</show>
</xsl:template>
</xsl:stylesheet>
when applied on the provided "XML document", corrected to be well-formed (When will you, people, learn to provide a well-formed XML document? Is it that difficult?):
<t>
<node id="1">
<data alias="Show">ShowName1</data>
<data alias="Dates">21/04/2009,23/04/2009,27/04/2009,</data>
</node>
<node id="2">
<data alias="Show">ShowName2</data>
<data alias="Dates">22/04/2009,25/04/2009,29/04/2009,</data>
</node>
</t>
produces the wanted result:
<show>
<name>ShowName1</name>
<date>21/04/2009</date>
</show>
<show>
<name>ShowName2</name>
<date>22/04/2009</date>
</show>
<show>
<name>ShowName1</name>
<date>23/04/2009</date>
</show>
<show>
<name>ShowName2</name>
<date>25/04/2009</date>
</show>
<show>
<name>ShowName1</name>
<date>27/04/2009</date>
</show>
<show>
<name>ShowName2</name>
<date>29/04/2009</date>
</show>
II. One possible XSLT 2.0 solution:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/*">
<xsl:variable name="vAllData" as="xs:string+">
<xsl:for-each select="node">
<xsl:variable name="vName" select="data[@alias='Show']"/>
<xsl:for-each select=
"tokenize(data[@alias='Dates'], ',')[.]">
<xsl:value-of select="concat($vName, '+',.)"/>
</xsl:for-each>
</xsl:for-each>
</xsl:variable>
<xsl:for-each select="$vAllData">
<xsl:sort data-type="number" select=
"substring(substring-after(.,'+'),7)"/>
<xsl:sort data-type="number" select=
"substring(substring-after(.,'+'),4,2)"/>
<xsl:sort data-type="number" select=
"substring(substring-after(.,'+'),1,2)"/>
<show>
<name>
<xsl:value-of select="substring-before(.,'+')"/>
</name>
<date>
<xsl:value-of select="substring-after(.,'+')"/>
</date>
</show>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
When the above XSLT 2.0 transformation is applied on the same document, the same correct result is produced.