Value Formatting can be applied to:
|•||A numeric datatype node, such as xs:decimal or xs:date that is present in the SPS as contents or an input field.|
|•||An Auto-Calculation that evaluates to a value which has the lexical format of a numeric datatype.|
Defining Value Formatting
To define Value Formatting for a node or Auto-Calculation in the SPS, do the following:
|1.||Select the contents placeholder or input field of the node, or the Auto-Calculation.|
|2.||In the Properties sidebar, select the item, and then the Content group (or AutoCalc group) of properties. Now click the Edit button of the Value Formatting property. Alternatively, right-click and select Edit Value Formatting from the context menu. The Value Formatting dialog appears (screenshot below). It is different according to whether the selected component was a node or an Auto-Calculation. If the selected component was a node, then a dialog like the one below appears. The node represented in the screenshot below is of the xs:date datatype.|
Note that the screenshot above contains the line: Formats for type 'date' and that the standard format for the xs:date datatype is given alongside the Unformatted check box. For a node of some other datatype, this information would be correspondingly different.
If the selected component was an Auto-Calculation, the following dialog appears.
|3.||You now specify whether the display of the component's value is to be unformatted or formatted. If you wish to leave the output unformatted, select the Unformatted radio button. Otherwise select the Format as XML Schema Value radio button. (If the value is unformatted, the output has the standard formatting for the datatype of the selected node or the datatype of the Auto-Calculation result. If you specify Formatting as XML Schema Value for an Auto-Calculation, you have to additionally select (from a dropdown list) the datatype of the expected Auto-calculation result.|
|4.||Enter the Value Formatting definition. This definition can be entered in three ways: (i) by selecting from a dropdown list of available options for that datatype (see the 'Format in Output Documents' input field in the screenshots above); (ii) by entering the definition directly in the input field; and (iii) by using the Insert Field and Field Options buttons to build the definition correctly. See Value Formatting Syntax for a full description of the various formatting options.|
Errors in syntax
If there is an error in syntax, the following happens:
|•||The definition is displayed in red.|
|•||An error message, also in red, is displayed below the input field.|
|•||The OK button in the Value Formatting dialog is disabled.|
|•||The Go to Error button in the Value Formatting dialog is enabled. Clicking it causes the cursor to be placed at the point in the format definition where the syntax error is.|
Mismatch of data and datatype formats
If the data entered in an XML node does not match the lexical format of that node's datatype, or if the result of an Auto-Calculation does not match the lexical format of the expected datatype, then the formatting will be undefined and will not be displayed correctly in the output.
Applying Value Formatting to the output
The Value Formatting that you define applies to Authentic View, which is supported in the Enterprise and Professional editions.
Some Value Formatting definitions—not all—can also, additionally, be applied to HTML output. To do this, check the Apply Same Format to XSLT Output check box. If this option is not checked, or if it is not available, then only Authentic View will display the Value Formatting, while the output will display the value in the standard format for the datatype of the component (the lexical format).
© 2019 Altova GmbH