![]() |
|
<?showifdef> |
Longname: | show if def ined | ![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Released: | 6.00 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Created: | 6.00 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See also: | <?showifnum> <?yank> showstrings (n/a) |
Summary |
This command has been implemented primarily with SGML/XML type attributes in mind, to allow conditional processing of a show string, depending on whether an attribute is defined. |
Example extract |
The requirement was to display the words 'Authors:Dave' in the text stream only if name attribute was defined. Inside the author tag you would have the following:
|
Syntax
|
!:L |
This will negate the normal result of the test. i.e. from 'show if defined' to 'show if not defined'. |
inheritance:L |
This parameter was implemented to control attribute inheritance when using XML in 3B2 and the showifdef command instead of XPath expressions to control attributes. The syntax is one of the following two options inserted within the double quotes of the attribute name parameter, but because this is a special character we must surround the entire item with a further set of single quotes in the form <?showifdef "'}id'"Show this>:
|
name:s |
The name of the attribute to test for must be present. In its simplest form, without any test the show string will be used if the attribute is present even if not given an explicit value. i.e.: If <?showifdef "fred"Hello> is set inside the <body> style tag, it will display "Hello" for <body fred> or <body fred=1> but not for <body>. |
mode:L |
|
test:sw |
If present it must be preceded by an equals sign. This reacts differently according to any mode that is present. |
action:sw |
Any applicable showstring or display text. |
This command has numerous applications, some examples of which are shown below. |
Example |
If the 'id' attribute is defined in the <para id="..."> element, set the Xcounter 99 to 0 and the typeface to Times:
|
Example |
If the 'gutter' attribute is defined in the <colspec gutter="..."> tag, show the table gutter command <?tbcolgut=?>, using the attributes value:
|
Example |
If the 'name' attribute is defined in the <authors name="..."> tag. Then insert a showstring that will yank the text up to the </authors> tag, and insert the resulting yanked text into a reference tag called 'Authmn' preceded with the style tag <name_style>.
|
Document created on 08-Feb-2003 (revision 1)