|
Introduction
Many applications have "parameters" that neither the OmniMark programmer nor the document users want to have hard coded in the programs being used, the DTDs, or the documents. An example of such a "parameter" is a case in which a company's name is represented by an external general text entity, &company;
, that is being defined using a public identifier:
<!ENTITY company PUBLIC "-//miscellany//TEXT company//EN">
The use of the public identifier assures that the entity can be interpreted independently of the document containing the reference. A convenient way to make "&company;
" a parameter is to simply specify the entity's replacement text on the command line that runs the OmniMark program that processes the document. For example:
omnimark -s ... -define ent "company:OmniMark Technologies" ...
The programmer-defined stream "ent" is used as the command-line parameter. The OmniMark program fragment shown here illustrates how the parameter is taken from the "ent" stream and added to the #libvalue
shelf. More than one parameter is defined by using a semicolon to separate definitions and a colon to separate a name from its replacement text.
An important feature of this example is that the OmniMark program just knows how to support entities; it knows nothing about what entities are supported or even how many of them there are.
The "names" in the "ent" stream are used as "public text descriptions" of the public identifiers assigned to the entity, and an "unregistered owner identifier" of "miscellany" is used.
It is assumed that the OmniMark built-in entity manager is going to be used in this example, but an entity manager written using external-text-entity
rules could be supplied by the programmer instead.
global stream ent document-start when ent is attached repeat scan ent match [any except ":"]+ => public-id ":" [any except ";"]* => given ";"? set new #libvalue ^ "-//miscellany//text %x(public-id)//en" to value again
Related Concepts
Entities: built-in entity replacement text values |
---- |