Building a Basic Line Numbering Application
Use the following procedure to build a rudimentary application that will add line numbers to an XML document. You can use the sample application code found in the linenum.acl file in samples\linenumbering folder of your installation directory as a starting point or build the application entirely from scratch.
|
If you are editing SGML documents, remember to recompile your document type to add the line numbering FOSI fragments (atipl-eic.fos) that are found in the \lib directory of your installation. XML document types are automatically recompiled.
|
To Build a Basic Line Numbering Application:
1. Build an ACL application that will be used to define the line numbering behavior you want to apply to the atipl tags in a document. You can provide specifications for each of the atipl tags. Detailed descriptions of the generic attributes for each tag are provided in the reference section of this chapter. The following list provides suggestions for your application:
◦ If you want line numbers to restart at each new page, include a counter in your code that initializes at each atipl:startpage tag.
◦ If you want line numbers to appear on every fifth line, include a counter in your code that sets the attr1 on each atipl:startline tag that is divisible by 5.
◦ By default, line numbers are displayed in both the Edit view and composed print output. If you would like to limit line numbering to one media or the other, set the atipl variable to either print or screen. For example, to limit line numbers to composed print output, add the following line to your code:
$atipl="print"
◦ Generated text must be refreshed in order for the newly applied line numbers to be displayed in the Edit view. Add the following line to your code to automatically refresh generated text:
set gentext=off ; set gentext=on
2. Open an XML document and call the layout::apply function, passing your ACL application through as the first argument. The layout::apply function causes a series of composition and layout events to occur:
a. A formatting pass is completed and a
.layout file is generated, which specifies the structure of the document as it will appear in composed output, and defines where the
atipl tags will appear. For more information about the layout file, please refer to
The Layout file and document type.
b. The atipl markup is added to your document.
c. A second formatting pass is performed, your application is called and sets a series of common attributes on the atipl tags, which define the line numbers' appearance.
d. The line numbers are displayed in your Edit view.
Related Topics