wrote:
> <psychology>
> <issue>
> <assigned_to>bob</assigned_to>
> <reporter>sjangity</reporter>
> </issue>
> <issue>
> <assigned_to>daniel</assigned_to>
> <reporter>bob</reporter>
> </issue>
> </psychology>
>
> How would the xslt look like anyone have any ideas? In the above
> sample, I want to be able to create 3 users in total (bob, sjangity,
> daniel).
Here is a sample XSLT 1.0 stylesheet:
<xsl:stylesheet
xmlns

sl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl

utput method="xml" indent="yes"/>
<xsl:key name="name" match="issue/*" use="."/>
<xsl:template match="/">
<users>
<xsl:apply-templates select="psychology/issue/*[generate-id() =
generate-id(key('name', .)[1])]"/>
</users>
</xsl:template>
<xsl:template match="issue/*">
<user><xsl:value-of select="."/></user>
</xsl:template>
</xsl:stylesheet>
XSLT 2.0 solution:
<xsl:stylesheet
xmlns

sl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl

utput method="xml" indent="yes"/>
<xsl:template match="/">
<users>
<xsl:for-each-group select="psychology/issue/*" group-by=".">
<user>
<xsl:value-of select="current-grouping-key()"/>
</user>
</xsl:for-each-group>
</users>
</xsl:template>
</xsl:stylesheet>
--
Martin Honnen
http://JavaScript.FAQTs.com/