XQuery Editor - Mapper Tab

 

XQuery support is available only in Stylus Studio XML Enterprise Suite and Stylus Studio XML Professional Suite.

The XQuery mapper allows you to construct an XQuery graphically, without writing any code, by mapping elements from one or more source documents to a target structure. Stylus Studio uses these source/target mappings to define an XQuery that returns a document that conforms to the target structure you build.

Nodes on the target structure can be inferred from an existing document, or you can create them (either from scratch or by copying source document nodes to the target structure).

How to Map

To map a source document node to an existing target structure node, drag and drop the source element using the left mouse button.

To use a source document node to create a new node on the target structure, drag and drop the source element using the right mouse button and select one of the following operations from the shortcut menu:

  • Add Attribute and Map It
  • Add Child Element and Map It
  • Insert Element After and Map It
  • Copy Node

Fields

Create Scenario

A scenario allows you to preview the results of applying an XQuery. Scenario settings include the name of an XML source document, the values of any parameters in the XQuery script, and the type of performance metrics you want Stylus Studio to capture, if any. XQuery scenarios are optional.

To create a scenario, click to the right of the scenario name field. After you create the first scenario, the name of the current scenario appears in this field.

Click the down arrow to select a previously defined scenario. Click Preview Result to apply the XQuery in the context of the selected scenario. Stylus Studio displays the results of applying the stylesheet in the Preview window.

Source file name

Click here to change the name of the source XML document you want to use to perform the mapping. When the mapping is complete, you will have a stylesheet that you can apply to documents that have the same schema as this document.

Destination file name

Click here to change the name of the target XML document you want to use to perform the mapping. When the mapping is complete, you will have a stylesheet that generates XML documents that have the same schema as this document.

Buttons

Preview Result runs the XQuery. Information from the current scenario is used to run the XQuery if a scenario has been created.

Change Font changes the font of the text display in Stylus Studio. This change affects only the Stylus Studio display. Beyond personal preference, this is useful for localization. The fonts that are available are the fonts that can display the characters in your XML file.

displays the Scenario Properties dialog box. Use this dialog box to define a new scenario, update the settings for a scenario, or view information about a scenario.

Add Source Schema displays the Open dialog box and lets you select a source document for the XQuery mapper. Stylus Studio uses the first document you select as the default source XML for the scenario. You can use multiple sources in the XQuery mapper.

Set Target Schema displays the Open dialog box so you can select a target document for the XQuery mapper. You can create a target document from scratch - right click in the Set Target Schema canvas and select Create Root Element.

For More Information

Building an XQuery Using the Mapper

Creating an XQuery Scenario

XQuery Editor - XQuery Source Tab

 
Free Stylus Studio XML Training:
W3C Member