![]() |
| Previous Top Next |
XPath Dialog |
The Edit XPath Expression dialog (screenshot below) is used to edit and assign XPath expressions for a range of features.

In the Edit XPath Expression dialog, you can (i) enter an expression in the Expression text box via the keyboard, or (ii) you can insert nodes, operators, and functions by double-clicking them from their respective lists. If the syntax of the XPath expression is correct, the expression is displayed in black; if incorrect, it is displayed in red. The lists for operators and functions automatically displays XPath 1.0 operators and functions or XPath 2.0 operators and functions according to the XSLT version selected for the SPS (XPath 1.0 for XSLT 1.0, and XPath 2.0 for XSLT 2.0).
The Edit XPath Expression dialog helps you to build XPath expressions in the following ways.
| • | Context node |
The node within which the Condition or Auto-Calculation will be inserted is shown in the Selection text box in the Select Schema Attribute or Element pane. The XPath expression is created relative to, or within the context of, this node. The Condition or Auto-Calculation is inserted at a location within this context, and the XPath expression will be evaluated with this node as its context.
| • | Inserting a node from the schema in the expression |
In the Select Schema Attribute or Element pane, the entire schema is displayed. You can insert a node from the schema into the XPath expression by double-clicking the required node. If the Absolute XPath check box is not checked, the selected node will be inserted with a location path expression that is relative to the context node. For example, in the screenshot above, the Location element, which is a child of the Office element (the context node), has been inserted with a location path that is relative to the context node (that is, as Location). If the Absolute XPath check box were checked, the Location node would have been inserted as /OrgChart/Office/Location.
| • | Inserting XPath operators |
The Select Operator pane automatically lists XPath 1.0 or XPath 2.0 operators according to whether XSLT 1.0 or XSLT 2.0 has been selected as the XSLT version for the SPS. To insert an operator in the XPath expression, double-click the required operator.
| • | Inserting XPath functions |
The Select Function pane (screenshot below) is at the right of the Edit XPath Expression dialog and automatically lists XPath 1.0 or XPath 2.0 functions according to whether XSLT 1.0 or XSLT 2.0 has been selected as the XSLT version for the SPS. Each function is listed with its signature. If a function has more than one signature, that function is listed as many times as the number of signatures (see adjust-date-to-timezone in screenshot below). Arguments in a signature are separated by commas, and arguments can have an occurrence indicators (? indicates a sequence of zero or one items of the specified type; * indicates a sequence of zero or more items of the specified type). The functions list also includes the return type of that function and a brief description of the function.

To insert a function in the XPath expression, double-click the required function.
The Otherwise check box
The Otherwise check box below the input field for the XPath expression appears when a second or subsequent condition is being added to a conditional template. Checking the Otherwise check box inserts the optional Otherwise condition of a conditional template. For details of how to use the Otherwise condition, see Conditional Templates.
XPath expressions containing carriage returns / linefeeds
You can include carriage returns and/or linefeeds (CR/LFs) in the XPath expression in order to set part of the output on separate lines. However, in order for the CR/LF to be visible in the output (all outputs except RTF output), the component containing the XPath expression must be enclosed in the pre special paragraph type. An example of such an XPath expression is:
translate('a;b;c', ';', codepoints-to-string(13))
See also:
Conditional Templates, for a description of how to use conditional templates.
Auto-Calculations, for a description of how to use Auto-Calculations.
XSLT Engine Information, for information about the XSLT Engines in StyleVision and XPath support.
|