Subject: Re: [xsl] removing duplicate elements based on two or more childs From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 25 Aug 2009 16:22:48 +0100 |
<xsl:template match="record"> <xsl:if test="//term[not (. = preceding::term)]"> <note>This is a new record</note> the test here does not depend on the record element being matched //term[not (. = preceding::term)] will have the same value wherever it is evaluated in the document, and be true if there are any terms in the document, and false otherwise. In a boolean context it is the same as //term the predicate [not (. = preceding::term)] is always true on the first term (if there is a term) in xslt2 something like <xsl:for-each-group select="record" group-by="string-join( for $l in ('fra','eng') return lang[@id=$l]/term,':')"> <xsl:copy-of select="."/> </xsl:for-each-group> would do what you ask, I think. David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] removing duplicate elemen, Manuel Souto Pico | Thread | [xsl] Fwd: XSLT2toXQuery transforma, Xmlizer |
Re: [xsl] Zipping xsl:result-docume, Martynas Jusevicius | Date | Re: [xsl] generate an element only , Manuel Souto Pico |
Month |