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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Width of the element content in the FOSI

ptc-1314704
1-Newbie

Width of the element content in the FOSI

Hi,

In our print FOSI, we want that if width of the content inside <term> element is more than certain value, then the definition should start in a new line. But we have not found any way in the FOSI to find the width of the content inside any particular element.

Please let us know if there is any way to find the width of the content inside FOSI. It cannot be related with number of characters as width of different characters are different (as it is not AS-IS character).

Best Regards,

Girish Kumar



9 REPLIES 9

Assuming that <term> is a child of <deflist>, one of the better ways to do this would be to use "algroup" or side-by-side formatting for the <term> and <def> e-i-c's. You can define the widths in whatever units of measure you want to use, which, for best practices, should be the same used for the other measurements in your FOSI.

Girish,

Unfortunately, there is not a way to measure content within an element using FOSI. You can test for attribute values and format accordingly, but that's not going to get you what you want.

The only way I know of (in my limited experience with FOSI, ACL and SGML) is to use an ACL function to measure the content of the tag you want to look at. That measurement can be computed by using some sort of "average" width and multiplying it by the number of characters found in the tag. The result can then be manipluated as needed and fed into the <algroup> indents to give you variable columns that would be based onthe width computed by the ACL function.

There's a lot to consider whentrying to make something "all-emcompassing" for output. Most of the time, FOSI can handle it. However, when the content of a tag is used to somehow determine the output, ACL is almost always required to get the results you want.

Hope this Helps,

Bob

In Reply to Ed Benton:

Assuming that <term> is a child of <deflist>, one of the better ways to do this would be to use "algroup" or side-by-side formatting for the <term> and <def> e-i-c's. You can define the widths in whatever units of measure you want to use, which, for best practices, should be the same used for the other measurements in your FOSI.

You're right. I misread the original post. I thought he wanted the <term> contents to wrap when it was beyond a certain length. Starting a new line if it is greater than a certain length is difficult to do with FOSI. FOSI is not very good at using regular expressions and other ACL-like logic.

On the other hand, if this is using <deflist> and the problem is that the <term> elements that have too-long contents are pushing things off too far to the right and causing the <def> contents to wrap beneath the <term> contents, perhaps using algroup formatting with the virtual column widths set to appropriate values and wrapping the <term> text when necessary would be a better and easier solution than calculating the length and starting a new line if it is calculated to be too long.

Girish,

The full context of your requirement isn't clear; is it important to
know the width for some purpose other than to force the content to start
on a new line?

If your requirement is to keep <term> content from splitting across
lines in the flowtext area, you can accomplish this by adding a 'boxing'
category to your <term> element, as follows

<e-i-c gi="term">
<charlist inherit="1" charsubsetref="inline">
...
<boxing tthick="0pt" bthick="0pt" lthick="0pt" rthick="0pt">
...
</charlist>
</e-i-c>

The box will be invisible, but will prevent the content of <term> from
breaking across lines.

Hope this helps.

David

David S. Taylor

Project Manager, Structured Information
Institute for Research in Construction
National Research Council Canada
Bldg. M-23A, Room 239
1200 Montreal Road, Ottawa, ON K1A 0R6

Hi,

Thanks to all for the response. It looks to me like the questions itself was not so clear due to which I received mixed responses and I don't feel that any response solves my problem.

So, I am reframing the question/problem:

We have def-list in which <term> and <def> appears side-by-side. We have reserved fixed amount of space for <term> and rest of the space for <def> in the same line in FOSI. Now, look at the below example:

Term A Defintion of term A...

Term B up to 15Defintion of term B...

Term C exceeding fifteen characters

Defintion of term C...

Term DDefintion of term D...

As can be seen above that for Term C, we want the definition to appear in a new line with same left indentation. So, in general, we want that if text inside <term> exceeds the space reserved for <term>, then <def> should start ina new line.

Now, the question is how we can find out if text inside <term> exceeds the given space.

Best Regards,

Girish Kumar



Hi Girish,

I'm assuming this is for print composition? I'm 99% sure that you can't
automate that rule with the FOSI or XSL-FO composition path. The format
decisions for FOSI or XSL-FO are based on the document structure and
markup, not print composition artifacts such as the formatted width of
some text.

If you can have someone or some script add markup around those long
terms (eg. an attribute on the <term>), then you could use that to
trigger the different term/def layout.

BTW, if you are on Arbortext 5.4, you have the option of using the APP
print composition path. This provides more advanced print composition
and would allow you (via overrides) to implement this type of rule
without extra scripting or manual intervention.

Cheers,
Gareth

Girish Dewangan wrote:
> Hi,
>
> Thanks to all for the response. It looks to me like the questions itself
> was not so clear due to which I received mixed responses and I don't
> feel that any response solves my problem.
>
> So, I am reframing the question/problem:
>
> We have def-list in which <term> and <def> appears side-by-side. We
> have reserved fixed amount of space for <term> and rest of the space for
> <def> in the same line in FOSI. Now, look at the below example:
>
> **Term A** Defintion of term A...
>
> **Term B up to 15** Defintion of term B...
>
>
>
> **Term C exceeding fifteen characters**
>
> **** Defintion of term C...
>
>
>
> **Term D** Defintion of term D...
>
> As can be seen above that for Term C, we want the definition to appear
> in a new line with same left indentation. So, in general, we want that
> if text inside <term> exceeds the space reserved for <term>, then <def>
> should start in a new line.
>
> Now, the question is how we can find out if text inside <term> exceeds
> the given space.
>
> Best Regards,
>
> Girish Kumar

Girish,
I know this doesn't help immediately, but...

The behavior you desire is one that we have seen before, but in our case it was undesirable. As a consequence, I'm having to search my memory for what it was we did to make it NOT do this. That is, how we structured the FOSI (no ACL involved) to avoid it, as opposed to how the FOSI was structured when it occurred.

I will definitely let you know if I find that answer before you arrive at one independently. In any case, don't give up on doing it in the FOSI, because it has been done before (however inadvertently that may have been).

Regards,
Steve Thompson
+1(316)977-0515

Hi Girish,

As Gareth said, you can't really determine the exact formatted width that the term element's contents will have. But if a rule based on the number of characters is acceptable then you can accomplish what you need. To have different behaviour in the FOSI based on the amount of characters in the term element, you can set up an <att> rule in the e-i-c for term that calls an ACL function to determine the contents of the element in question. You would set up an att rule to handle each case like this:

<att> <specval attname="MoreThan15Chars" attloc="system-func" attval="1"> ... </att>
and

<att> <specval attname="MoreThan15Chars" attloc="system-func" attval="0"> ... </att>

and then you just need to create a MoreThan15Chars function. The oid of the element whose "e-i-c" contains the specvals will be passed to this function automatically, so you write the function like this:

function MoreThan15Chars(window, oid) {
return length(oid_content($oid)) > 15;

}

# This function will return 1 (true) if the content of the e-i-c is more than 15 characters, 0 (false) if it is equal to or less than 15 characters.

This assumes that you will create the <att> rules in the e-i-c for the term element; if you want to put them in the e-i-c for <def> instead then you would change it to something like:

return length(oid_content(oid_prev($oid))) > 15;

Hope this helps,

Dugald

Girish

I'm thinking that maybe keep-together-lline/inline boxing for <term>, kern-to for <def>, and a spacefill between <term> and <def> that has the right break point(s) might work. <disclaimer>This may be a long shot. I haven't tried it and don't know if it will work.</disclaimer>

Good Luck!
Suzanne Napoleon
www.FOSIexpert.com
"WYSIWYG is last-century technology!"


Top Tags