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

Re: Re: A question about the expressive power and limi

Subject: Re: Re: A question about the expressive power and limitations of XPath 2.0
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 13 Jan 2002 02:08:49 -0800 (PST)
 Re: Re: A question about the expressive power and limi
Hi Jeni,

> OK, let me think... a higher-order distinct function is an example.
> You have structured identifiers of the form "group.subgroup" and you
> want to return a unique set of nodes based on the "group" part of the
> identifier (note that Mike said they were discussion how to support
> this already, so perhaps there'll be a new 'distinct' clause added to
> the for expression to solve it). A recursive solution would be:
> 
> <xsl:function name="my:distinct">
>   <xsl:param name="nodes" type="node*" select="()" />
>   <xsl:param name="distinct" type="node*" select="()" />
>   <xsl:variable name="new-distinct"
>     select="if ($nodes[1] and
>                 some $n in ($distinct)
>                 satisfies (substring-before($n/@id, '.') =
>                            substring-before($nodes[1]/@id, '.')))
>             then ($distinct | $n)
>             else $distinct" />
>   <xsl:result select="if ($nodes)
>                       then my:distinct($nodes[position() > 2],
>                                        $new-distinct)
>                       else $distinct
> </xsl:function>

I'm sorry, but it's not absolutely obvious. Let's have an example:

$nodes contains:

a1.b1
a1.c1
a1.b1
a1.b1.c1

a2.b2
a2.c2
a2.b2
a2.b2.c2


Then what should be the result of distinct() ?

Cheers,
Dimitre.



__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.