xsl-list
[Top] [All Lists]

Re: [xsl] removing duplicate elements based on two or more childs

2009-08-25 11:23:16

    <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[(_at_)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. 
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>