This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Preceding: can't filter my nodes?
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: Preceding: can't filter my nodes?
- From: Kay Michael <Michael dot Kay at icl dot com>
- Date: Tue, 12 Sep 2000 17:36:06 +0100
- Reply-To: xsl-list at mulberrytech dot com
> I'm trying to get a unique set of nodes. I can't seem to tie
> the preceding
> axis to a filter on a given ID. I have tried filtering that
> node set into a
> variable and then getting a unique list from that, but I am
> still operating
> on the whole node set.(abbreviated XML below)
>
> <xsl:variable name="ats" select="/ROWSET/ROW[R_ID='14144']"/>
> <xsl:for-each select="$ats/AT_ID[not(.=preceding::AT_ID)]">
> <at_id><xsl:value-of select="."/></at_id>
> </xsl:for-each>
"preceding", like all the other axes, means "preceding in the source
document", not "preceding in the node-set".
I'm tempted to suggest the saxon:distinct() function, but I know that's
cheating! select="saxon:distinct($ats/AT_ID)"
Perhaps you want
select="$ats/AT_ID[not(.=preceding::AT_ID[ancestor::ROW[R_ID='14144']]]">
but it looks horribly inefficient. If you want a solution that's both
portable and efficient, it will probably use keys.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list