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 9176259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:04:27+00:00 2026-06-17T17:04:27+00:00

I am trying to get multiple html documents for every User in an XML

  • 0

I am trying to get multiple html documents for every User in an XML document using XSLT based on the answer in: how to apply group by on xslt elements however without succes.

XML:

<root>
  <ArrayOfResult>
    <Result>
      <Men>
        <BowlerResult>
          <Person>
            <Name>name 1</Name>
          </Person>
          <Data>
            <Score1>1</Score1>
            <Score2>1</Score2>
            <Score3>1</Score3>
          </Data>
        </BowlerResult>
        <BowlerResult>
          <Person>
            <Name>name 2</Name>
          </Person>
          <Data>
            <Score1>2</Score1>
            <Score2>2</Score2>
            <Score3>2</Score3>
          </Data>
        </BowlerResult>
      </Men>
      <Women>
        <BowlerResult>
          <Person>
            <Name>name 3</Name>
          </Person>
          <Data>
            <Score1>3</Score1>
            <Score2>3</Score2>
            <Score3>3</Score3>
          </Data>
        </BowlerResult>
      </Women>
    </Result>
    <Result>...</Result>
  </ArrayOfResult>
  <ArrayOfResult>...</ArrayOfResult>

Person can be in more Leagues

What I want to achieve:
for every Person (distinct on Person/Name) i want to accumulate data from all ‘BowlerResult’ elements

The XSLT I have right now:

<xsl:key name="keyPerson" match="BowlerResult" use="Person/Name" />

<xsl:template match="text()" />

<xsl:template match="/root">
  <root>
    <xsl:apply-templates />
  </root>
</xsl:template>

<xsl:template
 match="BowlerResult[generate-id(.)=generate-id(key('keyPerson',Person/Name)[1])]">
  <Person value="{Person/Name}">
    <xsl:for-each select="key('keyPerson', Person/Name)">
      <Result>
        <id>
          <xsl:value-of select="Person/Name" />
        </id>
      </Result>
    </xsl:for-each>
  </Person>
</xsl:template>

But this only gives me the an iteration of the first Person.

  • 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-17T17:04:28+00:00Added an answer on June 17, 2026 at 5:04 pm

    Your XSLT has a bunch of issues but the main problem here was that the first template has a path that doesn’t match anything (TeamResult is not directly under root and there is no Result element. Also, the key is named “keyPerson”, not “keyBowler”.

    This XSLT successfully groups the players once per player. Could you give it a try? (n.b. the actual input XML uses element names BowlerResult and Bowler)

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" indent="yes"/>
    
      <xsl:key name="keyPerson" match="BowlerResult" use="Bowler/Name" />
    
      <xsl:template match="text()" />
    
      <xsl:template match="/root">
        <root>
          <xsl:apply-templates />
        </root>
      </xsl:template>
    
      <xsl:template
       match="BowlerResult[generate-id(.)=generate-id(key('keyPerson',Bowler/Name)[1])]">
        <xsl:variable name="name" select="Bowler/Name" />
        <Person value="{$name}">
          <xsl:for-each select="key('keyPerson', $name)">
            <Result>
              <id>
                <xsl:value-of select="$name" />
              </id>
            </Result>
          </xsl:for-each>
        </Person>
      </xsl:template>
    
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to get multiple xml files into my xsl file to
I am trying to get a multiple upload library working for my Codeigniter based
I'm trying to get an example that I found for using XSLT 2.0 to
I am trying to match multiple CSS style code blocks in a HTML document.
What I'm trying to do is to parse multiple entries from xml to html!
I have a question about the JFileChooser in Swing. I'm trying to get multiple
In short: How do I access LocationManagerService.mProximityAlerts ? I'm trying to get multiple ProximityAlerts
I am trying to get my query to grab multiple rows while returning the
I'm trying to get col1 values for certain multiple col2 values. For example: I
I am trying to get jquery validate to work on multiple fields. Reason being

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.