Java tutorial
//package com.java2s; //License from project: Apache License import static java.lang.String.format; public class Main { public static String aggregatedTextEndsWith(final String text) { return format("substring(%s, string-length(normalize-space(string(.))) - string-length('%s') +1) = '%s'", translateTextForPath("normalize-space(string(.))"), text, text.toLowerCase()); } public static String translateTextForPath(String txt) { return format("translate(%s, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')", txt); } }