xsl-list
[Top] [All Lists]

Re: Grouping / unique list with just XPath

2005-11-17 16:05:34


The problem is that I don't know the schema of the incoming files but
they're channeled through a recursive single template, so fiddling
around with keys to capture something that I currently trap in
<xsl:choose /> contraptions seem a bit tricky,

I don't really understand why you can't use keys. You indicated you
could use the another suggested method

select="$variable/member[(_at_)ref-id!=preceding-sibling::member/@ref-id]"
This will catch the first ref-id of each value.

You need to know exactly the same information to use this method, the
element names member and the attribute name ref-id, and one form can be
mechanically converted to the other:

<xsl:key name="m" name="match" use="@ref-id"/>
...
<xsl:for-each 
select="$variable/member[generate-id()=generate-id(key('m',@ref-id))]">

well that selects the first member with each id, rather than just
testing for first sibling, you can add the idof the parent if you need
that.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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