Search

Is there a way I can get the last 3 letters of a value into a variable to see if it equals something?

I’m trying to test if a value has .jpg at the end of it in an if/when statement. I’m sure this should be possible in XSLT!

Cheers!

There is the ends-with Xpath 2 function. But it’s probably not available in your system. If not you can do something like substring(image/filename, string-length(image/filename) - 2) to test for the last three characters.

Cheers. I’ve managed to achieve what I needed!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details