title: XSLT replace repeating text
body: <p>For a field I have text that is repeating itself for each node I have connected to it, like this</p>
  
  <p><strong>Original output</strong></p>
  
  <pre><code>;#{1220}Price:  ;#{1231}1x59 kr;#{1291}1x21 kr;#{1253}2x10 kr;#{1254}1x600 kr;#
  </code></pre>
  
  <p>Price is here the root node, the subsequent ones are subnodes. I am interested in removing the ;#{NODEID} and the rootnode title from all the nodes so that the output will be:</p>
  
  <p><strong>Wanted output</strong></p>
  
  <pre><code>1x59 kr, 1x21 kr, 2x10 kr, 1x600 kr
  </code></pre>
  
  <p>Mind I want the ;# removed from the end aswell.</p>
  
  <p>I have achieved to remove the rootnode title, but I do not know how to remove it from all nodes. I should add I am very new to xslt. I use the following to remove the rootnode title:</p>
  
  <pre><code>&lt;xsl:template name="FormatPrice" match="FieldRef[@Name='lookup']" mode="Lookup_body" &gt;
  &lt;xsl:param name="lookupVal" /&gt;
  &lt;xsl:param name="clnVal"/&gt;
  &lt;xsl:param name="index" select="0"/&gt;
  
  &lt;xsl:variable name="concatinateClean"&gt;
    &lt;xsl:choose&gt;
  
      &lt;xsl:when test="$clnVal =null or $clnVal ='' or $clnVal =' '"&gt;
        &lt;xsl:value-of select="$clnVal"/&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
  
        &lt;xsl:choose&gt;
          &lt;xsl:when test="contains($lookupVal,';#') and $index mod 2=1"&gt;
            &lt;xsl:value-of select="concat($clnVal, '')"/&gt;
          &lt;/xsl:when&gt;
          &lt;xsl:otherwise&gt;
            &lt;xsl:value-of select="$clnVal"/&gt;
          &lt;/xsl:otherwise&gt;
        &lt;/xsl:choose&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
  &lt;/xsl:variable&gt;
  
  &lt;xsl:if test="contains($lookupVal,';#')"&gt;
    &lt;xsl:variable name="firstHshRem" select="substring-after($lookupVal, ';#')"/&gt;
    &lt;xsl:variable name="afterSecondHash" select="substring-after($firstHshRem, ';#')" /&gt;
    &lt;xsl:variable name="remNodeID" select="substring($afterSecondHash, 7)" /&gt;
  
  
    &lt;xsl:variable name="tempClean"&gt;
      &lt;xsl:choose&gt;
        &lt;xsl:when test="$index mod 2 = 1"&gt;
          &lt;xsl:value-of select="$concatinateClean"/&gt;
        &lt;/xsl:when&gt;
        &lt;xsl:otherwise&gt;
          &lt;xsl:value-of select="concat($concatinateClean,$remNodeID)"/&gt;
        &lt;/xsl:otherwise&gt;
      &lt;/xsl:choose&gt;
    &lt;/xsl:variable&gt;
  
    &lt;xsl:variable name="temporary"&gt;
      &lt;xsl:call-template name="FormatPrice"&gt;
        &lt;xsl:with-param name="lookupVal" select="$firstHshRem"/&gt;
        &lt;xsl:with-param name="clnVal" select="$tempClean"/&gt;
        &lt;xsl:with-param name="index" select="$index+1"/&gt;
      &lt;/xsl:call-template&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:value-of select="$temporary"/&gt;
  &lt;/xsl:if&gt;
  &lt;xsl:if test="not(contains($lookupVal,';#'))"&gt;
    &lt;xsl:value-of select="concat($concatinateClean,$lookupVal)"/&gt;
    &lt;/xsl:if&gt;
    &lt;/xsl:template&gt;
  </code></pre>
  
  <p>Any help on this is greatly appreciated</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thank you Marcus for your help, and apologies for my late reply. I am getting very close now. </p>
  
  <p>I edited the code you provided to some extent, due to I am using Sharepoint and I am searching in a termstore-field. I forgot to mention I need to hide more than one header. I have one Price header and one Location header.</p>
  
  <p>Output is now as follows:</p>
  
  <pre><code>, Price:, 1x59 kr, 1x21 kr, 2x10 kr, 1x600 kr 
  , Location:, Bermuda, Tenerife
  </code></pre>
  
  <p>with the following code:</p>
  
  <pre><code>&lt;xsl:template name="FormatPL" match="FieldRef[@Name='lookup']" mode="Lookup_body" &gt;
  &lt;xsl:param name="lookupVal" /&gt;
  
      &lt;xsl:choose&gt;
  
    &lt;xsl:when test="contains($lookupVal, ';#{')"&gt;
      &lt;xsl:value-of select="substring-before($lookupVal, ';#')"/&gt;
      &lt;xsl:text&gt;, &lt;/xsl:text&gt;
      &lt;xsl:call-template name="FormatPL"&gt;
        &lt;xsl:with-param name="lookupVal" select="substring-after(substring-after($lookupVal, ';#'), '}')"/&gt;    
      &lt;/xsl:call-template&gt;        
    &lt;/xsl:when&gt;
  
  
    &lt;xsl:when test="contains($lookupVal, ';#')"&gt;
      &lt;xsl:value-of select="substring-before($lookupVal, ';#')"/&gt;
    &lt;/xsl:when&gt;
  
    &lt;xsl:otherwise&gt;
      &lt;xsl:value-of select="$lookupVal"/&gt;
    &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  </code></pre>
  
  <p></p>
  
  <p>Calling the search with:</p>
  
  <pre><code> &lt;td&gt;
      &lt;h3&gt;
         Price:
      &lt;/h3&gt;
   &lt;/td&gt;
    &lt;td&gt;
      &lt;p&gt;
        &lt;xsl:call-template name="FormatPL"&gt;
           &lt;xsl:with-param name="lookupVal" select="@ows_PL" /&gt;
         &lt;/xsl:call-template&gt;                
     &lt;/p&gt;
   &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>where @ows_PL is the field in sharepoint, and I use the same for Location.   </p>
  
  <p>I realise this is basic stuff, but I am having a hard time to do this. I now only need to remove the ",  Price:," and ", Location:," at the start. Any further help is greatly appreciated   </p>