Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8132655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:23:51+00:00 2026-06-06T09:23:51+00:00

I am working with a data view web part in SPD 2010. My xml

  • 0

I am working with a data view web part in SPD 2010. My xml structure is as follows:

<ProjectGroups>
    <ProjectGroup>
        <GroupID>1</GroupID>
        <ProjectName>Project 1</ProjectName>
    </ProjectGroup>
    <ProjectGroup>
        <GroupID>2</GroupID>
        <ProjectName>Project 2</ProjectName>
    </ProjectGroup>
    <ProjectGroup>
        <GroupID>2</GroupID>
        <ProjectName>Project 3</ProjectName>
    </ProjectGroup>
    </ProjectGroups>

This is a rollup web part, so what I am looking to do is get a count of Projects under each Project group. For my example above, Group ID 1 has 1 project, Group ID 2 has 2. I am sure there’s a way to do this, but I’m sort of learning xslt on the fly, so I’m not sure exactly what to do. Any help is appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:23:52+00:00Added an answer on June 6, 2026 at 9:23 am

    This style-sheet …

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
    
    <xsl:key name="groups" match="ProjectGroup" use="GroupID" />
    
    <xsl:template match="@*|node()">
     <xsl:copy> 
       <xsl:apply-templates select="@*|node()" />
     </xsl:copy> 
    </xsl:template>
    
    <xsl:template match="ProjectGroup[generate-id()=generate-id(key('groups',GroupID)[1])]">
     <xsl:copy> 
       <xsl:apply-templates select="@*" />
       <xsl:attribute name="count-of-projects">
         <xsl:value-of select="count(key('groups',GroupID))" />
       </xsl:attribute>
       <xsl:apply-templates select="node()" />
     </xsl:copy> 
    </xsl:template>
    
    </xsl:stylesheet>
    

    … when applied to your input, will produce …

    <?xml version="1.0" encoding="utf-8"?>
    <ProjectGroups>
        <ProjectGroup count-of-projects="1">
            <GroupID>1</GroupID>
            <ProjectName>Project 1</ProjectName>
        </ProjectGroup>
        <ProjectGroup count-of-projects="2">
            <GroupID>2</GroupID>
            <ProjectName>Project 2</ProjectName>
        </ProjectGroup>
        <ProjectGroup>
            <GroupID>2</GroupID>
            <ProjectName>Project 3</ProjectName>
        </ProjectGroup>
    </ProjectGroups>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on creating a grouped table view. The data is being loaded alright,
I'm working with XML data from an application where we get XML like this:
I have a very simple web part. I have a single grid view, which
I'm working on a web application framework, which uses MSSQL for data storage, mostly
i'm currently working on iphone app which has a web view. i'm pulling a
My usual way of working on web development is to split the project into
I'm working on my first homework project in a web programming class, which is
Part I I am working on a web application that instead of using a
The following is the data I am working on: __DATA__ Node 1: 98 debug
im working with core-data for the first time, and my app is handling a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.