FOSI Tips and Tricks
Style sets as comments. The Suppress category changes how other categories in the e-i-c
and child e-i-c's behave. To make it immediately obvious an e-i-c is suppressed, use a
SUPPRESS style set/charsubset.
Text variable names as comments. A title saved to recto.txt implies it will appear in the
header or footer on recto pages with different information appearing on verso pages. If both
pages are the same, save the title to header.txt or footer.txt.
Start the e-i-c style panel from the document. If you make formatting changes, but don't
see the change, start the e-i-c panel from the document to be sure you have the right context,
Viewing table markup. If users are able to see table tags, code <row> and other container
elements with textbrk startln=1 endln=1 for Edit window display.
Streamline attribute testing. There is no need to test for #ANY in conjunction with a fillval. If
the attribute is not set in the document, a fillval in the FOSI will have no effect.
The code, tips, and tricks here exemplify the not-available-anywhere-else code, tips, and tricks in the FOSI Quickstart Tutorials for Screen and Print FOSIs.
|
Facilitate ASCII searching. The unit of measurement defaults to points, which means you
can skip "pt." However, including "pt" makes it easier to search the FOSI in an ASCII editor.
Rotated text
You can use the following TeX pass-thru in a FOSI to rotate text for print/PDF:
<usetext source="%\hbox{\special{pub: rotate 45}%,66pt,\YOUR TEXT HERE\,%}%">
You can change:
- the degree of rotation (45 in the example)
- the size of the rotated text (66pt in the example)
- the rotated text (YOUR TEXT HERE in the example).
In addition to a hard-coded string, you can output a text variable:
<usetext source="%\hbox{\special{pub: rotate 39}%,pt,your-text.txt,%}%"></usetext>
You can code suppress sup="1" and output rotated #CONTENT -- even from a table cell:
<usetext source="%\hbox{\special{pub: rotate 39}%,10pt,#CONTENT,%}%"></usetext>
The rotated text is displayed in Preview. In the Edit window, the text is displayed, but it is not rotated.
|
FOSI-generated tables (Gentables)
In Epic 4 and above, you can code all table markup in a savetext conrule and usetext source using
the exclamation point (!) as the delimiter. Unlike authored tables, FOSI-generated tables are always
perfectly and consistently formatted. And they display in the Edit window.
Note that tables take longer to process and format than flowing text. Also, vertical justification is
available in flowing text but not in tables.
Following is an example that outputs regular elements as a FOSI gentable. Note that the
DTD and DCF must support the CALS table model.
DTD Fragment
<!ELEMENT partlist (part)+ >
<!ELEMENT part (partno, partdesc, qty, unit-price) >
<!ELEMENT (partno | partdesc | qty | unit-price) (#PCDATA) >
XML Fragment
<section>
<title>Regular Elements Output as a Table</title>
<partlist>
<part>
<partno>1234567</partno>
<partdesc>Aaaa</partdesc>
<qty>444</qty>
<unit-price>.70</unit-price>
</part>
<part><partno>2345678</partno>
<partdesc>Bbbb</partdesc>
<qty>5,555</qty>
<unit-price>8.88</unit-price></part>
<part><partno>3456789</partno>
<partdesc>Cccc</partdesc>
<qty>666,666</qty>
<unit-price>99.00</unit-price>
</part>
</partlist>
FOSI Fragment
<e-i-c gi="partno">
<charlist inherit="1">
<suppress sup="1">
<savetext textid="partno.txt" conrule="#CONTENT">
</charlist>
</e-i-c>
<e-i-c gi="partdesc">
<charlist inherit="1">
<suppress sup="1">
<savetext textid="partdesc.txt" conrule="#CONTENT">
</charlist>
</e-i-c>
<e-i-c gi="qty">
<charlist inherit="1">
<suppress sup="1">
<savetext textid="qty.txt" conrule="#CONTENT">
</charlist>
</e-i-c>
<e-i-c gi="unit-price">
<charlist inherit="1">
<suppress sup="1">
<savetext textid="unit-price.txt" conrule="#CONTENT">
</charlist>
</e-i-c>
<e-i-c gi="part">
<charlist inherit="1" charsubsetref="Block">
<savetext textid="part.app" placemnt="after" append="1"
conrule='!<row><entry colsep="0" align="left">!,partno.txt,!</entry>
<entry colsep="0" align="center">!,partdesc.txt,!</entry>
<entry colsep="0" align="right">!,qty.txt,!</entry>
<entry colsep="0" align="char" char="." charoff="50">!,\$\,unit-price.txt\,!
</entry></row>!'>
</charlist>
</e-i-c>
<e-i-c gi="partlist">
<charlist inherit="1" charsubsetref="Block">
<usetext source='!<table><title>Parts List</title>
<tgroup cols="4">
<colspec colname="col1" colwidth="1in"/>
<colspec colname="col2" colwidth="1in"/>
<colspec colname="col3" colwidth="1in"/>
<colspec colname="col4" colwidth="1in"/>
<thead>
<row>
<entry colsep="0" align="center">
<?Pub _cellfont Weight="bold" Shading="green"?>Number</entry>
<entry colsep="0"align="center">
<?Pub _cellfont Weight="bold" Shading="green"?>Description</entry>
<entry colsep="0"align="center">
<?Pub _cellfont Weight="bold" Shading="green"?>Quantity</entry>
<entry colsep="0"align="center">
<?Pub _cellfont Weight="bold" Shading="green"?>Unit Price</entry>
</row>
</thead>
<tbody>!
,part.app,
!</tbody></tgroup></table>!' placemnt="after"></usetext>
</charlist>
</e-i-c>
<e-i-c gi="title" context="table">
<charlist inherit="1" charsubsetref="title SpaceBeforeLarge SpaceAfterMedium
AlignLeft">
</charlist>
</e-i-c>
You may find it helpful to create the table first in Arbortext Editor and
then copy the markup into the FOSI in an ASCII editor. This helps eliminate
problems from typos in the syntax.
FOSI-generated HTML with XSLT post-processing
|
The exclamation point delimiter used to generate table markup can also be used to generate structured HTML markup for block elements. The result is written to an external ASCII file with usetext userule="1". The HTML is quickly generated when the document is formatted. An XSLT post process is then used to transform inline elements to the desired HTML inline elements. This approach enables custom HTML and print/PDF to be output from the same FOSI.
Like any FOSI-generated external ASCII file, the HTML file is named for the element or pseudo-element with the usetext userule="1". The default .exp file name extension can be set to .htm or .html using the APTEXPORTEXT environment variable.
|
Keeping track of delimiters
|
You can use line breaks in the tagged FOSI editor or an ASCII editor to help keep track of gentable delimiters in a savetext conrule or usetext source, as shown in the following code fragment:
<usetext source=' !<table><tgroup cols="1"><colspec colname="col1" colwidth="*"/><tbody><row><entry>! ,content.txt, !</entry></row></tbody></tgroup></table>! '>
|
Expert Stylesheet Consulting for Arbortext
|
World expert on applied FOSI
|
FOSI Quickstart Tutorials for Screen FOSIs and Print FOSIs now on sale
|
Symbols for footnotes [excerpted from FOSI Quickstart Tutorials for Print FOSIs] Footnote elements can output symbols instead of numbers or letters, using the following FOSI code. Note that the number of symbols coded must be sufficient for the maximum number of footnotes. If the number of footnotes exceeds the number of symbols coded, the remaining footnotes will have the same symbol.
<styldesc> <e-i-c gi="footnote-symbols.psu"> <charlist inherit="1"></charlist> <att> <specval attname="footnotect" attloc="#FOSI" attval="1"> <charsubset><savetext textid="footnotect.txt" conrule="\*\"></charsubset> </att> <att> <specval attname="footnotect" attloc="#FOSI" attval="2"> <charsubset><savetext textid="footnotect.txt" conrule="\†\"></charsubset> </att> <att> <specval attname="footnotect" attloc="#FOSI" attval="3"> <charsubset><savetext textid="footnotect.txt" conrule="\‡\"></charsubset> </att> <att> <specval attname="footnotect" attloc="#FOSI" attval="4"> <charsubset><savetext textid="footnotect.txt" conrule="\§\"></charsubset> </att> <att> <specval attname="footnotect" attloc="#FOSI" attval="5"> <charsubset><savetext textid="footnotect.txt" conrule="\¶\"></charsubset> </att> <att> <specval attname="footnotect" attloc="#FOSI" attval="6"> <charsubset><savetext textid="footnotect.txt" conrule="\∥\"></charsubset> </att> <att> <specval attname="footnotect" attloc="#FOSI" attval="7"> <charsubset><savetext textid="footnotect.txt" conrule="\°\"></charsubset> </att> </e-i-c> ... </styldesc> <ftndesc> <e-i-c gi="footnote"> <charlist inherit="1"> <enumerat increm="1" enumid="footnotect"> <usetext source="<footnote-symbols.psu>,</footnote-symbols.psu>" placemnt="before"></usetext> <usetext source="1pt,footnotect.txt" placemnt="before"></usetext> </charlist></e-i-c> <ftnatts> <charlist> <usetext source="footnotect.txt" placemnt="before"> </usetext> </charlist> </ftnatts> </ftndesc>
|

Match individual words in an attribute
#ITEM# is used to match literal text coded in the FOSI with individual words in an attribute. This is useful for elements
such as <emphasis> that have an attribute in which users enter the desired formatting. Tthis example shows the Edit
window with a <highlight> element with a role attribute that specifies all supported types of formatting.
FOSI fragment
<e-i-c gi="highlight">
<charlist inherit="1"></charlist>
<att>
<specval attname="role" attloc="highlight" attval="#ITEM#bold">
<charsubset>
<font inherit="1" weight="bold">
</charsubset>
</att>
<att>
<specval attname="role" attloc="highlight" attval="#ITEM#italic">
<charsubset>
<font inherit="1" posture="italic">
</charsubset>
</att>
<att>
<specval attname="role" attloc="highlight" attval="#ITEM#underline">
<charsubset>
<highlt inherit="1" scoring="1" scorespc="1">
</charsubset>
</att>
<att>
<specval attname="role" attloc="highlight" attval="#ITEM#allcaps">
<charsubset>
<highlt inherit="1" allcap="1">
</charsubset>
</att>
</e-i-c>

Download the color-coded outspec.fos for easier navigation in the tagged FOSI editor
|