[Solved] Separate duplicates from unique


If I understand correctly your explanation, you want to do something like:

XSL 1.0

<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 name="cust-by-charge" match="Customer" use="chargeto" />

<xsl:template match="/CustomerRecord">
    <Root>
        <Customer_PO>
            <xsl:copy-of select="Customer[count(key('cust-by-charge', chargeto)) > 1]"/>
        </Customer_PO>
        <Customer_Falty>
            <xsl:copy-of select="Customer[count(key('cust-by-charge', chargeto)) = 1]"/>
        </Customer_Falty>
    </Root>
</xsl:template>

</xsl:stylesheet>

Possibly there’s a more elegant approach that would count the size of each group only once.

0

solved Separate duplicates from unique