使用xslt将xml数据从1个标记转换为2个不同的列



我有

<datetime xml:space="preserve">2020-08-11T04:00:00</datetime>

我想把这个改成

2020-08-11
04:00:00

使用xslt,但我搞不清楚,我搜索了很多,但没有找到

在这种情况下,您可以使用substring-before()substring-after(),使用T作为参考来分割文本,如:

<xsl:template match="datetime">
<xsl:value-of select="substring-before(., 'T')"/>
<xsl:value-of select="substring-after(., 'T')"/>
</xsl:template>

最新更新