title: "Regular expression"-style replace in XSLT 1.0
body: <p>I need to perform a find and replace using XSLT 1.0 which is really suited to regular expressions. Unfortunately these aren't available in 1.0 and I'm also unable to use any extension libraries such as EXSLT due to security settings I can't change.</p>
  
  <p>The string I'm working with looks like:</p>
  
  <p><code>19;#John Smith;#17;#Ben Reynolds;#1;#Terry Jackson</code></p>
  
  <p>I need to replace the numbers and <code>; #</code> characters with a <code>,</code>. For example the above would change to:</p>
  
  <p><code>John Smith, Ben Reynolds, Terry Jackson</code></p>
  
  <p>I know a recursive string function is required, probably using substring and translate, but I'm not sure where to start with it.</p>
  
  <p>Does anyone have some pointers on how to work this out? Here's what I've started with:</p>
  
  <pre><code>&lt;xsl:template name="TrimMulti"&gt;
      &lt;xsl:param name="FullString" /&gt;
      &lt;xsl:variable name="NormalizedString"&gt;
          &lt;xsl:value-of select="normalize-space($FullString)" /&gt;
      &lt;/xsl:variable&gt;
      &lt;xsl:variable name="Hash"&gt;#&lt;/xsl:variable&gt;
      &lt;xsl:choose&gt;
          &lt;xsl:when test="contains($NormalizedString, $Hash)"&gt;
              &lt;!-- Do something and call TrimMulti --&gt;
          &lt;/xsl:when&gt;
      &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;
  </code></pre>