cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Odd-Even page in FOSI

RayStachowiak
12-Amethyst

Odd-Even page in FOSI

I want to set the titles for a paragraph quad right on even pages and quad right on odd pages. How do I determine odd/even pages in a FOSI, I am not good at ACL? Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Here is an example of the FOSI coding. Also see Figure 106 in my book.

 

Note that the id and quadding attributes or pseudo-attributes do not have to be on the title element, they could be on the parent element (XXX in the example below). In that case, be sure to specify the attloc and xrefidtag characteristics on the savetext category.

 

In the title e-i-c:

 

<att>
<fillval attname="id" attloc="XXX" fillcat="savetext" fillchar="conrule">
<charsubset>
<savetext textid="title-id.txt" xrefidtag="XXX">
<savetext textid="quadding.app" conrule="section-id.txt,\ \,folioct.txt[BO],\&#RE;\" append="1">
</charsubset>
</att>

 

On the top tag in the document, code the usetext that writes the external ASCII file:

 

<usetext source="quadding.app" placemnt="after" userule="1"></usetext>

 

In this example, the ASCII file is called quadding.exp and looks like this:

a1 1
a2 1
a3 2
a4 2
a5 3
a6 3

 

The next step is to run the ACL to find each id, determine if the page is right (odd) or left (even), and fill the quadding attribute or pseudo-attribute accordingly. Then the ACL should format the document again.

 

Note that the title e-i-c also needs the following attribute tests:

 

<att>
<specval attname="quadding" attval="left">
<charsubset>
<quadding inherit="1" quad="left" lastquad="lleft">

</charsubset>
</att>

<att>
<specval attname="quadding" attval="right">
<charsubset>
<quadding inherit="1" quad="right" lastquad="lright">

</charsubset>
</att>

 

Good luck!

Suzanne

View solution in original post

6 REPLIES 6

I did some testing with strings and pseudo-elements, but I could not get consistent and correct output.

I think the way to do this is:

1. Add an id attribute or pseudo-attribute to the title element.
2. In the title e-i-c, code a usetext userule=1 that writes the id and the page number to an external ASCII file.
3. The title element also needs an attribute or pseudo-attribute for the desired quadding.
4. Use ACL to read the ASCII file and go through the document and find each title id to set the quadding attribute or pseudo-attribute on the title element to left or right.  [I defer to the ACL experts to describe the necessary ACL.]
5. The title e-i-c needs a specval that tests the quadding attribute or pseudo-attribute and specifies the appropriate quadding.
6. Format the document again.

Good luck!
Suzanne Napoleon

SuzanneNapoleon@FOSIexpert.com
"WYSIWYG is last-century technology!"

Here is an example of the FOSI coding. Also see Figure 106 in my book.

 

Note that the id and quadding attributes or pseudo-attributes do not have to be on the title element, they could be on the parent element (XXX in the example below). In that case, be sure to specify the attloc and xrefidtag characteristics on the savetext category.

 

In the title e-i-c:

 

<att>
<fillval attname="id" attloc="XXX" fillcat="savetext" fillchar="conrule">
<charsubset>
<savetext textid="title-id.txt" xrefidtag="XXX">
<savetext textid="quadding.app" conrule="section-id.txt,\ \,folioct.txt[BO],\&#RE;\" append="1">
</charsubset>
</att>

 

On the top tag in the document, code the usetext that writes the external ASCII file:

 

<usetext source="quadding.app" placemnt="after" userule="1"></usetext>

 

In this example, the ASCII file is called quadding.exp and looks like this:

a1 1
a2 1
a3 2
a4 2
a5 3
a6 3

 

The next step is to run the ACL to find each id, determine if the page is right (odd) or left (even), and fill the quadding attribute or pseudo-attribute accordingly. Then the ACL should format the document again.

 

Note that the title e-i-c also needs the following attribute tests:

 

<att>
<specval attname="quadding" attval="left">
<charsubset>
<quadding inherit="1" quad="left" lastquad="lleft">

</charsubset>
</att>

<att>
<specval attname="quadding" attval="right">
<charsubset>
<quadding inherit="1" quad="right" lastquad="lright">

</charsubset>
</att>

 

Good luck!

Suzanne

Whoops! I skipped a step. The ASCII file is named quadding.exp only if you code a usetext on the top tag that calls a pseudo-element: 

 

<usetext source="<quadding>,</quadding>" placemnt="after"></usetext>

 

The usetext with userule=1 is coded in the pseudo-element:

 

<e-i-c gi="quadding">
<charlist inherit="1">
<usetext source="quadding.app" userule="1"></usetext>
</charlist>
</e-i-c>

 

Otherwise, the .exp file is named for the top tag.

Thank you Suzanne, this FOSI code looks ok and I understand it. Now for the middle part ACL. If someone has a good idea of how to code something to resolve this created file so it can be recomposed with the left and right attributes, I would be most grateful. I do not know much about ACL and thank you in advance.

I am not an ACL expert, but I took a stab at developing some code that seems like it should work. Unfortunately, the first quad attribute is incorrect (set to 0 instead of 1). I am hoping an ACL expert can tell you what I am doing wrong. (Worst case: you could manually correct the erroneous attribute.)

 

In my test doc, the id attribute is on <section>, which has a numeric attribute named group. You will need to modify the ACL to match your markup.

 

In my test doc, the ACL finds each <section> tag and sets the group attribute to 0 or 1. The FOSI interprets 0 as even page/quad right or odd page/quad left.

 

1. Preview allpasses force.
2. Source the ACL file at the command line.
3. Enter setquad() at the command line.
4. Preview allpasses force.

 

ACL
===
function setquad()
{
local $fid, $line, $arr[2], $idattr, $quad
$fid = open("quadding.exp", "r");
if ($fid < 0)
     {
     eval "Couldn’t open file for read:";
     }
while (getline($fid, $line))
     {
     chop($line);
     split($line, $arr, " ");
     $idattr = arr[1];
     $quad = arr[2] % 2;
     find -t '<section>';
     modify_tag group = $quad;
     }
close($fid);
}

Here is the ACL fix: add -nows to the find command:

 

    find -t -nows '<section>'

 

Suzanne

Top Tags