There are several ways to check if a list is empty using the <If> tag. 


Example Meta Model 


Example Data

An empty "Requirement section"


Using Variable

Below are two examples of how you can use <Variable> to obtain a list of items, and then do a check if the variable value is empty. 


Example Configuration 1

<Report>
  <Variable name="Req" as="[Item]" select="/5IDS"/>
  <If test="$Req = []">
    <Text>Empty</Text>
  </If>
</Report>   


Example Configuration 2

<Report>
    <Variable name="Req" as="[Item]" select="/5IDS"/> 
    <If test="$Req.Count = 0">
        <Text>Empty</Text> 
    </If>  
</Report> 


Note: .Count is a method of the path language and operates on the results of a path expression. To be used, you need to use it with a <Variable> and then apply .Count for the variable. If using the list to dynamically add values to a list (i.e., <AddItemToList>, <ForEachItemInList>), then it is not possible to use a variable.

Without Using Variable

Below is an example of how to use <If> without a variable to check if a list is empty.


Example Configuration

<Report>
    <If test="not /5IDS">
        <Text>Empty</Text> 
    </If>
</Report>  


Example Result 


Checking if a List is Not Empty

Similarly, you can check if a list is NOT empty by reversing the condition.


Example Configurations

<Report>
    <Variable name="Req" as="[Item]" select="/5IDS"/> 
    <If test="$Req.Count != 0">
        <Text>Not Empty</Text> 
    </If>  
</Report>  


<Report>
    <Variable name="Req" as="[Item]" select="/5IDS"/> 
    <If test="$Req != []">
        <Text>Not Empty</Text> 
    </If>  
</Report>  


<Report>
    <If test="/5IDS">
        <Text>Not Empty</Text> 
    </If>  
</Report>