Macro Language Reference > PIs > Formatting Instructions > attr
  
attr
Description
When PTC ALD formats a reference or style tag, it sets itself two marker positions in the text: entry pos {A} marks the start position of the tag in the text and exit pos {B} denotes the position in the text to which PTC ALD should revert once the tag has been processed, i.e. ...{A}<Body>{B}.... These internal pointers can be altered using the <?attr> command to change the formatting sequence of the tags/elements.
 
Example 360. Read the attribute from the next element
When using SGML type attribute tags, e.g. <date><edition id="98">, it may be necessary to show the value 98 into the previous tag <date>, if the <edition...> tag was not or could not be used.
The <date> tag could prompt a variety of actions. The instance below jumps to a label corresponding to the value of the id attribute; in this case '98'. This assigns the appropriate text to the ^year variable for use elsewhere with the document. It could alternatively display the appropriate text at the position of the <date> tag.
The <?attr 0> command moves the formatting position {A} on to the next compound (i.e. the <edition...> tag). This actions anables the use of the 'id' attribute value, which would normally only be available within the <edition...> tag itself. The <?}$^id#^> command then jumps to the label <?:98>using the id value.
<?attr 0><?}$^id#^><?->
<?:97><?show "^year" 1997 Edition><?->
<?:98><?show "^year" 1998 Edition><?->
<?:99><?show "^year" 1999 Edition><?->
Syntax
<?attr 0><?}$^id#^><?->
<?:97><?show "^year" 1997 Edition><?->
<?:98><?show "^year" 1998 Edition><?->
<?:99><?show "^year" 1999 Edition><?->
type
0
Moves position {A} to the point after the next angle bracket compound (i.e. tag).
1
Moves position {B} to its current maximum position, depending on the current position of {A}.
2
Moves position {A} to position {B}
3
ref: Move formatting to a reference.
4
pos: Move formatting to a character position.
5
end: Move formatting to the end of the stream.
6
ref, pos, end: All three options above in one.
7
Not documented.
8
Not documented.
9
Not documented.
10
Specify that a tag should be re-entered (reprocessed) if it crosses a page boundary. Enter <?attr 10,999> to re-enter the current tag.
hierarchy
Specify any nested levels that should be affected by the position change, e.g. -1 or +1. Default value: -1.
move fpos
Specify a character position in the stream to which to move the formatting position:
ref
Move formatting to the next reference.
pos
Move formatting to an absolute character position.
end
Move formatting to the end of the stream.