I am trying to achieve the count of the entries in my output from the sample XML below through xsl.

**Background:**
Every employee have some dependents (child, spouse), depending on the Employee coverage we will populate the results on the output file. 

If 'Employee\_only' coverage, then we will NOT have dependents in the output. 
If 'Family coverage', then we will have dependents in the output.

```
<root xmlns:wd="http://wd.com">        <!-- Added by edit -->
    <wd:Report_Entry>
        <wd:Employee_ID>Empl_001</wd:Employee_ID>
        <wd:Benefits>
            <wd:Coverage>Family</wd:Coverage>
        </wd:Benefits>
        <wd:Dependents>
            <wd:Relationship1>Child</wd:Relationship1>
            <wd:Dep_LastName>Child_A</wd:Dep_LastName>
        </wd:Dependents>
        <wd:Dependents>
            <wd:Relationship1>Spouse</wd:Relationship1>
            <wd:Dep_LastName>Spouse</wd:Dep_LastName>
        </wd:Dependents>
    </wd:Report_Entry>
    <wd:Report_Entry>
        <wd:Employee_ID>Empl_002</wd:Employee_ID>
        <wd:Benefits>
            <wd:Coverage>Family</wd:Coverage>
        </wd:Benefits>
        <wd:Dependents>
            <wd:Relationship1>Child</wd:Relationship1>
            <wd:Dep_LastName>Child_A</wd:Dep_LastName>
        </wd:Dependents>
        <wd:Dependents>
            <wd:Relationship1>Child</wd:Relationship1>
            <wd:Dep_LastName>Child_B</wd:Dep_LastName>
        </wd:Dependents>
        <wd:Dependents>
            <wd:Relationship1>Spouse</wd:Relationship1>
            <wd:Dep_LastName>Spouse</wd:Dep_LastName>
        </wd:Dependents>
    </wd:Report_Entry>
    <wd:Report_Entry>
        <wd:Employee_ID>Empl_003</wd:Employee_ID>
        <wd:Benefits>
            <wd:Coverage>Employee_Only</wd:Coverage>
        </wd:Benefits>
        <wd:Dependents>
            <wd:Relationship1>Child</wd:Relationship1>
            <wd:Dep_LastName>Child_A</wd:Dep_LastName>
        </wd:Dependents>
        <wd:Dependents>
            <wd:Relationship1>Spouse</wd:Relationship1>
            <wd:Dep_LastName>Spouse</wd:Dep_LastName>
        </wd:Dependents>
    </wd:Report_Entry>
</root>                               <!-- Added by edit -->

```

--
Output will be something like below:

```
Header
Empl_001
001_Child_A
001_Spouse
Empl_002
002_Child_A
002_Child_B
002_Spouse
Empl_003
Trailer -  **8**

```

The expected count of this XML result will be **8** and NOT 10 because last employee's coverage is "Employee\_only" and not "Family". 

Conditions: Count the Employees + Dependents [For Employee who have coverage as Family].

I am using below XSLT code: 

* Below gives me 3 as the count which is Total # of Employees.

```
<xsl:value-of select="count(//wd:Report_Entry)"/>

```
* Below gives me 7 as the count which is Total # of Dependents.

```
<xsl:value-of select="count(//wd:Report_Entry/wd:Dependents)"/>

```
* Below gives me 2 as the count with is Total # of Employees who have the coverage as 'Family'.

```
<xsl:value-of select="count(//wd:Benefits[wd:Coverage ='Family']"/>

```

I need to collate the total # of Employee + Dependents [For Employee who have coverage as 'Family']

**Experts,** Please help how to count in this condition.