XQuery/Naming Conventions

Guidelines for wikibook authors

Our goal is to allow many people to contribute examples but allow our readers a consistent user experience. In that light we would like all of our authors to use some of the following standards.

Make sure you use the source tags to surround your code. If it is XML code use the lang="xml" attribute.

<source lang="xml">
...xml code here...
</source>

Try to keep the examples as simple as you can to demonstrate the core concepts of your examples.

Sample XQuery File

xquery version "1.0";
let $message := 'Hello World!'
return
<results>
   <message>{$message}</message>
</results>

Each XQuery file should begin with the word xquery and the version number.

xquery version "1.0";

Complex XQueries should have comments using the XQuery comments

xquery version "1.0";
 
(: This is a comment :)

File Name Conventions

Please use three space characters to indent your XQuery and XML examples. Do not use tabs. We use three characters because we use PDF output of these books and the printed pages have limited width.

Please do not exceed 70 characters per line. This helps formatting for printed versions of this Wikibook.

For XQuery scripts are stored inside the database please use the .xq suffix.

If you are running on a system that MUST be compatible with the three-letter Microsoft DOS file name extension please use the .xql file suffix.

For XQuery modules please use the suffix .xqm.

For each module that has unit tests use the suffix -test.xq.

Last modified on 18 December 2011, at 16:07