XSL Variable Assignment/Usage

后端 未结 3 1080
闹比i
闹比i 2021-01-14 12:46

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,

3条回答
  •  抹茶落季
    2021-01-14 13:08

    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
        
    
    

提交回复
热议问题