Check if XML node is empty

subha86

New Member
I have a simple XML structure like \[code\]<main><node1><!-- comments --><!-- comments --></node1></main>\[/code\]and this can have any number of sub-nodes or values like:\[code\] <main> <node1><!-- comments --><!-- comments --><p>texttext text</p> more text <br/></node1> </main>\[/code\]I want to check if the node \[code\]<node1>\[/code\] is empty or not:
Condition: the node can still have comments in it and it should be still marked as emptyI'm doing something like:\[code\]<xsl:if test="string-length(main/node1//text())>0">\[/code\]But it does not work as if there are multiple \[code\]<p>\[/code\] tags, then string-length function will break because of multiple arguments.Any help to solve this issue is really appreciated.
 
Back
Top