xslt是否用于在小写后跟大写字母后添加space

Does xslt be used to add space after lowercase followed by Uppercase letter

我有一些简单的字符串:

例如:

DeFacto, RightOfWay, HalfYearly etc

如何使用 xslt 2.0 或 xslt 3.0 中的函数在小写字母和大写字母之间插入 space。

期望输出:

De Facto, Right Of Way, Half Yearly

您可以使用 replace 函数:replace('DeFacto, RightOfWay, HalfYearly', '(\p{Ll})(\p{Lu})', ' ') 给出 De Facto, Right Of Way, Half Yearly

使用我提供的代码创建了一个替换函数。

<xsl:function name="fn:InsertSpace">
    <xsl:param name="Text" />
    <xsl:value-of select="replace($Text, '(\p{Ll})(\p{Lu})', ' ')"/>
</xsl:function>