Here is an adapted stylesheet
<xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:t="http://www.taleo.com/ws/integration/toolkit/2005/07"exclude-result-prefixes="t"><xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/><xsl:key name="distinctRecord" match="t:record" use="t:field[@name='clientjobid']" /><xsl:template match="/"><jobs> <xsl:for-each select="//t:record[generate-id(.) = generate-id(key('distinctRecord', t:field[@name='clientjobid'])[1])]"> <xsl:variable name="clientjobid" select="t:field[@name='clientjobid']" /> <job> <action><xsl:value-of select="t:field[@name='action']" /></action> <clientjobid><xsl:value-of select="$clientjobid" /></clientjobid> <customfield1> <xsl:for-each select="key('distinctRecord', $clientjobid)"> <xsl:if test="position() != 1">, </xsl:if> <xsl:value-of select="t:field[@name='customfield1']"/> </xsl:for-each> </customfield1> </job> </xsl:for-each></jobs></xsl:template></xsl:stylesheet>