XSLT: How to exclude empty elements from my result?

前端 未结 4 536
感动是毒
感动是毒 2020-12-05 21:06

I have a rather complicated xslt sheet transforming one xml format to another using templates. However, in the resulting xml, I need to have all the empty elements excluded.

4条回答
  •  生来不讨喜
    2020-12-05 21:52

    This is probably the simplest way:

    
    
    
    

    If you have control of the XML generation then don't add the root node if there is no children. Regardless of which way you choose XSL is quite verbose.

提交回复
热议问题