Altova Mailing List Archives
>xsl-list Archive Home
>Recent entries
>Thread Prev - [xsl] xsl filtering duplicate nodes
[Thread Next]
Re: [xsl] xsl filtering duplicate nodes
To:
Date: 3/29/2001 3:45:00 AM
Hi Tom,
> I need to filter out only those nodes which have identical @id and
> @found attributes
One method would be to process all the Reference elements, but within
the template or xsl:for-each test whether there was a preceding
sibling with the same @id and @found as the current one, and only
process the element if there isn't:
<xsl:if test="not(preceding-sibling::Reference
[@id = current()/@id and
@found = current()/@found])">
...
</xsl:if>
The other way is to use the Muenchian method and create a key that
indexes the Reference elements based on their @id *and* @found, by
concatenating the two values together:
<xsl:key name="Reference-by-id-and-found"
match="Reference"
use="concat(@id, ':', @found)" />
You can then use:
Reference[count(.|key('Reference-by-id-and-found',
concat(@id, ':', @found))[1]) = 1]
to get the unique Reference elements. My reply to your earlier email
explained how this worked, so I won't repeat it.
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-listDisclaimer
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

