I have an XML file I\'m processing with XSL to build a PDF. I\'m running into an issue when I try to use an XSL variable. I\'m not sure if I\'m using it in the wrong scope,
This is because you're approaching variable declaration as you might in a procedural language.
XSLT is compiled, and so it needs to be sure that your variable either exists or it doesn't. It sees you declaring it conditionally, and it gets worried.
Simply make the variable value conditional, rather than the variable's existence itself.
Old
New