问题
I am trying to have an XSL transformation to run on a Jenkins pipeline.
I need to catch XSL transformation's xsl:message
. In order to achieve so, I added an ErrorListener
:
final ErrorListener errorListener = new ErrorListener() {
final public List<TransformerException> errorList = new LinkedList<>()
@Override
void warning(final TransformerException e) throws TransformerException {
errorList.add(e)
}
@Override
void error(final TransformerException e) throws TransformerException {
errorList.add(e)
}
@Override
void fatalError(final TransformerException e) throws TransformerException {
errorList.add(e)
}
}
transformer.setErrorListener(errorListener)
transformer.transform(streamSource, streamResult)
This perfectly works if I run it locally. The transformation gracefully ends and I fetch all desired xsl:message
(via the ErrorListener
's warning
method being invoked).
However, if I run this on a Jenkins machine, only the first xsl:message
is raised (via the ErrorListener
's warning
method being invoked) and the transformation does not continue. This leads to an half filled resulting (html) file.
If I remove the ErrorListener
, the transformation ends gracefully and I get a filled resulting (html) file, but I obviously don't fetch the xsl:message
.
Do you guys have any idea of what the problem could be ?
来源:https://stackoverflow.com/questions/62346635/incomplete-xsl-transformation-if-using-errorlistener-only-on-jenkins