Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:36:43+00:00 2026-06-05T15:36:43+00:00

My XQuery knowledge is pretty lacking but I’m trying to play around with XQIB

  • 0

My XQuery knowledge is pretty lacking but I’m trying to play around with XQIB (XQuery in the Browser), but even just setting a variable errors

let $foo := "bar"

…generates the error

MXQuery output the following error during compilation:
Line 1, Column 18: err:XPST0003 Error while parsing FFLWOR Expr: 'return' expected!
let $foo := "bar"    ERROR                        
Unknown.anonymous(Unknown Source)

I’ve looked at the samples on the XQIB site, and it seems the let statements there are always in sub-routines, e.g. alerts or functions. Is this to suggest that in XQuery, code must always live in a function of sorts, rather than be free-standing?

For example, one of their examples is this, which of course works:

b:alert(
    let $x := <a><b>2</b><c>4</c></a>
    return xs:string($x/b * $x/c)
)

But this, my altered version, doesn’t.

let $x := <a><b>2</b><c>4</c></a>
b:alert(
    return xs:string($x/b * $x/c)
)

What’s up with the latter? Thanks in advance for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:36:46+00:00Added an answer on June 5, 2026 at 3:36 pm

    Your return is at the wrong position:

    let $x := <a><b>2</b><c>4</c></a>
    return
        b:alert(
            xs:string($x/b * $x/c)
        )
    

    You only need a return if you used some (part of a) flwor-expression. let starts one, so you will need return after it. As you haven’t got one as parameter, you don’t need (and neither are allowed) to put a return here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to XQuery and I'm trying to write an example function that
Newbie to XQuery. I am using XQIB (XQuery In the Browser, i.e. Zorba implemented
I want to use the Saxon-B XQuery class in my ASP.Net website. But my
According to this: http://www.xmlplease.com/xquery-xhtml XQuery does not have a standard way of setting the
I started playing around with XQuery . On [w3schools][1] its a good tutorial. I
I'm trying to construct XQuery that will return the count of the number attributes
Is it possible to make a link in an xquery file (.xq) a variable?
I'm trying to retrieve information from an Oracle database using XQuery. The table customer
I am having trouble finding good xQuery tutorials, basically what I am trying to
I'm trying to learn xQuery coming from a php background, I have this expression

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.