The issue was that the attribute was processed before the variable was set (e.g. m_preserveSpaces.push). Reversing the order fixed it.
------------- Commit messages: - 8265073: XML transformation and indentation when using xml:space Changes: https://git.openjdk.java.net/jdk17/pull/89/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk17&pr=89&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8265073 Stats: 59 lines in 2 files changed: 51 ins; 6 del; 2 mod Patch: https://git.openjdk.java.net/jdk17/pull/89.diff Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/89/head:pull/89 PR: https://git.openjdk.java.net/jdk17/pull/89