My xml looks something like this:

     <Row alphakey="doejohn" building="abc" class="Algebra" />
     <Row alphakey="doejohn" building="abc" class="Geometry" />
     <Row alphakey="personbob" building="abc" class="Calculus" />
     <Row alphakey="personbob" building="abc" class="Precalc" />

And basically I need it to output like this:

Alphakey       Classes
doejohn        Algebra, Geometry
personbob      Calculus, Precalc

I've searched for how to do this with a merge, but I can't quite figure it out, and most examples look different from what I am trying to do. Can someone help me with this?

6 Years
Discussion Span
Last Post by Erwan Amoureux

It's a gouping problem.
In XSLT 1.0 we have to use muench method

First step : eliminate double
second step : call all element with same "key" value

<?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" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:key match="Row" use="@alphakey" name="row"></xsl:key>
	<xsl:template match="/">
			<xsl:for-each select="/*/Row[generate-id(.)=generate-id(key('row',@alphakey)[1])]"><tr>
				<td><xsl:value-of select="@alphakey"></xsl:value-of></td><td><xsl:apply-templates select="key('row',@alphakey)"></xsl:apply-templates></td>
	<xsl:template match="Row">
	<xsl:value-of select="@class"></xsl:value-of>;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.