-1

I have some simple strings:

Ex:

DeFacto, RightOfWay, HalfYearly etc

How can i insert a space between the lowercase and the uppercase using a function in xslt 2.0 or xslt 3.0.

Desire output:

De Facto, Right Of Way, Half Yearly

DanielCSD
  • 73
  • 1
  • 8

2 Answers2

1

You can use the replace function: replace('DeFacto, RightOfWay, HalfYearly', '(\p{Ll})(\p{Lu})', '$1 $2') gives De Facto, Right Of Way, Half Yearly.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
0

Using the code provided i've made a function for the replacement.

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