title: Get all the caracters before the second occurrence of a character in XSLT
body: <p>I am trying to extract the  string located before the second occurrence of '-'</p>
  
  <p>Example:
  I have this string: <strong>xx-xxxx-xxxxx-xxxxxx</strong>
  and I try to have only: <strong>xx-xxxx</strong></p>
  
  <p>But we can also have this string : <strong>xxx-xxx-xxxxx-xxxxxx</strong> and then I need that : <strong>xxx-xxx</strong></p>
  
  <p>I tried to make it with substring-before/after  but I did not manage to have the desired result. then I wanted to know if this was possible to do that in xslt 1.0?</p>
  
  <p>Sample of code I tried:</p>
  
  <pre><code>&lt;xsl:template match="/RESULT"&gt;
     &lt;RESULT&gt;
        &lt;xsl:if test="contains(Number,'-')"&gt;                 
             &lt;ref&gt;                                                                                                    
                &lt;xsl:value-of select="substring-before(substring-after(Number,'-')'')"/&gt;                                                                                  
            &lt;/ref&gt;
        &lt;/xsl:if&gt;
      &lt;/RESULT&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>thank you in advance</p>