title: Removing the last characters in an XSLT string
body: <p>In my CMS it is possible to create a new article, and choose an image to be shown on that article. When an image is chosen, a thumbnail of the image will automatically be created as well.</p>
  
  <p>If the uploaded image is called <strong>image.jpg</strong>, then the corresponding thumbnail will automatically be named <strong>image_thumbnail.jpg</strong>.</p>
  
  <p>I would now like to use the thumbnail image, everywhere on the website where the article is mentioned, except in the article itself (where the original big image should be shown).</p>
  
  <p>But how can I do that?</p>
  
  <p>I imagine if I could get the original name of the image, and then split it up before the suffix (<code>.jpg</code>, <code>.png</code>, <code>.jpeg</code> etc.) and hardcode <code>_thumbnail</code> after the name, then that would be sufficient.</p>
  
  <p>In other words, I want to take the complete filename, and cut it into two parts, so that I can insert the string <code>_thumbnail</code> between the two parts.</p>
  
  <p>Maybe that would work, but what if an image called <strong>image.2horses.jpg</strong> (a file with more than one dot in the filename) is uploaded? A naive cut before the '.' wouldn't work here.</p>
  
  <p>Is there a way to get around this? Perhaps by cutting the filename up before the last 4 (<code>.jpg</code>, <code>.png</code>) or 5 (<code>.jpeg</code>) characters?</p>