Macro Language Reference > PIs > Formatting Instructions > :
  
:
Description
This command, along with its sister commands <?{> and <?}>, allow movement within tags with gotos and labels, similar to the commands for moving around in scripts. It enables you to repeat commands or attributes or conditionally test text.
 
Example 376. Use jumps to capitalize first letters of words
The following example will manipulate a text stream of capital letters so that any characters apart from the first of the word is in small capitals. The code calls out a word space, reinserts it with a cap height instruction, skips one character, inserts the small caps height, then jumps back to the label.
<?th=14pt><?tlb=1.2*h><?0,1,0,0,0,1,0,0,0,0,5>
<?char><?th=9pt>
<?:loop><#,32>
<?th=14pt><?char>
<?th=10pt><?{loop>
 
Note that a failed hash callout will exit a style.
 
Example 377. Use jumps to set text options based on value of x counter
The example below tests the current value of the x(99) counter to decide which attributes to assign to the <Body> tag. If the value of x(99) is 1, jump to the label <?:red> and if the value is 2, jump to <?:blue>.
<?}=1?x(99)red><?}=2?x(99)blue><?->
<?:red><?th=12pt><?tic=red><?->
<?:blue><?th=8pt><?tic=Blue><?->
Alternatively, you can instruct PTC ALD to jump to the label that corresponds with the current counter value, instead of jumping to one with a specific name:
<?}style_$x(99)><?->
<?:style_1><?th=12pt><?tic=red><?->
<?:style_2><?th=8pt><?tic=Blue><?->
 
The <?-> (exit tag) command following the second jump test instructs PTC ALD to exit the tag if neither of the jump commands are executed, i.e. if the value of x(99) is not 1 or 2. The exit tag command is also located at the end of each label entry.
 
Example 378. Jump to a label corresponding to the value of an element's attribute
A further example of this command's use is primarily used with SGML/XML type attribute tags. Strictly speaking a show string, this will jump to the label name set by the value of the "role" attribute, in this case default:
<?}$^role#^><?->
<?:default><?th=10pt><?tf="Times"><?->
<?:second><?th=10pt><?tf="Times">&#131;<?->
<?:example><?th=9pt><?tf="Arial"><?->
Syntax
<?: name_or_test:sw>
name_or_test
The command can take a number of different name generating syntax to point to a corresponding label.
name
The name of the label to which to jump
 
There is no limit to the number of characters used for the name of a jump or label.
test
A showstring, or a combination of showstrings, including the use of elements' attribute values and x counter tests.
Additional Information
The target label is allowed to be blank or it can point to a non-existent label (in which case the 'goto' command is ignored). This can be useful when using conditional show strings. For example, if the counter 'a' contains the value 1, which indicates that a portion of the tag should be skipped, then the following could be used:
If 'a' is not equal to 1 the show string does not generate any text and so the target label is blank, causing the 'goto' command to be ignored.
<?}=1?name>skip
this text if a=1<?:label>continue here
* 
It is possible to set up continuous loops within a style. This is acceptable as long as a condition changes within the loop which will allow the loop to terminate. It is extremely easy to cause APP to crash if loops are set up incorrectly. Consider the following:
<?:label_1><?{label_1>
If PTC ALD tries to format these commands, it will crash immediately as there is no exit condition for the loop.
Related Links