This is the XSLT from a SharePoint Dataview:

<tr>
    <td class="ms-vb">Trip Count : <xsl:value-of select="count(/dsQueryResponse/Rows/Row)" /></td>
   </tr>
   <tr>
    <td class="ms-vb">Warning Count : <xsl:value-of select="count(/dsQueryResponse/Rows/Row )" /></td>
   </tr>

Trip Count above counts the total number of forms entered by traveller - the xpath expression works like a charm...

How do I edit the same expression to give a count of forms that have the 'warning' attribute = 'Yes'? (warning variable from dataview = Travel_x0020_Warning)

For example, I tried the following with no luck:

<tr>
    <td class="ms-vb">Warning Count : <xsl:value-of select="count(/dsQueryResponse/Rows/Row[@Travel_x0020_Warning='Yes'] )" /></td>
   </tr>

This expression above returns '0' even though there is at least one row ='Yes'. This warning column is a Yes/No checkbox. I also tried changing 'Yes' to 'True' and '1' but all return zero also.

Thank you in advance for any help,

David

I got the above code to work fine in my Data View Web Part, BUT, only after I deleted the existing data view web part (DVWP, aka DataFormWebPart) in question, then re-converted a SP list view to a new data view web part. Apparently, my existing DVWP was tainted or just bugged out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.