title: XSLT - String split
body: <p>My objective is analyze the text() node of a given XML document and identify the upper case words and if that word length > 3 add <code>'*'</code> character in between 3,4 characters (6,7 and 9,10.....)</p>
  
  <p>example,</p>
  
  <p>input XML :</p>
  
  <pre><code>&lt;chap&gt;
      &lt;para&gt;The BEGINNING of this COLUMN shows the INPUT and output&lt;/para&gt;
  &lt;/chap&gt;
  </code></pre>
  
  <p>desired output:</p>
  
  <pre><code>&lt;chap&gt;
      &lt;para&gt;The BEG*INN*ING of this COL*UMN shows the INP*UT and output&lt;/para&gt;
  &lt;/chap&gt;
  </code></pre>
  
  <p>I've written following xsl to do this task,</p>
  
  <pre><code>&lt;xsl:template match="para"&gt;
          &lt;xsl:analyze-string select="." regex="[(A-Z)]"&gt;
              &lt;xsl:matching-substring&gt;
                  &lt;xsl:variable name="reg" select="string(regex-group(0))"/&gt;
                      &lt;xsl:call-template name="add-star"&gt;
                          &lt;xsl:with-param name="str" select="$reg"/&gt;
                      &lt;/xsl:call-template&gt;
              &lt;/xsl:matching-substring&gt;
  
              &lt;xsl:non-matching-substring&gt;
                  &lt;xsl:value-of select="."/&gt;
              &lt;/xsl:non-matching-substring&gt;
          &lt;/xsl:analyze-string&gt;
      &lt;/xsl:template&gt;
  
  &lt;xsl:template name="add-star"&gt;
          &lt;xsl:param name="str" as="xs:string"/&gt;
          &lt;xsl:if test="string-length($str)&gt;3"&gt;
              &lt;xsl:call-template name="add-star"&gt;
                  &lt;xsl:with-param name="str" select="substring($str,4,200)"/&gt;
              &lt;/xsl:call-template&gt;
          &lt;/xsl:if&gt;
          &lt;xsl:sequence select="string-join(substring($str,1,3),'*')"/&gt;
      &lt;/xsl:template&gt;
  </code></pre>
  
  <p>but it does not work as expected.since there is no variables like oop languages I'm struggling to to this task in XSLT, could anyone suggest me how can I modify my code to do this task?</p>