Well with XSLT/XPath 2.0 you could create an xs:dateTime(foo) and then use methods like format-dateTime
http://www.w3.org/TR/xslt20/#function-format-dateTime.
Code:
<xsl:template match="foo">
<xsl:value-of select="format-dateTime(xs:dateTime(.), '[M01][D01][Y0001]')"/>
</xsl:template>
With XSLT/XPath 1.0 you will need to use string functions e.g.
concat(substring(foo, 6, 2), substring(foo, 9, 2), substring(foo, 1, 4))