Good day,
Thank you for the information. I have changed it accordingly and nothing
seems to happen. I have checked to see if I did everything, checked for any
inconsistancies like an extra bracket but still nothing happened. I replace
every instance of "sample_date_time" with "concat(sample_date_time,
cp_name)".
This is what I have done
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<!-- the key determines (here) what to group by -->
<xsl:key name="sample" match="sample" use="concat(sample_date_time,
cp_name)" />
<xsl:template match="/">
<submission imis_company_code="0001843309" ws_name="LENNOX">
<xsl:apply-templates />
</submission>
</xsl:template>
<xsl:template match="dataroot">
<!-- the actual 'group by' construct -->
<xsl:for-each select="sample[generate-id() =
generate-id(key('sample', concat(sample_date_time, cp_name)[1])]">
<xsl:copy>
<!-- date-time must become an attribute -->
<xsl:apply-templates select="concat(sample_date_time,
cp_name)" />
<!-- find all samples with equal date time -->
<xsl:apply-templates select="key('sample',
concat(sample_date_time, cp_name))" />
</xsl:copy>
</xsl:for-each>
</xsl:template>
<!-- match the sample's that are grouped -->
<xsl:template match="sample">
<result>
<xsl:apply-templates select="*[not(self::concat(sample_date_time,
cp_name))]" />
</result>
</xsl:template>
<!-- any direct child of 'sample' must be turned into an attribute -->
<xsl:template match="sample/*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
Regards.
Hennie
_________________________________________________________________
Message offline contacts without any fire risk!
http://www.communicationevolved.com/en-za/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--