Skip to main content
Participant
January 5, 2012
Answered

Table straddle on export to XML

  • January 5, 2012
  • 1 reply
  • 871 views

Running Framemaker 10.0.2.419 on a Windows XP machine (I know). I have created a structured app to take our structured files (made with a custom EDD), process read/write rules for graphics, tables, etc. then run an XSLT to convert the source tree to XHTML. Everything works fine except for table cells that straddle.

I have the following R/W rules in place:

element "td"

{

  is fm table cell element "TableCell";

  attribute "colspan" is fm property horizontal straddle;

  attribute "rowspan" is fm property vertical straddle;

  attribute "align" is fm attribute;

  attribute "valign" is fm attribute;

  attribute "charoff" is fm attribute;

  attribute "char" is fm attribute;

}

I have tested this to see the output from Frame prior to applying the XSLT and the colspan and rowspan attributes do not appear. Our custom EDD does not have specific attributes for colspan and rowspan but I did add these to TableCell element in the DTD.

Is there anyway to get the colspan and rowspan attribute to appear in the results tree (with the proper values for table cells that straddle)?

Thanks in advance for any assistance,

Andre

This topic has been closed for replies.
Correct answer Van Kurtz

Andre,

This is what I have in my read/write rules:

element "Cell" {

    is fm table cell element;

    attribute "horizontal_straddle" is fm property horizontal straddle;

    attribute "vertical_straddle" is fm property vertical straddle;

}

In the DTD, I have:

<!ATTLIST Cell   horizontal_straddle  CDATA #IMPLIED
                 vertical_straddle  CDATA #IMPLIED
                 valign(top|middle|bottom)  #IMPLIED
                 halign(left|center|right)  #IMPLIED
                 linespacing  (fixed|notfixed)  "fixed"
                 type  (normal|softkeycell)  "normal" >

This works correctly with straddles.

The only difference I can see between my r/w and yours is that you have renamed the cell element from TableCell in your Frame document to td in the XML output. So, in your XML output (before applying the XSLT), the straddle attributes should appear in td elements, not TableCell elements.

As far as I know, there is no reason to have the elements in the EDD, because the user cannot set them anyway. Also, I see no reason to add the attributes to the DTD, because your workflow is a one-way street from Frame to XHTML. If the Frame document is valid, I would not worry about the validity of the resulting XML (that is my opinion; others may disagree), because you are not roundtripping the XML back to FrameMaker.

Because you are applying an XSLT to get the XHTML, you may not want to rename the cell element; just keep it at TableCell, which will have the straddle attributes. Then the XSLT can transform it to a td element.

Hope this helps,

Van

1 reply

Van Kurtz
Van KurtzCorrect answer
Inspiring
January 6, 2012

Andre,

This is what I have in my read/write rules:

element "Cell" {

    is fm table cell element;

    attribute "horizontal_straddle" is fm property horizontal straddle;

    attribute "vertical_straddle" is fm property vertical straddle;

}

In the DTD, I have:

<!ATTLIST Cell   horizontal_straddle  CDATA #IMPLIED
                 vertical_straddle  CDATA #IMPLIED
                 valign(top|middle|bottom)  #IMPLIED
                 halign(left|center|right)  #IMPLIED
                 linespacing  (fixed|notfixed)  "fixed"
                 type  (normal|softkeycell)  "normal" >

This works correctly with straddles.

The only difference I can see between my r/w and yours is that you have renamed the cell element from TableCell in your Frame document to td in the XML output. So, in your XML output (before applying the XSLT), the straddle attributes should appear in td elements, not TableCell elements.

As far as I know, there is no reason to have the elements in the EDD, because the user cannot set them anyway. Also, I see no reason to add the attributes to the DTD, because your workflow is a one-way street from Frame to XHTML. If the Frame document is valid, I would not worry about the validity of the resulting XML (that is my opinion; others may disagree), because you are not roundtripping the XML back to FrameMaker.

Because you are applying an XSLT to get the XHTML, you may not want to rename the cell element; just keep it at TableCell, which will have the straddle attributes. Then the XSLT can transform it to a td element.

Hope this helps,

Van

funkytravAuthor
Participant
January 6, 2012

Thank you so much for your help! That worked perfectly! I was jumping ahead an trying to apply the properties to the incorrect element (td) before the XSLT transformation.

At some point, we may investigate roundtripping but for now I am completely happy with the current results.

Thanks again,

Andre