.\" -*- nroff -*- .\" .\" Copyright (c) 1994 .\" Open Software Foundation, Inc. .\" .\" Permission is hereby granted to use, copy, modify and freely distribute .\" the software in this file and its documentation for any purpose without .\" fee, provided that the above copyright notice appears in all copies and .\" that both the copyright notice and this permission notice appear in .\" supporting documentation. Further, provided that the name of Open .\" Software Foundation, Inc. ("OSF") not be used in advertising or .\" publicity pertaining to distribution of the software without prior .\" written permission from OSF. OSF makes no representations about the .\" suitability of this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" .\" Copyright (c) 1996 X Consortium .\" Copyright (c) 1996 Dalrymple Consulting .\" .\" Permission is hereby granted, free of charge, to any person obtaining a copy .\" of this software and associated documentation files (the "Software"), to deal .\" in the Software without restriction, including without limitation the rights .\" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell .\" copies of the Software, and to permit persons to whom the Software is .\" furnished to do so, subject to the following conditions: .\" .\" The above copyright notice and this permission notice shall be included in .\" all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE .\" X CONSORTIUM OR DALRYMPLE CONSULTING BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the names of the X Consortium and .\" Dalrymple Consulting shall not be used in advertising or otherwise to .\" promote the sale, use or other dealings in this Software without prior .\" written authorization. .\" .\" Translated with /usr/local/lib/tpt/ref-man.ts by fld on cord, Wed 07 Feb 1996, 22:00 .TH "\fBtranspec\fP" "5" "file format" .SH "Name" \fBtranspec\fP - translation specification for \fBinstant\fP .SH "Synopsis" .na .PP \fBfile.ts\fP .ad .SH "Description" .PP The \fBtranspec\fP file is used by the \fBinstant\fP program to translate an SGML document instance to a format suitable for a formatting application. The convention is to name the file with the suffix \fB.ts\fP. .PP A \fBtranspec\fP file is composed of a number of individual translation specs. Each translation spec (transpec) is made up of a number of fields, one per line. Translation specs are separated by a line with a leading dash. Text after the dash is ignored. Fields are composed of two parts, a name and a value, separated by a colon. The colon must immediately follow the name, and any amount of whitespace (blanks and tabs) may be present between the colon and value. Values should not be quoted, and you should be careful of trailing spaces. (Trailing space will be considered part of the value.) Quotes, if they appear, will be considered part of the value of the fields. Lines that begin with whitespace (blanks and tabs) are a continuation of the previous line; the leading space is ignored. These characteristics are very similar to those of e-mail headers. Lines beginning with a \fB#\fP (number sign) are comments and blank lines are ignored. .SH "Field Descriptions" .PP Some fields are for identifying criteria that determines if a particular spec matches an element in the instance. Others specify what action is to take place when a match happens, such as sending text to the output stream. .SS "Criteria fields" .PP Criteria fields restrict the conditions under which a single translation spec will apply. If each field specified in a particular transpec matches an element under consideration in the document instance, then that translation spec is said to match. The appropriate actions, as specified in that spec, are then taken. The program, \fBinstant\fP, searches the list of transpecs in the order given in the file. Therefore, the more restrictive specs (those with more criteria) should appear before less restrictive ones. .PP For quick reference, this is a brief summary of the possible criteria fields for translation. A complete discussion of each follows. .P .TS tab(@); l l l. \fBField Label\fR@\fBField Value\fR@\fBDescription\fR GI@gi ...@name of this GI AttValue@attname reg-expr@current element has attribute with value Content@reg-expr@is reg-expr in char content> Context@context@element context, up the tree NthChild@number@current element is Nth child of its parent PAttSet@attname (val)@parent has this attribute set (optional to value val) Relation@relationship gi@gi has relationship to current element VarREValue@var REvalue@variable is set to regular expression value VarValue@var value@variable is set to value .TE 'br\" labeled list .IP "\fBGI:\fP \fIgi\fP [...]" \fIgi\fP is the name of the generic identifier, or element name, to consider. More than one GI may appear in this field. .IP "\fBAttValue:\fP \fIattname\fP \fIregular-expression\fP" This is an attribute name-value pair, where \fIattname\fP is an attribute if the GI. The \fIregular-expression\fP is of the form accepted by the unix program \fBegrep\fP. This pair is compared to the corresponding attribute name-value pairs of the GI under consideration. To simply test if an attribute us set, use \fB.\fP (a dot) for \fIregular-expression\fP. There may be more than one of these lines for each transpec. .IP "\fBContent:\fP \fIregular-expression\fP" This specifies that the character content of GI contains a string matching the \fIregular-expression\fP. .IP "\fBContext:\fP \fIcontext\fP" This specifies the \fIcontext\fP in which to apply this translation spec. It is either a list of generic identifiers or a regular expression describing a list of generic identifiers, looking up the hierarchy. The first is the parent of the GI. .IP "\fBNthChild:\fP \fInumber\fP" This specifies that the GI is the \fInumber\fPth child element of its parent. Children are numbered starting with \fB1\fP. Negative numbers may be used to indicate order counting backwards. For example, \-1 denotes the last child. .IP "\fBPAttSet:\fP \fIattname\fP" This specifies that the parent has this attribute, \fIattname\fP, set to any value (not IMPLIED). A value to match may optionally be specified after attname. .IP "\fBRelation:\fP \fIrelationship\fP \fIgi\fP" This specifies that the current element has the \fIrelationship\fP to the named \fIgi\fP. The acceptable relationships are: \fBancestor\fP (anywhere up the tree), \fBchild\fP (immediate child), \fBdescendant\fP (anywhere down the tree), \fBparent\fP (immediate ancestor), \fBsibling\fP (share same parent element), \fBsibling+\fP (any later sibling), \fBsibling+1\fP (the immediately following sibling), \fBsibling-\fP (any earlier sibling), \fBsibling-1\fP (the immediately following sibling). .IP "\fBVarREValue:\fP \fIvarname\fP \fIREvalue\fP" This specifies that the global variable \fIvarname\fP has the value \fIREvalue\fP, where \fIREvalue\fP is a regular expression (see the \fBVarValue\fP statement). .IP "\fBVarValue:\fP \fIvarname\fP \fIvalue\fP" This specifies that the global variable \fIvarname\fP has the (literal) value \fIvalue\fP (see the \fBVarREValue\fP statement). 'br\" labeled list end .PP There are two special GIs. If specified, \fB_Start\fP and \fB_End\fP are processed as if they were GIs in the instance at the start and end of the translation, respectively. Their criteria are never checked. Only their actions are performed. .SS "Action fields" .PP For quick reference, this is a brief summary of the action fields for translation. They are only performed if all the criteria are satisfied. A complete discussion of each follows. .P .TS tab(@); l l l. \fBField Label\fR@\fBField Value\fR@\fBDescription\fR Action@spec-id@use transpec whose spec ID is `spec-id' EndText@text@text for end of element Increment@name@increment variable `name' Ignore@key@flag for ignoring element's children and/or data Message@text@text to send to stderr Quit@text@print text and quit program Replace@text@replace this subtree with text Set@name value@set variable \fIname\fP to \fIvalue\fP SpecID@spec-id@unique Spec ID (int) of this spec StartText@text@text for start of element .TE 'br\" labeled list .IP "\fBAction:\fP \fIspec-id\fP" Use the actions of the spec identified by the \fBSpecID\fP with matching identifier \fIspec-id\fP. .IP "\fBEndText:\fP \fItext\fP" This specifies text to be output when the end tag is processed. .IP "\fBIgnore:\fP \fIkey\fP" This specifies that the data or children for this element are to be ignored. Set \fIkey\fP to \fBall\fP to ignore the element (data and child elements), to \fBdata\fP to ignore the immediate character data content (child elements are still descended into), and to \fBchildren\fP to process the immediate character data content but not descended into child elements. Other actions specified in this transpec are still performed, however. .IP "\fBIncrement:\fP \fIname\fP" This is used to increment a variable whose value is a number. If the variable is not a number, no action will be taken. The variable must have been previously defined. This action is done immediately before \fBEndText\fP. There may be more than one of these lines for each transpec. .IP "\fBMessage:\fP \fItext\fP" This specifies a string to be printed to the standard error when the matching element is processed. It is intended for informing the user of the progress of the translation. It is also used for validation of instances (see the \fB\-v\fP flag of \fBinstant\fP(1)); a spec would be written to recognize a construct that is not allowed. This action is done immediately after \fBStartText\fP. Messages are also useful for debugging spec files; one is able to easily tell when a matching spec is processed, without looking at the actual output of the translation. Note that the spec writer is responsible for putting newlines (\fB\en\fP) in the message text. .IP "\fBReplace:\fP \fItext\fP" This specifies text to replace the current subtree with. This is equivalent to \fBStartText\fP and \fBIgnore\fP. .IP "\fBQuit:\fP \fItext\fP" This specifies text to be printed to the standard error. The program then terminates with exit status 1. This is intended for bailing out when an undesirable instance is encountered (such as when it is known that the formatting application can never handle a class of components, like tables). .IP "\fBSet:\fP \fIname\fP \fIvalue\fP" This is used to set a variable whose name is \fIname\fP and value is \fIvalue\fP. Names that would be valid for GIs in the document instance are valid for variable names. \fIvalue\fP is the rest of the line and may be any string. This action is done immediately before \fBEndText\fP. There may be more than one of these lines for each transpec. See the discussion on variables below. .IP "\fBSpecID:\fP \fIspec-id\fP" This names the spec with the number \fIspec-id\fP. Other specs may refer to this one by this number by an \fBAction\fP field or an \fB_action\fP special variable. This is used for cases where several specs to perform the exact same action. .IP "\fBStartText:\fP \fItext\fP" This specifies text to be output when the start tag is processed. 'br\" labeled list end .SS "Other Fields" .PP These fields may appear anywhere. The action occurs when the translation spec file is read, before any elements are translated. Theses are independent of any element processing. 'br\" labeled list .IP "\fBVar:\fP \fIname\fP \fIvalue\fP" This is used to define a variable whose name is \fIname\fP and value is \fIvalue\fP. It is similar to \fBSet\fP, but it may occur anywhere in the file and takes effect when the spec file is read. 'br\" labeled list end .SS "Text Strings" .PP The \fItext\fP referred to in the \fBStartText\fP, \fBEndText\fP, \fBReplace\fP, and \fBMessage\fP actions is more than simple character strings. Special sequences allow more complex output. .PP One type of special sequence is for C-style string processing. Most special characters are escaped with a \e (backslash). Like in C or shell programs, to print a \e (backslash), you must escape it with another backslash. These special character strings are: 'br\" labeled list .IP "\fB\en (backslash-n)\fP" This specifies that a newline character is to be printed to the output stream. .IP "\fB\er (backslash-r)\fP" This specifies that a carriage return character is to be printed to the output stream. .IP "\fB\et (backslash-t)\fP" This specifies that a tab character is to be printed to the output stream. .IP "\fB\es (backslash-s)\fP" This specifies that a space is to be printed to the output stream. This is useful for the end of a transpec line, where it can be difficult to tell if a blank is present at the end. .IP "\fB\e007 (backslash-007)\fP" This specifies that the character whose octal value is 007 is to be printed to the output stream. This works for any octal character value. .IP "\fB^ (caret)\fP" This specifies the that position in the string will be at the start of a line in the output stream. 'br\" labeled list end .PP If the first token of the text string is \fB#include\fP, then the second token is taken to be a file name and that file is included. If the file is not found, the library directory, as mentioned above, is searched. If the text string starts with a \fB!\fP (exclamation point), the rest of the line is taken to be a command and the output of that command is inserted. .PP An element's attributes may also be used in the text of output fields. To use an attribute value, precede its name with a \fB${\fP (dollar sign-left curly bracket) and follow it with a \fB}\fP (right curly bracket). (This style is followed by the Bourne shell.) For example, \fB${TYPE}\fP. If the attribute is not set (not IMPLIED), nothing will be printed to the output stream. To specify a value to use if the attribute is not set, place the value after the attribute name, separated by a space. To return the attribute value in lower-case, add a colon followed by lower-case l (\fB${TYPE:l}\fP. .SH "Variables" .PP Variables in \fBinstant\fP are similar to those in many other string-oriented programming languages, such as \fBsh\fP and \fBawk\fP. They are set by: \fBVar:\fP \fIname\fP \fIvalue\fP and \fBSet:\fP \fIname\fP \fIvalue\fP. Values may be set and reset to any string. In a \fBVar\fP line, if the value begins with a \fB!\fP, then the rest of the line is executed as a command, and its output is taken as the \fIvalue\fP. .PP A reference to the value of a variable follows the same syntax as a reference to the value of an attribute: \fB${\fIname\fB}\fR. If that variable has not been defined, a null value will be returned. A default value can be returned instead of null for an undefined variable by using the form: \fB${\fIname default\fB}\fR. .PP Variables may be used as attributes are, that is in any of the text strings mentioned above. In fact, if an attribute name is referred to and it is not set for a given element, \fBinstant\fP looks for a variable with the same name. This way global defaults can be set. If you want to be sure that you are accessing a local variable value, not an attribute value, you can use lower or mixed case names. Attribute names, as passed by \fBonsgmls\fP, are in upper case. .PP Any number of \fBVar\fP actions may appear in the spec file. These set the values of the variables before any translation takes place. The \fBSet\fP actions within transpecs are performed when that spec is processed when an element matches the given criteria. .SS "Preset Variables" .PP Several variables are preset by \fBinstant\fP upon start of the program. Their values may be overridden in transpec files or on the command line. 'br\" labeled list .IP "\fBdate\fP" This is the date and time that the program started. The format is: \f(CWTue 10 Aug 1993, 16:52\fP. .IP "\fBhost\fP" This is the name of the host where the program is run. It is what is returned by the \fBgethostname\fP library call. .IP "\fBtranspec\fP" This is the translation spec filename. .IP "\fBuser\fP" This is the login name of the user running the program. 'br\" labeled list end .SS "Special Variables" .PP There is a collection of special variables called \fIspecial variables\fP. These are identified by starting the names with a \fB_\fP (underscore). This is a summary of the special variables. A complete discussion of each special variable follows. \fBspec-id\fP refers to a number specified in a \fBSpecID\fP field. When used in a special variable, it means to perform the action in that translation spec. .PP Note that when a \fIspec-id\fR is given in a special variable, the default is to perform the translation spec named by the \fIspec-id\fR ignoring of any criteria statements found there. For most special variables that use a \fIspec-id\fP, postpending a "\fBt\fR" to the \fIspec-id\fR (with no spaces between them, eg, "\fB${_followrel child TITLE 15t}\fR"), will cause the criteria statements in the named translation spec to evaluate successfully before that translation spec will be processed. .P .TS tab(@); l l. \fBVariable Usage\fR@\fBDescription\fR \fB_action\fP \fIspec-id\fP@do spec with id spec-id \fB_allatts\fP@print all attribute/value pairs \fB_attval\fP \fIatt\fP [\fIvalue\fP] \fIspec-id\fP@use spec-id if attribute matches \fB_chasetogi\fP \fIgi\fP \fIspec-id\fP@follow IDREFs until gi found \fB_eachatt\fP \fIatt\fP \fIspec-id\fP [\fIspec-id\fP]@do spec-id for each word of attribute value \fB_eachcon\fP \fIspec-id\fP [\fIspec-id\fP]@do spec-id for each word of content \fB_env\fP \fIenv-variable\fP@return value of env variable \fB_filename\fP@filename of notation \fB_find\fP \fIrel\fP \fIgi\fP \fIspec-id\fP@find gi based on relationship \fB_followlink\fP [\fIattname\fP] \fIspec-id\fP@follow IDREFs [attname] and use spec-id \fB_followrel\fP \fIrel\fP \fIgi\fP \fIspec-id\fP@do spec-id on rel if it matches \fB_gi\fP [\fBM|L|U\fP]@return GI name; M, L, U case \fB_id\fP \fIid [\fP\fIspec-id\fP]@find element with ID and use spec-id \fB_include\fP \fIfilename\fP@insert file here \fB_infile\fP [\fBline\fP]@instance filename [and line number] \fB_insertnode\fP S|E \fIspec-id\fP@do spec-id when element is traversed \fB_isset\fP \fIvar\fP [\fIvalue\fP] \fIspec-id\fP@do spec-id if variable matches \fB_location\fP@print location of current element \fB_namelist\fP \fIspec-id\fP [\fIspec-id\fP]@content is namelist, do spec-id for each \fB_nchild\fP [\fIgi\fP]@number of child elements [named \fIattname\fP] \fB_osftable\fP \fIformat\fP [\fIflag\fP]@print table format specification \fB_path\fP@print path to current element \fB_pattr\fP \fIattname\fP@value of parent's attribute \fB_pfind\fP \fIargs ...\fP@same as \fB_find\fP, but start at parent \fB_relation\fP \fIrel\fP \fIgi\fP \fIspec-id\fP [\fIspec-id\fP]@do spec-id if relation matches \fB_set\fP \fIvar\fP \fIvalue\fP@set variable to value \fB_!\fP\fIcommand\fP@command to run .TE 'br\" labeled list .IP "\fB_action\fP \fIspec-id\fP" Use the actions of the spec identified by the \fBSpecID\fP with matching identifier \fIspec-id\fP. This behaves similarly to the \fBAction\fP action, but is in addition to the present translation spec. .IP "\fB_allatts\fP" Print all attribute name-value pairs of the current element to the output stream. The name and value are separated by a \fB=\fP (equals sign), and the value is surrounded by quotes. This can be useful for creating a normalized version of the instance. .IP "\fB_attval\fP \fIattname\fP [\fIvalue\fP] \fIspec-id\fP" If the current element has an attribute named \fIattname\fP, optionally whose value matches \fIvalue\fP, use the actions of the transpec identified by \fIspec-id\fP. .IP "\fB_chasetogi\fP \fIgi\fP \fIspec-id\fP" Follow IDREF attributes until if finds an element whose GI is \fIgi\fP or which has a child element with that GI. It will apply the transpec \fIspec-id\fP to that element. By default, \fBinstant\fP assumes the attributes named \fBLINKEND\fP, \fBLINKENDS\fP, and \fBIDREF\fP are of type IDREF or IDREFS. (This corresponds with the OSF DTDs.) You can change this by setting the variable \fBlink_atts\fP to a space-separated list of attribute names. .IP "\fB_eachatt\fP \fIatt\fP \fIspec-id\fP [\fIspec-id2\fP]" The transpec named by \fIspec-id\fR is invoked once per each word found in the value of the attribute \fIatt\fR. Inside the target transpec, the current word being processed is available in the variable named \fBeach_A\fR (\fB${each_A}\fR). If \fIspec-id2\fP is specified, it will use \fIspec-id\fP for the first word in the attribute and \fIspec-id2\fP for the others. .IP "\fB_eachcon\fP \fIspec-id\fP [\fIspec-id2\fP]" The transpec named by \fIspec-id\fR is invoked once per each word found in the content of the current element. Inside the target transpec, the current word being processed is available in the variable named \fBeach_C\fR (\fB${each_C}\fR). If \fIspec-id2\fP is specified, it will use \fIspec-id\fP for the first word in the content and \fIspec-id2\fP for the others. .IP "\fB_env\fP \fIenv-variable\fP" Print the value of the environment variable \fIenv-variable\fP to the output stream. .IP "\fB_filename\fP" Print the filename of the notation associated with this element, if any. This is used to get the filename of an external notation entity reference. For example, to print the filename in the latex macro from the epsf macro package, use \f(CW\e\eepsfboxi{${_filename}}\fP. .IP "\fB_find\fP [\fBtop\fP] \fIrelationship\fP \fIargs ...\fP \fIspec-id\fP" Descend the document hierarchy finding elements that match one of several criteria. When one is found, the action specified by \fIspec-id\fP is performed. If \fBtop\fP is specified, the search starts at the top of the document hierarchy, rather than at the current element. The possible values for \fIrelationship\fP are \fBgi\fP, \fBgi-parent\fP, \fBparent\fP, and \fBattr\fP, and take different arguments. Explanations may be best done by example: \fB_find gi CHAPTER 123\fP means to find elements whose GI is CHAPTER, and perform action 123; \fB_find gi-parent TITLE CHAPTER 124\fP means to find elements whose GI is TITLE and whose parent is CHAPTER, and perform action 124; \fB_find parent BODY 125\fP means to find elements whose parent's GI is BODY, and perform action 125; \fB_find attr TYPE UGLY 125\fP means to find elements whose attribute named TYPE is set to UGLY, and perform action 126. .IP "\fB_followlink\fP [\fIattname\fP] \fIspec-id\fP" When processing an element, \fBinstant\fP will follow the IDREF attributes until an element with no IDREF attributes is found. It will then apply the transpec specified by \fIspec-id\fP to that element. If specified, it will follow the link pointed to by \fIattname\fP. By default, \fBinstant\fP assumes the attributes named \fBLINKEND\fP and \fBLINKENDS\fP are if type IDREF or IDREFS. You can change this by setting the variable \fBlink_atts\fP to a space-separated list of attribute names. .IP "\fB_followrel\fP \fIrelationship\fP \fIgi\fP \fIspec-id\fP" If the \fIgi\fP has the specified \fIrelationship\fP to the current element, perform the action specified by \fIspec-id\fP on the related element. See the discussion of the criteria field \fBRelation\fP for acceptable relationship names. .IP "\fB_gi\fP [\fBM|L|U\fP]" Print the name of the current GI to the output stream. If specified, \fBM\fP, \fBL\fP, or \fBU\fP will ensure the GI name is printed in mixed, lower, or upper case, respectively. .IP "\fB_id\fP \fIid\fP [\fIspec-id\fP]" Find the element with \fIid\fP and use \fIspec-id\fP, if set. If not set, use the spec for that element's context. .IP "\fB_include\fP \fIfilename\fP" Insert the file \fIfilename\fP into the output stream. .IP "\fB_infile\fP [\fBline\fP]" Print the name of the sgml instance file to the output stream. If \fBline\fP is specified, also print the line number. This depends on \fBonsgmls\fP being called with the \fB\-l\fP option. .IP "\fB_insertnode\fP \fBS\fP|\fBE\fP \fIspec-id\fP" Do \fIspec-id\fP when the current element is traversed at a later pass. This can be considered inserting a node, without content, into the hierarchy. This is only useful if done to elements \fIbefore\fP they are processed. Typically \fB_chasetogi\fP or \fB_followlink\fP is specified early in an instance's processing, so that when the elements found by one of these actions are processed in their turn, the added actions are performed. \fB_insertnode\fP would be specified as the action of a \fIspec-id\fP pointed to in a \fB_chasetogi\fP or \fB_followlink\fP usage. .IP "\fB_location\fP" The location of the current element is printed to the output stream in several ways: the path to the element (see \fB_path\fP), a position hint, which is the nearest title, the line number, if the ESIS (output from \fBonsgmls\fP) contains line numbers, and the ID of the element, if it has one. This is especially useful when using the \fBMessage\fP action to validate an instance. .IP "\fB_namelist\fP \fIspec-id\fP [\fIspec-id2\fP]" This assumes that the content of the current element is a namelist (a list of element IDs), and applies the action based on \fIspec-id\fP for each element pointed to. If \fIspec-id2\fP is specified, it will use \fIspec-id\fP for the first ID in the namelist and \fIspec-id2\fP for the others. .IP "\fB_nchild\fP [\fIgi\fP]" Print the number of child elements of the element to the output stream. If \fIgi\fP is specified, print the number of child element with that name. .IP "\fB_osftable\fP \fBtex\fP|\fBtbl\fP|\fBcheck\fP [\fIflag\fP]" Print table markup into the output stream. The format depends on whether \fBtex\fP or \fBtbl\fP is specified. The \fIflag\fP may be one of \fBcellstart\fP, \fBcellend\fP, \fBrowstart\fP, \fBrowend\fP, \fBtop\fP, or \fBbottom\fP. The value determines what markup or text will be generated. If \fBcellstart\fP is specified, the correct markup for the beginning of a cell is output. If \fBtop\fP, \fBbottom\fP, or \fBrowend\fP are specified, the correct markup for the end of the appropriate position is printed to the output stream. If \fBcheck\fP is specified, the attributes and child elements are checked for errors and consistency. .IP "\fB_path\fP" Print the path to current GI to the output stream. A path is each element, going down the tree from the topmost element. A number in parentheses after each element name shows which child element the next one is in the order of children for that element. Ordering starts at 0. For example: \f(CWOSF-BOOK(3) BODY(0) CHAPTER(4) SECTION\fP. This says the path is \fB\fP's third child, \fB\fP's zeroth, and \fB\fP's fourth, which is named \fB
\fP. .IP "\fB_pattr\fP \fIname\fP" Print the value of parent's attribute whose name is \fIname\fP to the output stream. .IP "\fB_pfind\fP \fIrel\fP \fIgi\fP \fIspec-id\fP" This is exactly the same as \fB_find\fP except that the search starts at the current element's parent. .IP "\fB_relation\fP \fIrelationship\fP \fIgi\fP \fIspec-id\fP [\fIspec-id2\fP]" If the \fIgi\fP has the specified \fIrelationship\fP to the current element, perform the action specified by \fIspec-id\fP on the current element. If the relationship test fails and \fIspec-id2\fP is specified, perform that action. See the discussion of the criteria field \fBRelation\fP for acceptable relationship names. .IP "\fB_set\fP \fIvarname\fP \fIvalue\fP" Set the value of the variable \fIvarname\fP to \fIvalue\fP. .IP "\fB_isset\fP \fIvarname\fP [\fIvalue\fP] \fIspec-id\fP" If the value of the variable \fIvarname\fP is set to \fIvalue\fP, then perform action referred to by \fIspec-id\fP. If \fIvalue\fP is not specified, action will be performed if \fIvarname\fP is set to any value. .IP "\fB_!\fP \fIcommand\fP" Run the command \fIcommand\fP, directing its standard output into the output stream. 'br\" labeled list end .SS "Immediate Variables" .PP \fIImmediate variables\fR are like special variables, except that they are expanded when the transpec is originally processed (special variables are processed later, near when the final output is being generated). The general syntax of immediate variables is \fB${+\fIimmediate_variable\ ...\fB}\fR. .PP There is currently only one immediate variable defined: .IP "\fB+content\fP" This special variable is replaced by the data content of the current element. .SH "Examples" .PP The following will output the given string for elements whose generic identifier is \fBP\fP (for paragraph). At the start of processing this element, the program ensures that the output starts on a new line, the \fBtroff\fP macro \fB<.P>\fP is output, then a newline. At the end of this element processing, the program ensures that the output starts on a new line. .DS .nf .ft CW GI: P StartText: ^.P^ EndText: ^ - .ft R .fi .DE .PP The following will output the given string for elements whose generic identifier is \fBCMD-ARGUMENT\fP and which have an attribute \fBPRESENCE\fP set to the value \fBOPTIONAL\fP. .DS .nf .ft CW GI: CMD-ARGUMENT AttValue: PRESENCE OPTIONAL StartText: $\e\e[ EndText: $\e\e] - .ft R .fi .DE .PP The following prints the section number, title, and page number of the target of a cross reference. Assume the cross reference points to a section element, which contains a title element. The criteria for this spec to match is that the attribute \fBOSFROLE\fP is set to the value \fBgetfull\fP. The action is to replace the content of the \fB\fP element with the given string. When processing the string, \fBinstant\fP will follow the IDREF attributes of \fB\fP until an element with no IDREF attributes is found. It will then apply the transpec numbered \fB87\fP to that element, which will print the name of the GI in mixed case into the output stream. It will then print the LaTeX reference instruction with the value of the \fBLINKEND\fP attribute as an argument. (This will become the section number after processing by LaTeX.) It will then follow IDREFs until if finds an element whose GI is \fBTITLE\fP or which has a child element with that GI. It will apply the transpec numbered \fB1\fP to that element, which copies the title into the output stream where the cross reference occurs. Finally, it will print the word \fBpage\fP followed by the LaTeX instruction to obtain the page number of a reference. .DS .nf .ft CW GI: XREF AttValue: OSFROLE getfull Replace: ${_followlink 87} \e\eref{${LINKEND}},\es {\e\ebf ${_chasetogi TITLE 1}}, page \e\epageref{${LINKEND}} - # Print GI name, in mixed case GI: _pr_gi_name SpecID: 87 Ignore: 1 EndText: ${_gi M} - GI: _pass-text SpecID: 1 - .ft R .fi .DE .SH "Related Information" .PP \fBinstant\fP(1), \fBonsgmls\fP(1), \fBegrep\fP(1).