Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a data source to link, via a join, 2 lists in sharepoint 2010. The result is a Data View Web Part. I would like to count the results returned in the second 'lookup' list. So for example, list one's title is "Events" and the second list is "Attendees". I want to count how many attendees there are to a specific event. My DVWP is correctly pulling back data.

Event 1 has 2 attendees Event 2 has 1 attendee Event 3 has 1 attendee

My current xpath looks like this:

count(../../../signup-attendees/Rows/Row[../../../signup-attendees/Rows/Row/@Signup_ID_Lookup=@ID]) which returns 3; 3; 3;

I've also tried:

count(../../../signup-attendees/Rows/Row[../../../signup-attendees/Rows/Row/@Signup_ID_Lookup=current()/@ID]) which returns 4; 4; 4;

Does anyone have any ideas how I can return 2; 1; 1;?

UPDATE

            <dsQueryResponse>
  <signup-attendees>
    <Rows>
      <Row ContentTypeId="0x0100D1FB1F346446184B9F97702C63D76495" Title="Signup 01" _ModerationComments="" File_x0020_Type="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapall="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapico="" Signup_x0020_ID_x0020_Lookup="<a onclick="OpenPopUpPage('https://sub.mydomain.co.uk/sites/heg/_layouts/listform.aspx?PageType=4&ListId={65E8D46B-74CB-4917-A11E-4838CB62684D}&ID=2&RootFolder=*', RefreshPage); return false;" href="https://sub.mydomain.co.uk/sites/heg/_layouts/listform.aspx?PageType=4&ListId={65E8D46B-74CB-4917-A11E-4838CB62684D}&ID=2&RootFolder=*">Test 02</a>" Signup_x0020_ID_x0020_Lookup.="2;#Test 02" Signup_x0020_ID_x0020_Lookup_x00="2" Signup_x0020_ID_x0020_Lookup_x000="Test 02" ID="1" ContentType="Item" Modified="5/28/2012 12:04 PM" Created="5/28/2012 11:54 AM" Author="<span class="ms-imnSpan"><img border='0' height='12' width='12' class='ms-imnImg' src='/_layouts/images/blank.gif' alt='' /><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=23">MYDOMAIN\Astudent</a></span>" Author.id="23" Author.title="MYDOMAIN\Astudent" Author.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=23">MYDOMAIN\Astudent</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><img border='0' height='12' width='12' class='ms-imnImg' src='/_layouts/images/blank.gif' alt='' /></span></nobr>" Editor="<span class="ms-imnSpan"><img border='0' height='12' width='12' class='ms-imnImg' src='/_layouts/images/blank.gif' alt='' /><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=23">MYDOMAIN\Astudent</a></span>" Editor.id="23" Editor.title="MYDOMAIN\Astudent" Editor.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=23">MYDOMAIN\Astudent</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><img border='0' height='12' width='12' class='ms-imnImg' src='/_layouts/images/blank.gif' alt='' /></span></nobr>" _HasCopyDestinations="" _HasCopyDestinations.value="" _CopySource="" owshiddenversion="2" owshiddenversion.="2" WorkflowVersion="1" WorkflowVersion.="1" _UIVersion="512" _UIVersion.="512" _UIVersionString="1.0" Attachments="0" _ModerationStatus="Approved" _ModerationStatus.="0" LinkTitleNoMenu="Signup 01" LinkTitle="Signup 01" LinkTitle2="Signup 01" SelectTitle="1" InstanceID="" InstanceID.="" Order="100" Order.="100.000000000000" GUID="{5968E86D-B7DD-444D-BA18-37C407BE9D7C}" WorkflowInstanceID="" FileRef="/sites/heg/Lists/signupattendees/1_.000" FileRef.urlencode="%2Fsites%2Fheg%2FLists%2Fsignupattendees%2F1%5F%2E000" FileRef.urlencodeasurl="/sites/heg/Lists/signupattendees/1_.000" FileDirRef="/sites/heg/Lists/signupattendees" Last_x0020_Modified="5/28/2012 11:54 AM" Created_x0020_Date="0;#2012-05-28 11:54:50" Created_x0020_Date.ifnew="" FSObjType="0" SortBehavior="0" PermMask="0x7fffffffffffffff" FileLeafRef="1_.000" FileLeafRef.Name="1_" FileLeafRef.Suffix="000" UniqueId="{47ECB1FB-1EC8-4E40-B669-7AE9263DFC50}" SyncClientId="" ProgId="" ScopeId="{F73AF7C0-59A1-4A38-A1FF-D6600650485E}" HTML_x0020_File_x0020_Type="" _EditMenuTableStart="1_.000" _EditMenuTableStart2="1" _EditMenuTableEnd="1" LinkFilenameNoMenu="1_.000" LinkFilename="1_.000" LinkFilename2="1_.000" DocIcon="" ServerUrl="/sites/heg/Lists/signupattendees/1_.000" EncodedAbsUrl="https://sub.mydomain.co.uk/sites/heg/Lists/signupattendees/1_.000" BaseName="1_" MetaInfo="" MetaInfo.="1;#" _Level="1" _Level.="1" _IsCurrentVersion="Yes" _IsCurrentVersion.value="1" ItemChildCount="0" FolderChildCount="0"></Row>
      <Row ContentTypeId="0x0100D1FB1F346446184B9F97702C63D76495" Title="Signup 03" _ModerationComments="" File_x0020_Type="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapall="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapico="" Signup_x0020_ID_x0020_Lookup="<a onclick="OpenPopUpPage('https://sub.mydomain.co.uk/sites/heg/_layouts/listform.aspx?PageType=4&ListId={65E8D46B-74CB-4917-A11E-4838CB62684D}&ID=1&RootFolder=*', RefreshPage); return false;" href="https://sub.mydomain.co.uk/sites/heg/_layouts/listform.aspx?PageType=4&ListId={65E8D46B-74CB-4917-A11E-4838CB62684D}&ID=1&RootFolder=*">Test 01</a>" Signup_x0020_ID_x0020_Lookup.="1;#Test 01" Signup_x0020_ID_x0020_Lookup_x00="1" Signup_x0020_ID_x0020_Lookup_x000="Test 01" ID="3" ContentType="Item" Modified="5/28/2012 12:11 PM" Created="5/28/2012 11:55 AM" Author="<span class="ms-imnSpan"><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_9,type=smtp'/></a><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a></span>" Author.id="16" Author.title="Jane Doe" Author.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_10,type=smtp'/></a></span></nobr>" Editor="<span class="ms-imnSpan"><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_11,type=smtp'/></a><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a></span>" Editor.id="16" Editor.title="Jane Doe" Editor.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_12,type=smtp'/></a></span></nobr>" _HasCopyDestinations="" _HasCopyDestinations.value="" _CopySource="" owshiddenversion="2" owshiddenversion.="2" WorkflowVersion="1" WorkflowVersion.="1" _UIVersion="512" _UIVersion.="512" _UIVersionString="1.0" Attachments="0" _ModerationStatus="Approved" _ModerationStatus.="0" LinkTitleNoMenu="Signup 03" LinkTitle="Signup 03" LinkTitle2="Signup 03" SelectTitle="3" InstanceID="" InstanceID.="" Order="300" Order.="300.000000000000" GUID="{1BB3705E-0A47-475F-BED5-9B869A7699F3}" WorkflowInstanceID="" FileRef="/sites/heg/Lists/signupattendees/3_.000" FileRef.urlencode="%2Fsites%2Fheg%2FLists%2Fsignupattendees%2F3%5F%2E000" FileRef.urlencodeasurl="/sites/heg/Lists/signupattendees/3_.000" FileDirRef="/sites/heg/Lists/signupattendees" Last_x0020_Modified="5/28/2012 11:55 AM" Created_x0020_Date="0;#2012-05-28 11:55:15" Created_x0020_Date.ifnew="" FSObjType="0" SortBehavior="0" PermMask="0x7fffffffffffffff" FileLeafRef="3_.000" FileLeafRef.Name="3_" FileLeafRef.Suffix="000" UniqueId="{B49A4785-671C-45F8-A74C-0702D93B01E8}" SyncClientId="" ProgId="" ScopeId="{F73AF7C0-59A1-4A38-A1FF-D6600650485E}" HTML_x0020_File_x0020_Type="" _EditMenuTableStart="3_.000" _EditMenuTableStart2="3" _EditMenuTableEnd="3" LinkFilenameNoMenu="3_.000" LinkFilename="3_.000" LinkFilename2="3_.000" DocIcon="" ServerUrl="/sites/heg/Lists/signupattendees/3_.000" EncodedAbsUrl="https://sub.mydomain.co.uk/sites/heg/Lists/signupattendees/3_.000" BaseName="3_" MetaInfo="" MetaInfo.="3;#" _Level="1" _Level.="1" _IsCurrentVersion="Yes" _IsCurrentVersion.value="1" ItemChildCount="0" FolderChildCount="0"></Row>
      <Row ContentTypeId="0x0100D1FB1F346446184B9F97702C63D76495" Title="Signup 04" _ModerationComments="" File_x0020_Type="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapall="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapico="" Signup_x0020_ID_x0020_Lookup="<a onclick="OpenPopUpPage('https://sub.mydomain.co.uk/sites/heg/_layouts/listform.aspx?PageType=4&ListId={65E8D46B-74CB-4917-A11E-4838CB62684D}&ID=1&RootFolder=*', RefreshPage); return false;" href="https://sub.mydomain.co.uk/sites/heg/_layouts/listform.aspx?PageType=4&ListId={65E8D46B-74CB-4917-A11E-4838CB62684D}&ID=1&RootFolder=*">Test 01</a>" Signup_x0020_ID_x0020_Lookup.="1;#Test 01" Signup_x0020_ID_x0020_Lookup_x00="1" Signup_x0020_ID_x0020_Lookup_x000="Test 01" ID="4" ContentType="Item" Modified="5/28/2012 12:12 PM" Created="5/28/2012 12:09 PM" Author="<span class="ms-imnSpan"><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_13,type=smtp'/></a><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a></span>" Author.id="16" Author.title="Jane Doe" Author.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_14,type=smtp'/></a></span></nobr>" Editor="<span class="ms-imnSpan"><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_15,type=smtp'/></a><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a></span>" Editor.id="16" Editor.title="Jane Doe" Editor.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_16,type=smtp'/></a></span></nobr>" _HasCopyDestinations="" _HasCopyDestinations.value="" _CopySource="" owshiddenversion="2" owshiddenversion.="2" WorkflowVersion="1" WorkflowVersion.="1" _UIVersion="512" _UIVersion.="512" _UIVersionString="1.0" Attachments="0" _ModerationStatus="Approved" _ModerationStatus.="0" LinkTitleNoMenu="Signup 04" LinkTitle="Signup 04" LinkTitle2="Signup 04" SelectTitle="4" InstanceID="" InstanceID.="" Order="400" Order.="400.000000000000" GUID="{24B16CDB-A943-49B8-A309-0D674ABB47D1}" WorkflowInstanceID="" FileRef="/sites/heg/Lists/signupattendees/4_.000" FileRef.urlencode="%2Fsites%2Fheg%2FLists%2Fsignupattendees%2F4%5F%2E000" FileRef.urlencodeasurl="/sites/heg/Lists/signupattendees/4_.000" FileDirRef="/sites/heg/Lists/signupattendees" Last_x0020_Modified="5/28/2012 12:09 PM" Created_x0020_Date="0;#2012-05-28 12:09:26" Created_x0020_Date.ifnew="" FSObjType="0" SortBehavior="0" PermMask="0x7fffffffffffffff" FileLeafRef="4_.000" FileLeafRef.Name="4_" FileLeafRef.Suffix="000" UniqueId="{DD1D8DAC-072D-435B-9E5A-6A9B24B52D87}" SyncClientId="" ProgId="" ScopeId="{F73AF7C0-59A1-4A38-A1FF-D6600650485E}" HTML_x0020_File_x0020_Type="" _EditMenuTableStart="4_.000" _EditMenuTableStart2="4" _EditMenuTableEnd="4" LinkFilenameNoMenu="4_.000" LinkFilename="4_.000" LinkFilename2="4_.000" DocIcon="" ServerUrl="/sites/heg/Lists/signupattendees/4_.000" EncodedAbsUrl="https://sub.mydomain.co.uk/sites/heg/Lists/signupattendees/4_.000" BaseName="4_" MetaInfo="" MetaInfo.="4;#" _Level="1" _Level.="1" _IsCurrentVersion="Yes" _IsCurrentVersion.value="1" ItemChildCount="0" FolderChildCount="0"></Row>
    </Rows>
  </signup-attendees>
  <signup-list>
    <Rows>
      <Row ContentTypeId="0x010065D6ABB14ACC8841AF4B3B24773A8454" Title="Test 01" _ModerationComments="" File_x0020_Type="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapall="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapico="" KpiDescription="Test 01" StartDate="5/31/2012" Lead="<span class="ms-imnSpan"><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a></span>" Lead.id="16" Lead.title="Jane Doe" Lead.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/></span></nobr>" Location="Babbage 301" Max_x0020_no_x0020_people="100" Max_x0020_no_x0020_people.="100.000000000000" Max_x0020_no_x0020_reserves="5" Max_x0020_no_x0020_reserves.="5.00000000000000" ID="1" ContentType="Item" Modified="5/28/2012 12:36 PM" Created="5/28/2012 11:14 AM" Author="<span class="ms-imnSpan"><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_17,type=smtp'/></a><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a></span>" Author.id="16" Author.title="Jane Doe" Author.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_18,type=smtp'/></a></span></nobr>" Editor="<span class="ms-imnSpan"><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_19,type=smtp'/></a><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a></span>" Editor.id="16" Editor.title="Jane Doe" Editor.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_20,type=smtp'/></a></span></nobr>" _HasCopyDestinations="" _HasCopyDestinations.value="" _CopySource="" owshiddenversion="2" owshiddenversion.="2" WorkflowVersion="1" WorkflowVersion.="1" _UIVersion="512" _UIVersion.="512" _UIVersionString="1.0" Attachments="0" _ModerationStatus="Approved" _ModerationStatus.="0" LinkTitleNoMenu="Test 01" LinkTitle="Test 01" LinkTitle2="Test 01" SelectTitle="1" InstanceID="" InstanceID.="" Order="100" Order.="100.000000000000" GUID="{50770C6D-A7B0-48F3-AA35-91A576803FF6}" WorkflowInstanceID="" FileRef="/sites/heg/Lists/signup/1_.000" FileRef.urlencode="%2Fsites%2Fheg%2FLists%2Fsignup%2F1%5F%2E000" FileRef.urlencodeasurl="/sites/heg/Lists/signup/1_.000" FileDirRef="/sites/heg/Lists/signup" Last_x0020_Modified="5/28/2012 11:14 AM" Created_x0020_Date="0;#2012-05-28 11:14:58" Created_x0020_Date.ifnew="" FSObjType="0" SortBehavior="0" PermMask="0x7fffffffffffffff" FileLeafRef="1_.000" FileLeafRef.Name="1_" FileLeafRef.Suffix="000" UniqueId="{123F06E6-C7C9-455B-BA98-5A818FCF95D4}" SyncClientId="" ProgId="" ScopeId="{F73AF7C0-59A1-4A38-A1FF-D6600650485E}" HTML_x0020_File_x0020_Type="" _EditMenuTableStart="1_.000" _EditMenuTableStart2="1" _EditMenuTableEnd="1" LinkFilenameNoMenu="1_.000" LinkFilename="1_.000" LinkFilename2="1_.000" DocIcon="" ServerUrl="/sites/heg/Lists/signup/1_.000" EncodedAbsUrl="https://sub.mydomain.co.uk/sites/heg/Lists/signup/1_.000" BaseName="1_" MetaInfo="" MetaInfo.="1;#" _Level="1" _Level.="1" _IsCurrentVersion="Yes" _IsCurrentVersion.value="1" ItemChildCount="0" FolderChildCount="0"></Row>
      <Row ContentTypeId="0x010065D6ABB14ACC8841AF4B3B24773A8454" Title="Test 02" _ModerationComments="" File_x0020_Type="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapall="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon="" HTML_x0020_File_x0020_Type.File_x0020_Type.mapico="" KpiDescription="Test 02" StartDate="6/2/2012" Lead="<span class="ms-imnSpan"><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=15">John Doe</a></span>" Lead.id="15" Lead.title="John Doe" Lead.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=15">John Doe</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/></span></nobr>" Location="PSQ 508" Max_x0020_no_x0020_people="" Max_x0020_no_x0020_people.="" Max_x0020_no_x0020_reserves="" Max_x0020_no_x0020_reserves.="" ID="2" ContentType="Item" Modified="5/28/2012 12:37 PM" Created="5/28/2012 11:15 AM" Author="<span class="ms-imnSpan"><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_21,type=smtp'/></a><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a></span>" Author.id="16" Author.title="Jane Doe" Author.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_22,type=smtp'/></a></span></nobr>" Editor="<span class="ms-imnSpan"><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_23,type=smtp'/></a><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a></span>" Editor.id="16" Editor.title="Jane Doe" Editor.span="<nobr><span><a onClick="GoToLink(this);return false;" href="/sites/heg/_layouts/userdisp.aspx?ID=16">Jane Doe</a><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><a href='javascript:;' onclick='IMNImageOnClick(event);return false;' class='ms-imnlink'><img name='imnmark' class='ms-imnImg' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='Jane.Doe@email.co.uk' id='imn_24,type=smtp'/></a></span></nobr>" _HasCopyDestinations="" _HasCopyDestinations.value="" _CopySource="" owshiddenversion="3" owshiddenversion.="3" WorkflowVersion="1" WorkflowVersion.="1" _UIVersion="512" _UIVersion.="512" _UIVersionString="1.0" Attachments="0" _ModerationStatus="Approved" _ModerationStatus.="0" LinkTitleNoMenu="Test 02" LinkTitle="Test 02" LinkTitle2="Test 02" SelectTitle="2" InstanceID="" InstanceID.="" Order="200" Order.="200.000000000000" GUID="{374C1FC9-C4B2-4EC0-85DD-7D18114462D2}" WorkflowInstanceID="" FileRef="/sites/heg/Lists/signup/2_.000" FileRef.urlencode="%2Fsites%2Fheg%2FLists%2Fsignup%2F2%5F%2E000" FileRef.urlencodeasurl="/sites/heg/Lists/signup/2_.000" FileDirRef="/sites/heg/Lists/signup" Last_x0020_Modified="5/28/2012 11:15 AM" Created_x0020_Date="0;#2012-05-28 11:15:08" Created_x0020_Date.ifnew="" FSObjType="0" SortBehavior="0" PermMask="0x7fffffffffffffff" FileLeafRef="2_.000" FileLeafRef.Name="2_" FileLeafRef.Suffix="000" UniqueId="{E0BA736D-BE1E-486F-BBC3-A0CC6E6C8540}" SyncClientId="" ProgId="" ScopeId="{F73AF7C0-59A1-4A38-A1FF-D6600650485E}" HTML_x0020_File_x0020_Type="" _EditMenuTableStart="2_.000" _EditMenuTableStart2="2" _EditMenuTableEnd="2" LinkFilenameNoMenu="2_.000" LinkFilename="2_.000" LinkFilename2="2_.000" DocIcon="" ServerUrl="/sites/heg/Lists/signup/2_.000" EncodedAbsUrl="https://sub.mydomain.co.uk/sites/heg/Lists/signup/2_.000" BaseName="2_" MetaInfo="" MetaInfo.="2;#" _Level="1" _Level.="1" _IsCurrentVersion="Yes" _IsCurrentVersion.value="1" ItemChildCount="0" FolderChildCount="0"></Row>
  </signup-list>
</dsQueryResponse>
share|improve this question
    
From which xsl template are you calling the xpath? (i.e. dvt_1.rowview) –  Andrey Markeev Jun 6 '12 at 12:32
    
yes, dvt_1.rowview - thanks for replying –  hanspan Jun 6 '12 at 12:55

2 Answers 2

up vote 0 down vote accepted

Update: Based on the data sample provided in the question update, I think this XPath should work for you:

count(/dsQueryResponse/signup-attendees/Rows/Row[@Signup_x0020_ID_x0020_Lookup_x00=current()/@ID])

This query means: in signup-attendees list, select all rows, having Signup_x0020_ID_x0020_Lookup_x00 attribute of a row equal to ID attribute of the current element. Current element must point to a row of the events list, i.e. /dsQueryResponse/signup-list/Rows/row.

Haven't tested, but should work.

So your main mistake was that you pointed to wrong attribute. Basically, there was no "@Signup_ID_Lookup" attribute at all. Spaces in field title are replaced with _x0020_ when SharePoint generates field internal name based on title.

Second point was that there are few attributes in DVWP data source for each lookup field:

  1. Signup_x0020_ID_x0020_Lookup contains HTML with link, which is displayed to user.
  2. Signup_x0020_ID_x0020_Lookup. contains lookup data in SharePoint format, id and title of the lookup item separated by ";#"
  3. Signup_x0020_ID_x0020_Lookup_x00 contains ID of lookup item
  4. Signup_x0020_ID_x0020_Lookup_x000 contains Title of lookup item
share|improve this answer
    
Thanks Andrey, this is similar to the second example I gave in my question which returns 4; 4; 4; I'm wondering if the problem might be that I'm in the wrong template to be trying to count the number of attributes with the sign_up_id equal to the original ID. Your thoughts? –  hanspan Jun 6 '12 at 15:18
    
Anyway, maybe I understand the question wrong or the data structure. If I was right, the query must succeed, there is no doubt. Could you find the root template (match="/") and place code <textarea cols="80" rows="6"><xsl:copy-of select="/" /></textarea> there, and then update your question with the string you get in the textarea? This will allow me to come up with the precise answer. –  Andrey Markeev Jun 7 '12 at 6:14
    
I've updated the answer. Hope it helps this time. Warning, though: if the data your provided is correct, I'm afraid events Test01 and Test02 will both get only 1 attendee counted in. Please, examine the data closely: Signup 01 points to event Test 02, Signup 02 -> Test 03, and Signup 04 -> Test 01. –  Andrey Markeev Jun 7 '12 at 9:21
    
You are correct on all accounts, I removed the incorrect list item for the example to be able to squeeze in my update. Thank you for your response above, I however am still not getting what I would expect (when executed on the full data set) - the result is now 0; 0; 0; I must thank you for your persistance with my query. –  hanspan Jun 7 '12 at 9:32
    
Ooops, sorry. I've missed "Rows" in the query. Please, see the updated answer. –  Andrey Markeev Jun 7 '12 at 10:55

This is a must customized approach. Use the OOTB functionality.

Follow the steps:

  1. Select your dataview webpart (in Sharepoint Designer).
  2. Go to ribbon and select 'Filter'.
  3. Group By : Event Id (Ascending/Descending)
  4. Check the checkbox - 'Show Group Header'
  5. Click on the button 'Advanced Sort Expression' and select the checkbox 'Show group totals'
  6. Now you would be having your desired output.
  7. In dvt_1.body comment the template call to rowview & groupheader0 or remove them: <!-- <xsl:call-template name="dvt_1.rowview/> -->
  8. In dvt_1.groupfooter0, modify the layout as per your wish.

(There would not be any need of custom coding. Also, steps 7 and 8 are optional.)

share|improve this answer
    
The option to Group/Ungroup is greyed out for me. –  hanspan Jun 7 '12 at 10:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.