|
Subject: [xsl] select distinct From: Richard Lander <rlander@xxxxxxxxxxxxx> Date: Fri, 15 Dec 2000 16:45:44 -0800 |
Hello,
I'm having some trouble with selecting distinct nodes (no duplicates). I am
using the following algorithm at the moment, which works, but am wondering
if there is something more elegant. generate-id() seems too heavy-handed.
<xsl:template name="element">
<xsl:param name="path"/>
<xsl:for-each select="$path//xdr:element">
<xsl:if test="self::xdr:element[generate-id() =
generate-id($path//xdr:element[@type = current()/@type][1])]">
<A href="javascript:element('{@type}')">
<xsl:value-of select="@type"/>
</A>
</xsl:if>
</xsl:for-each>
</xsl:template>
I don't have my Mike Kay book beside me at the moment, so can't look for any
tips on this likely well-documented problem.
I will mention that the elements are not all siblings. Some are, some are
further down. The input looks like:
x
x
x
y
x
x
x
y
x
x
x
x
x
I'm trying to get all the x elements with distinct @type values.
Thanks,
Rich
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Off-topic on Schemas..., sara . mitchell | Thread | Re: [xsl] select distinct, Francis Norton |
| [xsl] Off-topic on Schemas..., sara . mitchell | Date | Re: [xsl] select distinct, G. Ken Holman |
| Month |