XSLT self-closing tags issue

后端 未结 12 1135
遥遥无期
遥遥无期 2020-12-08 20:19

I am using xslt to transform an xml file to html. The .net xslt engine keeps serving me self-closing tags for empty tags.

Example:

12条回答
  •  被撕碎了的回忆
    2020-12-08 21:02

    Just experienced the same issue with PHP 5's XSL, with output/@method=html. Seems that assigning an empty value attribute will cause elements to be output as invalid non-self-closing, non-closed tags:

    
    

    results in:

    
    

    One possible solution is to conditionally add the attribute:

    
        
            
        
    
    

    resulting in:

    
    

提交回复
热议问题