Output-Based Conditions
Individual components in the document design can be processed differently for StyleVision's different output formats (Authentic View, RTF, Text and HTML). For example, consider the case where you wish to create a link, which, in Authentic View should point to a file on a local system, but in the HTML output should point to a Web page. In this case, you can create one condition to process content for Authentic View output and a second condition to process content for HTML output. Or consider the case where you want some text to be included in the Authentic View output but not in the HTML output. A condition could be created with a branch for processing Authentic View output, and no branch for HTML output.
Note: | Conditions for specific output can be placed around individual parts or components of the document, thus providing considerable flexibility in the way the different output documents are structured. |
Creating conditions for specific output
To create conditions for specific output, do the following:
1.In Design View, select the component (or highlight the document part) which you wish to create differently for different output formats.
2.Right-click, and, from the context menu that pops up, select Enclose with | Output-Based Condition. This inserts the output condition with four branches, each having the same content (the selected component). Each branch represents a single output (Authentic View, RTF, Text, or HTML). To determine which branch represents which output, mouseover the branch tag or check the XPath expression of the selected branch (in the Properties sidebar, in the Condition Branch entry, click the Edit button).
3.Within each branch, define the required processing. If you wish not to have any processing for a particular output format, then delete the branch for that format (select the branch and press Delete, or select the branch and in the (right-click) context menu select Delete Branch).
Note: | The output-based condition can also be created first and (static and/or dynamic) content for each branch inserted later. First insert the output-based condition at a cursor insertion point in the design. Then within the respective branches, insert the required static and/or dynamic content. |
Editing the branches of an Output-Based Condition
The XPath expression of a branch of an output-based condition is \$SV_OutputFormat = 'format', where format is one of the values: Authentic, RTF, Text, or HTML. You can edit the XPath expression of a condition branch (in the Properties sidebar, in the Condition Branch entry, click the Edit button). For example, you could combine the Authentic View and HTML output formats in one condition branch (using the XPath expression: \$SV_OutputFormat = 'Authentic' or \$SV_OutputFormat = 'HTML').
You can also (a) delete one or more branches; (b) create an otherwise branch in a condition; and (c) move the branches up or down relative to each other, thus changing the relative priority of the branches. For information on how to carry out these actions, see Setting Up the Conditions and Editing Conditions.
Using the \$SV_OutputFormat parameter
In the XSLT file generated for each output, \$SV_OutputFormat is created as a global parameter and assigned the value appropriate to that output format (that is, Authentic, RTF, Text, or HTML). This parameter can be overridden by passing another value for it to the processor at runtime. This could be useful, if, for example, you wish to create two alternative HTML output options, one of which will be selected at runtime. You could then create condition branches \$SV_OutputFormat = 'HTML-1' and \$SV_OutputFormat = 'HTML-2'. At runtime you could pass the required parameter value (HTML-1 or HTML-2) to the processor.