Syntax
%format-modifier* v (attribute-name)
Purpose
The "%v" format item is used to format attributes.
In element rules, the named attribute must be an attribute of the element; in external-data-entity rules, it must be a data attribute of the entity being processed. In all other rules the named attribute must be an attribute of the containing element.
The following modifiers can always be used with the "%v" format item:
- "l": forces the letters in the attribute value to lowercase
- "u": forces the letters in the attribute value to uppercase
- "number f": the field-width modifier is allowed in the "%v" format (although it is ignored for CDATA attributes). If the number is less than the minimum number of characters needed to print the attribute vale, it is ignored. If it is greater, space characters are added to the right of the value to fill out the field width.
- "k": allowed only with "f", this puts the spaces to the left of the value instead of to the right.
If the attribute has a CDATA declared type, the following modifiers can be used:
- "h": prevents the insertion of line breaks
- "s": minimizes white spaces in the processed content model
- Compresses leading and trailing spaces and line-ends in CDATA attribute values to a single space.
- Condenses sequences of tabs and spaces in data content to a single space.
- Condenses sequences of line-ends in data content, together with any intervening, leading, or trailing tabs and spaces into a single line-end.
- "z": Prevents selection of any
translate rules that would otherwise apply to all or part of the attribute value.
If the attribute's declared type is entity or entities , and the entity name refers to an external entity, the following modifiers can also be specified:
- "e": causes OmniMark to access the system identifier from the entity declaration instead of accessing the entity name. The "f", "k", "l" and "u" modifiers cannot be used with this combination.
- "o": causes OmniMark to access the notation name from the entity declaration instead of from the entity name.
- "p": causes OmniMark to access the public identifier from the entity declaration instead of accessing the entity name. The "f", "k", "l" and "u" modifiers cannot be used with this combination.
These modifiers are combined as follows:
- "ep": causes OmniMark to access the system identifier found by searching for the entity's public identifier in the
library rules.The "f", "k", "l" and "u" modifiers cannot be used with this combination.
- eo: causes OmniMark to access the system identifier declared for the notation associated with the entity. The "f", "k", "l" and "u" modifiers cannot be used with this combination.
- po: causes OmniMark to access the public identifier declared for the notation associated with the entity. The "f", "k", "l" and "u" modifiers cannot be used with this combination.
- epo: causes OmniMark to access the system identifier found by searching for the entity notation's public identifier in the
library rules. The "f", "k", "l" and "u" modifiers cannot be used with this combination.
If an entity has no system identifier, then "e" acts like "ep" does. It is an error if either "e" or "ep" is used, and the entity has no system or public identifier bound by a library rule to a system identifier.
This format accesses letters within system and public identifiers in uppercase or lowercase as they appear in the entity declaration. Letters in element, entity, or notation names appear in uppercase or lowercase as they appear in the processed document, unless the SGML declaration specifies uppercase substitution for that class of name. If so, the name is accessed with letters forced to uppercase. Thus, in the Reference Concrete Syntax, by default, element and notation names appear in uppercase while entity names appear as entered in the document.
For an entities attribute, if the attribute value contains more than one entity name, the using prefix must be used to select one entity whose system or public identifier is to be manipulated or displayed.
If the value of an entity or entities attribute is the name of an internal CDATA or SDATA entity, the "%ev" format can be used to determine the replacement text of the internal entity.
The "e", "p", and "ep" formats can also be used with notation , under the same conditions as entity or entities .
This example illustrates how the "%ev" format handles internal and external entities differently.
The element "as-is" has a single required ENTITY attribute "text". The entity named by the attribute value simply provides the text that is to replace the element, wherever it occurs in a document.
<!ELEMENT as-is - o EMPTY>
<!ELEMENT as-is text ENTITY #REQUIRED>
The element rule for processing the "as-is" element does the following:
- If the entity named by attribute "text" is an external entity, then the element rule uses the system identifier declared for the entity, or the system identifier associated by a library rule with the entity's declared public identifier, as a file name, and replaces the element with the contents of the file. (OmniMark reports an error if the entity does not have a system identifier and does not have a public identifier mapped to a system identifier, or if the system identifier names a non-existent file. This may or may not be appropriate for a particular OmniMark program.)
- If the entity is an internal entity, then the element rule uses the replacement text of the internal entity and replaces the element with that text.
Note that "%ev" returns one of two things, depending on whether the entity named by the attribute to which it is applied is internal or external:
- For an attribute token that is the name of an external entity, it returns the system identifier.
- For an attribute token that is the name of an internal entity, it returns that entity's replacement text.
element as-is
do when attribute text is external
output file "%ev(text)"
else
output "%ev(text)"
done
suppress
|