formatter: better logging in xslt engine

* Uses `current_app.logger.error` or `current_app.logger.exception`
  instead of `sys.stderr`.  (closes #2049)

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
33:1: F401 'sys' imported but unused