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

Re: RE: For expressions and / operator in XPath 2.0

Subject: Re: RE: For expressions and / operator in XPath 2.0
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 3 Jan 2002 14:57:08 +0000
Re:  RE: For expressions and / operator in XPath 2.0
Mike,

> Basically, binary operators (and, or, etc) are recognized in the
> same way as XPath 1.0, by virtue of the lexical token that precedes
> them. Function names are recognized by a following "(", axis names
> by a following "::"; "if" by a following "("; "for", "some", and
> "every" by a following "$". So keywords are disambiguated from
> element names by a single-token lookahead.

So you could make 'for' without range variables recognisable through a
following "(" as is done with 'if':

  "for" "(" Expr ")" "return" Expr

>> Say you had a sequence of numbers (conceptually coordinate pairs).
>> You could do a 'scale' operation by multiplying the pairs by 2:
>>
>>   $coordinates -> (. * 2)
>>
>> and then do a 'move' operation by adding 50 to the odd numbers:
>>
>>   $coordinates -> (. * 2) -> (if (position() mod 2) then . +
>> 50 else .)
>
> [Parochial question: does this example have something to do with the
> new algorithm for British vehicle registrations?]

Um, no :) I took inspiration from the transform attribute in SVG:

  transform="translate(50,0) scale(2)"

does a scale followed by a move.

I guess it was the 'adding 50 to the second half of the year' that
made you think of the vehicle registrations? You might do something
along those lines with:

  $years -> (. - 2000) -> (., . + 50)

Perhaps.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.