[System.XML] Fix handling of global variables in XSLs (#18118)