Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Table Alignment Problem

Explorer ,
May 21, 2010 May 21, 2010

I have a CALS format table that I cannot get alignment to work properly.  I have the attributes for the table defined and handled in the R/W rules file (posted below).  I have code in the EDD to look at the TGROUP tag align attribute and to apply an initial table format appropriate to the attribute (also posted below).  There are 3 test conditions for left/center and right attribute values, then an else on the off chance that the attribute is not specified.  The system always chooses the ELSE condition regardless of the value of the align attribute.  I have tried different cases on the attribute value and I have tried different quotes on in the EDD around the attribute value.  Nothing works.  It seems like this should be simple.  Any idea what I am doing wrong?

Thanks for any help...

Jim

R/W RULES

/* Table Container rule */
element "table" {
   is fm element;

   /* Table subrules */
   attribute "ttabstyle" is fm property table format;
   attribute "frame"
   {
      is fm property table border ruling;
      value "ALL"    is fm property value all;
      value "TOPBOT" is fm property value top and bottom;
      value "TOP"    is fm property value top;
      value "BOTTOM" is fm property value bottom;
      value "SIDES"  is fm property value sides;
      value "NONE"   is fm property value none;
   }
   attribute "colsep" is fm property column ruling;
   attribute "rowsep" is fm property row ruling;
   attribute "orient" is fm attribute;
   attribute "pgwide" is fm property page wide;
}

/* Table Group rules, Table element is container object */
element "tgroup" {
   is fm table element;

   /* Attribute rules */
   attribute "cols"           is fm property columns;
   attribute "colsep"         is fm property column ruling;
   attribute "rowsep"         is fm property row ruling;
   attribute "align"          is fm attribute;
   attribute "charoff"        is fm attribute;
   attribute "char"           is fm attribute;
}

/* ColSpec handling */
element "colspec" {
   is fm colspec;
   attribute "colnum"   is fm property column number;
   attribute "colname"  is fm property column name;
   attribute "align"    is fm property cell alignment type;
   attribute "charoff"  is fm property cell alignment offset;
   attribute "char"     is fm property cell alignment character;
   attribute "colwidth" is fm property column width;
   attribute "colsep"   is fm property column ruling;
   attribute "rowsep"   is fm property row ruling;
}

/* SpanSpec handling */
element "spanspec" {
   is fm spanspec;
   attribute "spanname"  is fm property span name;
   attribute "namest"    is fm property start column name;
   attribute "nameend"   is fm property end column name;
   attribute "align"     is fm property cell alignment type;
   attribute "charoff"   is fm property cell alignment offset;
   attribute "char"      is fm property cell alignment character;
   attribute "colsep"    is fm property column ruling;
   attribute "rowsep"    is fm property row ruling;
}

/* Table Head rules */
element "thead" {
   is fm table heading element;
   attribute "valign" is fm attribute;
}

/* Table Foot rules */
element "tfoot" {
   is fm table footing element;
   attribute "valign" is fm attribute;
}

/* Table Body rules */
element "tbody" {
   is fm table body element;
   attribute "valign" is fm attribute;
}

/* Row rules */
element "row" {
   is fm table row element;
   attribute "valign" is fm attribute;
   attribute "rowsep" is fm property row ruling;
}

/* Entry rules */
element "entry" {
   is fm table cell element;
   attribute "colname" is fm property column name;
   attribute "namest" is fm property start column name;
   attribute "nameend" is fm property end column name;
   attribute "spanname" is fm property span name;
   attribute "morerows" is fm property more rows;
   attribute "colsep" is fm property column ruling;
   attribute "rowsep" is fm property row ruling;
   attribute "rotate" is fm property rotate;
   attribute "valign" is fm attribute;
   attribute "align" is fm attribute;
   attribute "charoff" is fm attribute;
   attribute "char" is fm attribute;
   /*attribute "align"    is fm property cell alignment type;
   attribute "charoff"  is fm property cell alignment offset;
   attribute "char"     is fm property cell alignment character;*/
}

EDD tgroup definition

Element (Table): tgroup
General rule: thead?, tbody, tfoot?
Attribute list
Name: align  Choice  Optional
Choices: left | right | center | justify | char
Name: charoff  String  Optional
Default: 50
Name: char  String  Optional
Initial table format
If context is: [align="left"]
Table format: Table w/ Ruling Left
Else, if context is: [align="center"]
Table format: Table w/o Ruling Center
Else, if context is: [align="right"]
Table format: Table w/ Ruling Right
Else
Table format: Table w/Ruling Ctr

Table Markup:

<table frame="NONE" colsep="1" rowsep="0">
<tgroup cols="2" colsep="1" rowsep="0" align="left" charoff="50" char="">
<colspec colnum="1" colname="1" colwidth="2.000in"/>
<colspec colnum="2" colname="2" colwidth="2.000in"/>
<tbody valign="top">
<row rowsep="1">
<entry colname="1" colsep="0" rowsep="0" valign="top" morerows="0" rotate="0">
<para>MD80</para>
</entry>
<entry colname="2" rowsep="0" valign="top" morerows="0" rotate="0">
<para>918/292-3080</para>
</entry>
</row>
<row rowsep="1">
<entry colname="1" colsep="0" rowsep="0" valign="top" morerows="0" rotate="0">
<para>
<revst/>737<revend/>
</para>
</entry>
<entry colname="2" rowsep="0" valign="top" morerows="0" rotate="0">
<para>918/292-3737/3757</para>
</entry>
</row>
<row rowsep="1">
<entry colname="1" colsep="0" rowsep="0" valign="top" morerows="0" rotate="0">
<para>
<revst/>A300<revend/>
</para>
</entry>
<entry colname="2" rowsep="0" valign="top" morerows="0" rotate="0">
<para>918/292-3300</para>
</entry>
</row>
<row rowsep="0">
<entry colname="1" colsep="0" valign="top" morerows="0" rotate="0">
<para>
<revst/>767/777<revend/>
</para>
</entry>
<entry colname="2" valign="top" morerows="0" rotate="0">
<para>817/224-0767/0777</para>
</entry>
</row>
</tbody>
</tgroup>
</table>

TOPICS
Structured
3.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , May 24, 2010 May 24, 2010

Jim,

jim_monaco wrote:

It's a little painful because you need to close the file and reopen to see the effect of the attribute change, but I can live with that.

What file do you need to close and reopen? Are you using another app to apply the XSLT? You can create a structured application in FrameMaker and specify the XSLT location in the structured app. When you open the XML file from Frame, Frame will apply the XSLT and then open the resulting file as a Frame file. The tgroupstyle attribute will be

...
Translate
Guide ,
May 21, 2010 May 21, 2010

Jim,

My EDD does not use tgroups, so this is all guessing.

My first guess is that the table format applies to the enclosing table element, not the tgroup element. Can one have multiple tgroups within a table element with each tgroup having a different table format? Does the table format apply to the table element or the tgroup element?

If the table format applies to the table element and not the tgroup element, then your EDD is trying to set the formatting of a parent element based upon an attribute of one of its children. I do not believe you can do that. Do you need to set the table formatting via the tgroup align attribute? Maybe you should use the ttabstyle attribute of the table element.


You could do a simple test by rearranging the order of the if-then-else tests in the EDD for the tgroup element. Does it always apply the format in the else clause, even if you rearrange the clauses? Or is it independent of the order? I am thinking that the template is applying a default table format to the table and NOT via the else clause. This would be consistent with my thoughts in the previous paragraph. Not sure, just guessing. At least the test would indicate which it is.

If you cannot ultimately set the table format via an attribute in the tgroup, you could create a simple XSLT that could set the ttabstyle attribute in the table element based upon the align attribute in the tgroup. Then your EDD would set the table formatting via the ttabstyle attribute.

Van

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 21, 2010 May 21, 2010

My understanding is that since the table tag is just a container in the EDD and the tgroup is the actual table, that setting the format on the tgroup should be fine.  In fact there is an example in the either the dev ref or dev guide that shows this same mappping.

Answering your questions:

Can one have multiple tgroups within a table element with each tgroup having a different table format? YES - but it rarely happens in practice.

Does the table format apply to the table element or the tgroup element? As described above I think it applies to the tgroup.

Do you need to set the table formatting via the tgroup align attribute? YES - it is standard CALS table format.

Or is it independent of the order? Order does not matter - I have tried various orders.  I can tell that the else clause is working because I can change the table format by changing the mapping in the ELSE clause.

If you cannot ultimately set the table format via an attribute in the tgroup, you could create a simple XSLT that could set the ttabstyle attribute in the table element based upon the align attribute in the tgroup. Then your EDD would set the table formatting via the ttabstyle attribute. This is a good idea.  I may not be able to use it since I need to change the DTD to support it and the DTD affects the online XML viewing application as well - but I may convince them to add the attribute if it works.  Thanks - I'll try this.

Jim

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 21, 2010 May 21, 2010

OK. My original thought was that Frame did something differently when there was only one tgroup within the table element; however, I have reread the development guide and I think I understand it. So....

I know little about the CALS spec, but Frame guide seems to indicate that the align attribute is used for cell alignment, not to indicate a general property of a tgroup. The table format of a tgroup is specified by a tgroupstyle attribute.

Maybe the Initial table format in the EDD applies only when you are creating a table within FrameMaker, not when importing XML. I have done a little playing with XML roundtripping and I can use a read/write rule like

attribute "table_format" is fm property table format;

to store and retrieve the table format. There is nothing in my EDD about the table_format attribute; it is used only in the roundtripping.

Maybe you need to add an attribute to hold the tgroup's table format. As I said above, I am thinking that maybe the Initial table format in the EDD is only for creating a table, not for setting a table's format when importing an XML. Hence, the suggestion about using an XSLT to set the table's format (in an attribute typed as fm property table format) based upon the value of another attribute (here align).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 21, 2010 May 21, 2010

OK - your suggestion worked.  I added the tgroupstyle attribute on the tgroup tag and set it in the XSLT based on the align attribute and that worked fine.  It's a little painful because you need to close the file and reopen to see the effect of the attribute change, but I can live with that.

Thanks - Jim

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 24, 2010 May 24, 2010

Jim,

jim_monaco wrote:

It's a little painful because you need to close the file and reopen to see the effect of the attribute change, but I can live with that.

What file do you need to close and reopen? Are you using another app to apply the XSLT? You can create a structured application in FrameMaker and specify the XSLT location in the structured app. When you open the XML file from Frame, Frame will apply the XSLT and then open the resulting file as a Frame file. The tgroupstyle attribute will be visible in the structure view if it is defined in the EDD.

Van

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 24, 2010 May 24, 2010

Yes - that is what I am doing.  If you are then in the frame file and decide to change the alignment you need to change the allign attribute and save and close the XML file.  THen when you reopen the file the new alignment will be set.  It would be nice if one could use a keystroke or menu function to to reapply the xslt to the open document without closing and reopening.

Thanks - JIm

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 24, 2010 May 24, 2010
LATEST

When you change the value of align, there is nothing preventing you from also applying the corresponding format to the table, using the table designer. It is still manual, but does not require you to close and reopen the file to get it done. IF the user forgets to change the table format or changes it to the wrong format, all will be corrected when the file is saved and opened later.

Van

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines