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

FM2017 automaticaly exports colspec elements to XML but how to have their attributes set?

Community Beginner ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

After going through both the Structure Application Developer's and Application Developer's Reference guides I still don't seem to get how can I export xml with colspec attributes set.

 

The context: I'm working with DocBook so tgroup is the equivalent of the TABLE element. The DTD specifies that a tgroup may have zero-or-more colspec child elements. FrameMaker doesn't allow me to add those elements, but when it exports it adds the exact number of colspec elements as there are columns. That's awesome! My problem is that the resulting xml has colspec with no attributes set. And, as a side-effect, straddling isn't exported properly.

For example, this is what FM exports

 

<table frame="all">
<title>yadayada</title>
<tgroup cols="12">
<colspec/>
<colspec/>
<colspec/>
<colspec/>
<colspec/>
<colspec/>
<colspec/>
<colspec/>
<colspec/>
<colspec/>
<colspec/>
<colspec/>
<tbody>
<row>
<entry namest="1" nameend="6">x</entry>
<entry namest="7" nameend="8">y</entry>

 

....

 

Other xml tools need to know which column has its colname set "1", "2"  (via <colspec colname="1"/> <colspec colname="2"/>)and so on and so forth.

 

What am I missing ?

 

TOPICS
Structured , XML author

Views

371

Translate

Translate

Report

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

Advisor , Jun 09, 2020 Jun 09, 2020

FM does not use colspec attributes internally--it's own table structure provides the number of columns and their widths and defines any straddles. However, when you save your document as XML, it can use colspec attributes. Since you are getting colspec elements without any attributes, I suspect that the DTD you are using does not have the same attribute names as FM's default. You will need read/write rules such as:

 

element "colspec"
{
   is fm colspec;
   attribute "colnum" is fm property column

...

Votes

Translate

Translate
Advisor ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

FM does not use colspec attributes internally--it's own table structure provides the number of columns and their widths and defines any straddles. However, when you save your document as XML, it can use colspec attributes. Since you are getting colspec elements without any attributes, I suspect that the DTD you are using does not have the same attribute names as FM's default. You will need read/write rules such as:

 

element "colspec"
{
   is fm colspec;
   attribute "colnum" is fm property column number;
   attribute "colname" is fm property column name;
   attribute "colwidth" is fm property column width;
}

 

--Lynne

Votes

Translate

Translate

Report

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
Community Beginner ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

Lynne,

 

After adding r/w rule I started getting the proper colspec attributes filled in. Thanks! What is odd is that the DTD has the colspec and that was the reason I didn't have such a r/w rule.

Now the problem seems to be related to straddling. I'm only getting the namest and namend attributes on the first entry element, For the sake of completeness I've adopted all the translation element included in the Application Developer's Reference suggested in Chapter 8 (as shown below) but the problem persists. Would you have any further advice on it?

 

element "table" {
	is fm element;
/* The rest of the subrules for table are always applicable. */
	attribute "tabstyle" is fm property table format;
	attribute "tocentry" is fm attribute;
	attribute "frame"{
		is fm property table border ruling;
		value "top" is fm property value top;
		value "bottom" is fm property value bottom;
		value "topbot" is fm property value top and bottom;
		value "all" is fm property value all;
		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;
}

/*Read/Write Rules for the CALS/OASIS Table Model 224*/
element "tgroup" {
	is fm table element;
/*The rest of the subrules for tgroup are always applicable.*/
	attribute "cols" is fm property columns;
	attribute "tgroupstyle" is fm property table format;
	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;
}

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;
}

/*Structured Application Developer Reference 225*/
element "thead" {
	is fm table heading element;
	attribute "valign" is fm attribute;
}
element "tfoot" {
	is fm table footing element;
	attribute "valign" is fm attribute;
}
element "tbody" {
	is fm table body element;
	attribute "valign" is fm attribute;
}
element "row" {
	is fm table row element;
	attribute "valign" is fm attribute;
	attribute "rowsep" is fm property row ruling;
}

element "colspec"{
	is fm colspec;
	attribute "colnum" is fm property column number;
	attribute "colname" is fm property column name;
	attribute "colwidth" is fm property column width;
}

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;
}

 

Votes

Translate

Translate

Report

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
Advisor ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

DePaul,

   I just did a test with FM 2019. Every <entry> has either a colname attribute (if it's not a horizontal straddle) or both a namest and a nameend attribute (if it is not a horizontal straddle, whether or not it's a vertical straddle). Are you seenng somethhing different?

       --Lynne

 

Votes

Translate

Translate

Report

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
Community Beginner ,
Jun 10, 2020 Jun 10, 2020

Copy link to clipboard

Copied

LATEST

Lynne,

I've root-caused the most recent issue I've reported to my script which was not properly iterating over the columns that needed to be straddled.

I'm going to mark your initial answer as correct. Thanks!

Votes

Translate

Translate

Report

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