[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: mapping (Was: Re: Re: . in for)
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|