Check if a string is null or empty in XSLT

前端 未结 14 1162
梦毁少年i
梦毁少年i 2020-11-27 09:12

How can I check if a value is null or empty with XSL?

For example, if categoryName is empty? I\'m using a when choosing construct.

For

14条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 09:37

    From Empty Element:

    To test if the value of a certain node is empty

    It depends on what you mean by empty.

    • Contains no child nodes: not(node())
    • Contains no text content: not(string(.))
    • Contains no text other than whitespace: not(normalize-space(.))
    • Contains nothing except comments: not(node()[not(self::comment())])

提交回复
热议问题