你的问题有点模糊.它需要一些样本输入和预期输出.但无论如何,这里是对你想要的最佳猜测的答案.
鉴于此输入:
<?xml version="1.0"?>
<dates>
<date>11/12/2012</date>
<date>3/4/2011</date>
</dates>
Run Code Online (Sandbox Code Playgroud)
......由这个样式表转换......
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="dates">
<xsl:copy>
<xsl:apply-templates select="*" />
</xsl:copy>
</xsl:template>
<xsl:template match="date">
<xsl:copy>
<xsl:value-of select="
concat(
substring-after(substring-after(.,'/'),'/') , '-',
format-number( number( substring-before(.,'/')), '00') , '-',
format-number( substring-before(substring-after(.,'/'),'/'), '00')
)
" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
......会产生这种期望的输出......
<dates>
<date>2012-11-12</date>
<date>2011-03-04</date>
</dates>
Run Code Online (Sandbox Code Playgroud)
如果答案正确,请勾选答案.我在http://www.purplegene.com/static/transform.html上验证了这个解决方案