I found this during random testing: https://help.libreoffice.org/25.2/bg/search?P=Diagram Exception: too many arguments to $if
This is the problematic $if: $if{$query,Няма документи, отговарящи на заявката ви., <hr>Претърсват се $nice{$dbsize} документа } In translation there is a comma, that is not escaped. Instead of literal ',', there could be '$.' or '$chr{44}'. It's a real pain to replace strings in XSLT 1.0.
Isn't the case of asking the translator to rephrase the string without a comma? Automatic replacement with a rule in XSLT may result in poor translation.
Replacing , to $. in xap_tpl will not change the translation. The problem is that you use unescaped input (a translation) that can be interpreted as code.
Olivier Hallot committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/help/commit/a8e9369e739ce9119af7a662e46b662804f7c1d9 tdf#165758 Escape CGI comma for xapian template