code: private static void endsWith(StringBuilder sb, String attr, String value) {
          sb.append("'");
          sb.append(value.replace("'", "\\'"));
          sb.append("' = substring(@");
          sb.append(attr);
          sb.append(", string-length(@");
          sb.append(attr);
          sb.append(") - string-length('");
          sb.append(value.replace("'", "\\'"));
          sb.append("') + 1)");
      }
docs: XPath 2.0<br/><br/><code>ends-with($str1, $str2)</code><br/><br/> is equivalent to XPath 1.0<br/><br/>
  <code>$str2 = substring($str1, string-length($str1) - string-length($str2) + 1)</code>