Home > Online Product Documentation > Table of Contents > Creating an XQuery Scenario
An
XQuery scenario is a group of settings that you can associate with an XQuery. Stylus Studio uses scenario settings each time you preview the XQuery result. For example, if you specify an XML source document as a scenario setting, Stylus Studio runs the XQuery against that document when you click the
Preview Result button (
).
You can create multiple scenarios that use the same XQuery, and choose different settings for each. This flexibility can aid the XQuery development process as it enables you to easily test different applications of the XQuery before you put it online.
This section covers the following topics:
This section describes the main features of XQuery scenarios. It covers the following topics:
The main benefit of the XQuery scenario feature is that it lets you specify the XML document against which you want to run your XQuery. By default, Stylus Studio uses the first source document you add using the XQuery mapper as the XML source document for the scenario. You can specify the XML source document setting on the General tab of the Scenario Properties dialog box.
See Source Documents to learn more about the process of selecting and working with XQuery source documents in XQuery mapper.
You use the Processors tab of the Scenario Properties dialog box to specify the processor you want to use to process your XQuery code.
You can use
If you want to use the Mark Logic processor:
The Server Settings button becomes active.
The Mark Logic Server Settings dialog box appears.
The Parameter Values tab of the Scenario Properties dialog box displays any external variables you have defined in the XQuery source. You can specify the parameter value you want to use for any external variables when you run the scenario. For example, imagine your XQuery code contains the following:
This variable is displayed on the Parameters tab as follows:
When you run the scenario, you can specify the parameter value you want to use by double-clicking the Expression field and typing a value. Valid values are XPath expressions and must be entered using single or double quotes.
See Enabling the Profiler to learn more about the different ways in which Stylus Studio can provide you with XQuery performance metrics.
Alternative: Select Create Scenario from the scenario drop-down list at the top of the editor window.
Stylus Studio displays the Scenario Properties dialog box.
|
Note
|
|
If the first document you added to the XQuery is an XML document, Stylus Studio uses that document as the XML source for the scenario and displays it in this field. |
If you start to create a scenario and then change your mind, click Delete and then OK.
Alternative:
Stylus Studio displays the Scenario Properties dialog box.
When you clone a scenario, Stylus Studio creates a copy of the scenario except for the scenario name. This allows you to make changes to one scenario and then run both to compare the results.
If you change your mind and do not want to create the clone, click Delete and then OK.