Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to split the string when character is in uppercase n later concatenate with space. For example:--

Given:--

<test>UnitOfMeasure</test>

Desired o/p:--

<final>Unit Of Measure</final>

what function/algorithm I should write to achieve the above requirement(no idea should I use string-split or tokenize() here). Thanks in advance

<final>
<Xsl:value-of select= "concat(?)"/>
</final>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
653 views
Welcome To Ask or Share your Answers For Others

1 Answer

In XSLT 2 and later you can xsl:analyze-string:

  <xsl:param name="pattern" as="xs:string">(p{Lu}p{Ll}*)</xsl:param>

  <xsl:template match="test">
      <final>
          <xsl:value-of separator=" ">
              <xsl:analyze-string select="." regex="{$pattern}">
                  <xsl:matching-substring>
                      <xsl:sequence select="."/>
                  </xsl:matching-substring>
              </xsl:analyze-string>
          </xsl:value-of>
      </final>
  </xsl:template>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...