If I run this stylesheet:
Code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xxx="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:variable name="d">
<xsl:analyze-string select="normalize-space(TD[position()=1])" regex="(\d*)/(\d*)/(\d\d\d\d)">
<xsl:matching-substring>
<xsl:value-of select="concat(regex-group(3),'-',regex-group(1),'-',regex-group(2))"/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:variable>
<xsl:template match="/">
<change>
<xsl:attribute name="when"><xsl:value-of select="$d"/></xsl:attribute>
</change>
</xsl:template>
</xsl:stylesheet>
against this input
Code:
<TD>8/11/2013 10:01:21</TD>
I get this output:
Code:
<change when="2013-8-11 10:01:21"/>
So you're almost there; the only thing that remains is to add the leading zeros, which you can do by changing the value-of instruction to
Code:
<xsl:value-of select="concat(format-number(number(regex-group(3)), '00'),'-',
format-number(number(regex-group(1)), '00'),'-',regex-group(2))"/>
and if you don't want the time included in the result, then remove the value-of instruction within xsl:non-matching-substring.