XQuery/HelloWorld

Motivation
You want to run a small program that tests to see if your XQuery execution environment is working.

XML Output
[/basics/helloWorld.xq Execute]

Discussion
The program creates a temporary variable called  and assigns it a string value. The output is an XML element containing a message element which contains the value of the variable.

Suggestions
Try omitting the curly braces from inside of the result message element. What do you get? [/basics/helloWorld-1.xq Execute]

What happens if you omit the results wrappers? [/basics/helloWorld-2.xq Execute]

Plain Text
You can get XQuery to return plain text using serialization options which define the serialization and the output media-type.

For example to output the message as text, specify the serialization as text and the media-type as text/plain.

[/basics/helloWorld-3.xq Execute]

Expected Output
Depending on your browser set-up, this will launch a viewer for text documents and display

Hello World!

XQuery/HelloWorld