[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: combining common data within groups.
Andy.Lewis@xxxxxxxxxxx wrote:
This is a new area for me. Need to eliminate duplicates that occur within sub-groups. Here is a stylesheet sample: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:key name="by-value" match="box_sizes" use="concat(generate-id(parent::boxes), '_', value)"/> <xsl:template match="root"> <xsl:copy> <xsl:apply-templates select="color1"/> <xsl:apply-templates select="boxes"/> </xsl:copy> </xsl:template> <xsl:template match="boxes"> <xsl:copy> <box_sizes> <xsl:apply-templates select="box_sizes[generate-id() = generate-id(key('by-value', concat(generate-id(parent::boxes), '_', value))[1])]/value"/> </box_sizes> </xsl:copy> </xsl:template> <xsl:template match="*"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:stylesheet> -- Martin Honnen http://JavaScript.FAQTs.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|