[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Grouping / unique list with just XPath

Subject: Re: Grouping / unique list with just XPath
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 17 Nov 2005 23:05:34 GMT
xpath unique list
> 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[@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
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.