Process Overview

The process of using the XQuery mapper to build a new XQuery consists of the following steps:

1. Create a new XQuery file in Stylus Studio (File > New > XQuery File).
2. Click the Mapper tab in the XQuery editor.
3. Add one or more source documents.
4. Specify a target structure.
5. Map source document nodes to target structure nodes. As part of this step, you can optionally define function, FLWOR (For each, Let, Where, Order by, Return), If, and condition blocks to perform actions on source document nodes and map the return value to the target structure node.

Stylus Studio uses the information expressed on the Mapper tab to compose an XQuery that returns as its result an XML document that conforms to the structure represented by the target structure you specify.

Each of these steps is described in greater detail in the following sections.

Working with Existing XQueries

You can, of course, open an existing XQuery in Stylus Studio. When you do, the XQuery Source page displays the XML used to compose the XQuery, and the Mapper tab displays the source documents, target structure, and source-target mappings that can be inferred from the source XQuery file. All of the procedures described in this section can be performed on new or existing XQuery files.

Saving the Mapping

You can save the XQuery mapping - source and target document trees, as well as the contents of the Mapper canvas - as an image. See Exporting Mappings.

Free Stylus Studio XML Training:
W3C Member