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

Re: 99 bottles of beer

Subject: Re: 99 bottles of beer
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 6 Feb 2007 10:18:21 +0000
Re:  99 bottles of beer
On 2/5/07, Abel Braaksma <abel.online@xxxxxxxxx> wrote:
Andrew Welch wrote:
>
> The difference there is that (1 to 2) != 10 returns a sequence of 2
> items "true true", whereas (1,2) != 10 returns a single "true".  I
> would have to look it up but I think anything other than a single
> "true" converts to false, so "true true" returns false.
>
> You could rewrite it as ((1 to 2) != 10) = false() to check the values
> in the sequence for any occurance of false(), and return a single
> true/false.

I read an reread it, and in either case misread it. But now I see my
mistake, and it is pretty simple really (well, it took me a couple of
hours, hope that others grasp it quicker ;)  Let's put my thoughts to paper.

Yes, sorry about that, I got that wrong. I should do a couple hours of spec reading too as punishment...


Thanks Andrew, for the mind exercise, it was fun getting the grips
(almost) to some less-than-obvious stuff.

:) I'm glad you didn't see it the other way and get really annoyed with the misinformation.


Note that the trick you mentioned, does not work, because the first part
(before '= false()') does not return a sequence of all false/true
values, it returns, as I see it, a sequence of one item.

((1 , 3) != 4) = false()

returns the opposite of

((1 , 3) != 4) = true()

for all tests above (replace (1, 3) with (1 to 3) to see the effect).

Yes, I was basing all this on:


for $i in (1 to 3) return $i != 4

which I thought was equivalent to:

(1 to 3) != 4

and based on my incorrect assumptions of the above producing a
sequence of booleans I thought it could be rewritten to:

((1 to 3) != 4) = true()

whereas it must be:

(for $i in (1 to 3) return $i != 4) = true()

Again, sorry about that.

cheers
andrew

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.