I dreamed up some fancy FOSI footwork awhile back that seemed like it might be useful, but I have never had occasion to use it in a production FOSI. I am wondering if it is worth including in my book. It is detailed below. Whaddya think?
Thanks!
Suzanne Napoleon
www.FOSIexpert.com
"WYSIWYG is last-century technology!"
In the example below,the fancy FOSI footwork is not required --plain vanilla FOSI coding works fine, and the fancy footwork code is half again as long as the vanilla code. However, maybe the fancy FOSI footwork could be useful in certain complex situations that would be easier with a "case" approach.
The fancy footwork code uses different increment values with the enumerat category to create unique bitmap index numbers that represent the presence of required and optional elements. The example is in SGML so the ampersand (&) connector can be utilized. The ampersand connector means all of the elements in the content model must occur, but they may occur in any order.In this particular DTD, three of the five elements are optional, and there are eight possible bitmap index numbers.Note that this stunt does not work when an element is repeatable, unless it is limited to nine iterations.
In the SGML file, the first and subsequent odd lines show the elements authored in the output order, while the second and subsequent even lines show the elements in random order. Either way, the output is the same. PDF is attached.
The FOSI tests for each bitmap index number and applies the appropriate formatting.
SGML DTD fragment
SGML fragment
<name><first>Yvette</first><last>Bonne</last></name>
<name><last>Bonne</last><first>Yvette</first></name>
<name><first>Jonathan</first><last>Green</last><suffix>Jr.</suffix></name>
<name><suffix>Jr.</suffix><last>Green</last><first>Jonathan</first></name>
<name><first>Blanche</first><middle>Anne</middle><last>White</last></name>
<name><middle>Anne</middle><last>White</last><first>Blanche</first></name>
<name><first>John</first><middle>James</middle><last>Boddy</last><suffix>III</suffix></name>
<name><suffix>III</suffix><middle>James</middle><last>Boddy</last><first>John</first></name>
<name><honorific>Miss</honorific><first>Josephine</first><last>Scarlet</last></name>
<name><last>Scarlet</last><honorific>Miss</honorific><first>Josephine</first></name>
<name><honorific>Prof.</honorific><first>Peter</first><last>Plum</last><suffix>Sr.</suffix></name>
<name><suffix>Sr.</suffix><honorific>Prof.</honorific><last>Plum</last><first>Peter</first></name>
<name><honorific>Mrs.</honorific><first>Patricia</first><middle>Ann</middle><last>Peacock</last></name>
<name><last>Peacock</last><first>Patricia</first><honorific>Mrs.</honorific><middle>Ann</middle></name>
<name><honorific>Col.</honorific><first>Michael</first><middle>Algernon</middle><last>Mustard</last><suffix>IV</suffix></name>
<name><last>Mustard</last><suffix>IV</suffix><middle>Algernon</middle><first>Michael</first><honorific>Col.</honorific></name>
FOSI fragment - Regular coding
<stringdecl textid="first.txt" literal="">
<stringdecl textid="greeting.txt" literal="">
<stringdecl textid="honorific.txt" literal="">
<stringdecl textid="last.txt" literal="">
<stringdecl textid="middle.txt" literal="">
<stringdecl textid="name.txt" literal="">
<stringdecl textid="suffix.txt" literal="">
...
<e-i-c gi="first" context="name">
<charlist inherit="1" charsubsetref="SUPPRESS">
<savetext textid="first.txt" conrule="#CONTENT,\" \"=">
</charlist>
</e-i-c>
<e-i-c gi="honorific" context="name">
<charlist inherit="1" charsubsetref="SUPPRESS">
<savetext textid="honorific.txt" conrule="#CONTENT,\" \"=">
</charlist>
</e-i-c>
<e-i-c gi="last" context="name">
<charlist inherit="1" charsubsetref="SUPPRESS">
<savetext textid="last.txt" conrule="#CONTENT">
</charlist>
</e-i-c>
<e-i-c gi="middle" context="name">
<charlist inherit="1" charsubsetref="SUPPRESS">
<savetext textid="middle.txt" conrule="#CONTENT,\" \"=">
</charlist>
</e-i-c>
<e-i-c gi="suffix" context="name">
<charlist inherit="1" charsubsetref="SUPPRESS">
<savetext textid="suffix.txt" conrule="\" \,#content"=">
</charlist>
</e-i-c>
<e-i-c gi="name">
<charlist inherit="1" charsubsetref="block">
<reset resetlist="name.txt" greeting.txt"=">
<reset resetlist="honorific.txt" first.txt=" middle.txt=" last.txt=" suffix.txt"=">
<usetext source="<name.psu">,</name.psu>" placemnt="after"></usetext>
</charlist>
</e-i-c>
<e-i-c gi="name.psu">
<charlist inherit="1"></charlist>
<att>
<specval attname="honorific.txt" attloc="#FOSI" attval="#ANY">
<charsubset>
<savetext textid="greeting.txt" conrule="\Dear" \,honorific.txt,last.txt,\:\"=">
</charsubset>
</att>
<att>
<specval attname="honorific.txt" attloc="#FOSI" attval="#NONE">
<charsubset>
<savetext textid="greeting.txt" conrule="\Dear" \,first.txt,last.txt,\:\"=">
</charsubset>
</att>
<att>
<charsubset>
<usetext source="honorific.txt,first.txt,middle.txt,last.txt,suffix.txt" placemnt="after">
<subchars charsubsetref="block"></subchars>
</usetext>
<usetext source="greeting.txt">
<subchars charsubsetref="block"></subchars>
</usetext>
</e-i-c>
FOSI fragment - Fancy FOSI footwork
<counter initial="0" enumid="flagct">
<stringdecl textid="first.txt" literal="">
<stringdecl textid="greeting.txt" literal="">
<stringdecl textid="honorific.txt" literal="">
<stringdecl textid="last.txt" literal="">
<stringdecl textid="middle.txt" literal="">
<stringdecl textid="name.txt" literal="">
<stringdecl textid="suffix.txt" literal="">
...
<e-i-c gi="first" context="name">
<charlist inherit="1" charsubsetref="SUPPRESS">
<enumerat increm="1000" enumid="flagct">
<savetext textid="first.txt" conrule="#CONTENT">
</charlist>
</e-i-c>
<e-i-c gi="honorific" context="name">
<charlist inherit="1" charsubsetref="SUPPRESS">
<enumerat increm="10000" enumid="flagct">
<savetext textid="honorific.txt" conrule="#CONTENT">
</charlist>
</e-i-c>
<e-i-c gi="last" context="name">
<charlist inherit="1" charsubsetref="SUPPRESS">
<enumerat increm="10" enumid="flagct">
<savetext textid="last.txt" conrule="#CONTENT">
</charlist>
</e-i-c>
<e-i-c gi="middle" context="name">
<charlist inherit="1" charsubsetref="SUPPRESS">
<enumerat increm="100" enumid="flagct">
<savetext textid="middle.txt" conrule="#CONTENT">
</charlist>
</e-i-c>
<e-i-c gi="suffix" context="name">
<charlist inherit="1" charsubsetref="SUPPRESS">
<enumerat increm="1" enumid="flagct">
<savetext textid="suffix.txt" conrule="#CONTENT">
</charlist>
</e-i-c>
<e-i-c gi="name">
<charlist inherit="1" charsubsetref="block">
<reset resetlist="flagct" name.txt=" greeting.txt"=">
<reset resetlist="honorific.txt" first.txt=" middle.txt=" last.txt=" suffix.txt"=">
<usetext source="<name.psu">,</name.psu>" placemnt="after"></usetext>
</charlist>
</e-i-c>
<e-i-c gi="name.psu">
<charlist inherit="1"></charlist>
<att>
<specval attname="flagct" attloc="#FOSI" attval="#EQ#1010">
<charsubset>
<savetext textid="name.txt" conrule="first.txt,\" \,last.txt"=">
<savetext textid="greeting.txt" conrule="\Dear" \,first.txt,\=" \,last.txt,\:\"="></charsubset>
</att>
<att>
<specval attname="flagct" attloc="#FOSI" attval="#EQ#1011">
<charsubset>
<savetext textid="name.txt" conrule="first.txt,\" \,last.txt,\=" \,suffix.txt"=">
<savetext textid="greeting.txt" conrule="\Dear" \,first.txt,\=" \,last.txt,\:\"="></charsubset>
</att>
<att>
<specval attname="flagct" attloc="#FOSI" attval="#EQ#1110">
<charsubset>
<savetext textid="name.txt" conrule="first.txt,\" \,middle.txt,\=" \,last.txt"=">
<savetext textid="greeting.txt" conrule="\Dear" \,first.txt,\=" \,last.txt,\:\"="></charsubset>
</att>
<att>
<specval attname="flagct" attloc="#FOSI" attval="#EQ#1111">
<charsubset>
<savetext textid="name.txt" conrule="first.txt,\" \,middle.txt,\=" \,last.txt,\=" \,suffix.txt"=">
<savetext textid="greeting.txt" conrule="\Dear" \,first.txt,\=" \,last.txt,\:\"="></charsubset>
</att>
<att>
<specval attname="flagct" attloc="#FOSI" attval="#EQ#11010">
<charsubset>
<savetext textid="name.txt" conrule="honorific.txt,\" \,first.txt,\=" \,last.txt"=">
<savetext textid="greeting.txt" conrule="\Dear" \,honorific.txt,\=" \,last.txt,\:\"="></charsubset>
</att>
<att>
<specval attname="flagct" attloc="#FOSI" attval="#EQ#11011">
<charsubset>
<savetext textid="name.txt" conrule="honorific.txt,\" \,first.txt,\=" \,last.txt,\=" \,suffix.txt"=">
<savetext textid="greeting.txt" conrule="\Dear" \,honorific.txt,\=" \,last.txt,\:\"="></charsubset>
</att>
<att>
<specval attname="flagct" attloc="#FOSI" attval="#EQ#11110">
<charsubset>
<savetext textid="name.txt" conrule="honorific.txt,\" \,first.txt,\=" \,middle.txt,\=" \,last.txt"=">
<savetext textid="greeting.txt" conrule="\Dear" \,honorific.txt,\=" \,last.txt,\:\"="></charsubset>
</att>
<att>
<specval attname="flagct" attloc="#FOSI" attval="#EQ#11111">
<charsubset>
<savetext textid="name.txt" conrule="honorific.txt,\" \,first.txt,\=" \,middle.txt,\=" \,last.txt,\=" \,suffix.txt"=">
<savetext textid="greeting.txt" conrule="\Dear" \,honorific.txt,\=" \,last.txt,\:\"="></charsubset>
</att>
<att>
<charsubset>
<usetext source="name.txt">
<subchars charsubsetref="block"></subchars>
</usetext>
<usetext source="greeting.txt">
<subchars charsubsetref="block"></subchars>
</usetext>
</charsubset>
</att>
</e-i-c>