Subject: Re: mapping (Was: Re: [xsl] Re: . in for) From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 11 Jan 2002 16:19:41 +0000 |
Mike wrote: >> The lambda expression syntax might be somewhat tricky to get right, >> "expression(expr,arg,...)" may be too much like a function >> invocation. Perhaps #(arg1,arg2,...,expr) ? > > Syntax is always difficult to get right! I've suggested in the past > using > > [arg1, arg2; expr] Neat. I'd like seeing predicates as a shorthand of this - [expr] giving a lambda expression with an implicit single argument of '.'. If this was intended as a future extension, a syntax for a simple mapping expression could then be: Expr ("map" "[" Expr "]")+ > (But there are people in the XQuery WG who like keyword-based syntax > and mock this kind of thing as "line noise". Those people might > prefer something like "with $arg1, $arg2 return expr". You could > give examples using both syntaxes to avoid that criticism.) <grumble> Can we mock keyword-based syntax back? It's alright for them with their ability to write 50 lines of this stuff in a document - we have to put it in attributes! </grumble> > You get a spin-off of being able declare range variables in a predicate: > > customer[$c; exists($c/orders[preferred-customer=$c])] Hubba hubba. Or that one David thought he'd solved: $x//*[$e; not(following::*[name()=name($e)])] > The one we are currently inventing is "distinct" (select the items in $x > that have distinct values for f(x)). So it might be a good idea to take that > as your exemplar, pointing to the (known) limitations of the current > distinct-values() function. > > distinct(employee, [$emp; $emp/@SSN]) If you adopt sequence constructors then you can use XSLT's grouping facility ;) <xsl:for-each-group select="employee" group-by="@SSN"> <xsl:item select="." /> </xsl:for-each-group> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: mapping (Was: Re: [xsl] Re: . i, Michael Kay | Thread | Re: mapping (Was: Re: [xsl] Re: . i, naha |
RE: [xsl] Selecting first descendan, Oleg Tkachenko | Date | [xsl] passing in a variable to the , Todd Binder |
Month |