Dear PG hackers, here is a patch that improves the xslt_process() error handling. Error handling was one of the points criticized earlier [1] and as far as I understand it is one of the reasons that xslt_process() was never adopted into core and contrib/xml2 is considered deprecated since PG 8. However the point is also still on the TODO list ("Report errors returned by the XSLT library") and xslt_process() has been asked for several times on the mailing list. Memory handling bugs that have been reported earlier [2] have obviously long been fixed.
The point raised in [1] was that xslt_process() would not report missing stylesheet parameters at all. This hasn't been the case at the current HEAD. However, xslt_process() still wouldn't report any details about errors related to XSLT processing. This is what is fixed by this patch. It now installs an XSLT error handler. See the patch comment for details. Since the goal is to eventually get xslt_process() adopted into core, I also got rid of PG_XML_STRICTNESS_LEGACY. Perhaps you can tell me what else is preventing adoption into core. I believe that xslt_process() should also accept the `xml` type as an alternative to strings. Strings should be kept for backwards compatibility, though. Also, the stylesheet parameter passing is very crude and limited. I suggest, that the current method of passing them as strings (see parse_params()) is deprecated and we don't try to tackle its limitations, but will instead accept hstores. If you agree, I will work on these two tasks next. Yours sincerely, Robin Haberkorn [1]: https://www.postgresql.org/message-id/4C5ECEF9.3030806%40mlfowler.com [2]: https://www.postgresql.org/message-id/flat/4A6A276A.6090405%40dunslane.net -- Robin Haberkorn Senior Software Engineer B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / https://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt, HRB 3537