[xquery-talk] if statement inside FLWOR-expressions

Piewald, Georg georg.piewald at siemens.com
Fri Aug 22 10:22:30 PDT 2008


Hi,

I'm very new to Xquery and don't know much more than what I've read in a
tutorial. Now I have trouble with a query where I need an if-statement
inside a FLWOR-expression. The following minimal example shows the
problem:

    for $item in (1 to 5)
        if ($item < 3) then 
            let $var := 'abc'
        else
            let $var := 'def'
        return 
            <p>Text {$var}</p>

The 'if' doesn't seem to be permitted after the for, I get an error
message
  "Parse error: element name containing whitespace: unexpected token:
if"
What can I do to solve this?

Thanks, Georg



More information about the talk mailing list