See latest comments on https://bz.apache.org/bugzilla/show_bug.cgi?id=65326
this issue does not happen with the default transformer in the Zulu JDK - xalan 2.7.2 is from 2014 - probably explains why the issue happens for some users - ones who insist on using ancient libraries
added r1895276
Seems to be fixed via the change mentioned in the previous comment.