Hi Thufir -

Maybe something like this will help?

```
xquery version "3.1";

let $y := 99

for $x in (1 to 9)
count $iterator
let $decrease := $y - $iterator
return(
  comment { "iterator = " ||  $iterator },
  comment { "decrease = " || $decrease },
  <xy x='{ $x }' y='{ $decrease }'/>
)
```

I'm basically ripping Walmsley's book off for this example -- see pages ~135-7 (examples P-6,7). The `count` clause makes this work.

Best,
Bridger

PS Remember, the first step in avoiding a *trap* is knowing of its existence. :)

On Wed, Feb 19, 2020 at 10:33 AM thufir <hawat.thufir@gmail.com> wrote:
How do I decrement y?

Pardon, output for a simpler example:

<xy x="1" y="98"/>
<xy x="2" y="98"/>
<xy x="3" y="98"/>
<xy x="4" y="98"/>
<xy x="5" y="98"/>
<xy x="6" y="98"/>
<xy x="7" y="98"/>
<xy x="8" y="98"/>
<xy x="9" y="98"/>

the FLWOR:

xquery version "3.0";
let $y := 99
for $x in (1 to 9)
  let $y := $y - 1
return <xy x='{$x}' y='{$y}' />


is it not possible to decrement $y without using some external scripting
function?  That seems odd.


thanks,

Thufir