Row spanning for simpletables

Post here questions and problems related to editing and publishing DITA content.
tgrantham
Posts: 25
Joined: Thu Oct 27, 2011 8:03 pm

Row spanning for simpletables

Post by tgrantham »

Hi, Radu.

The DITA <simpletable> content model does not provide any attribute like the CALS table @morerows attribute that enables authors to span cells across rows.

However, I would like to provide this capability in the oXygen author editor for specializations of <simpletable>. Am I right in thinking that I could just modify the DITASimpleTableDocumentTypeHelper class to do this?

The tricky part is that I want to make this row spanning capability on cells automatic for authors. Each specialization of <simpletable> that we have created includes multiple specializations of <stentry> that define different types of columns for the table -- for example: category, subcategory, size, criteria. Each row must start with a category element, but can be followed by any number of subcategory, size, and criteria elements, in any order. I want the DITA oXygen WYSIWYG editor to automatically insert empty cells and set spanning across those cells based on the number of the optional cell elements, and the order of the columns as the author has defined them in the header row for the table, using the categoryhd, subcategoryhd, sizehd, and criteriahd elements.

Here is an example of such a table:

Code: Select all

        <cs-tnm-table id="cs-tnm-table_xdb_124_rm" relcolwidth="1.52* 1.52* 3.0* 4.22* 1.26* 1.89* 1.0*">
<cs-tnm-head>
<cs-tnm-cathd>Tumor level…</cs-tnm-cathd>
<cs-tnm-subhd>Which includes…</cs-tnm-subhd>
<cs-tnm-sizehd>Is assigned when the size of the primary tumor is…</cs-tnm-sizehd>
<cs-tnm-crithd>And…</cs-tnm-crithd>
</cs-tnm-head>
<cs-tnm-categories>
<cs-tnm-category>T1</cs-tnm-category>
<cs-tnm-subcat>T1a</cs-tnm-subcat>
<cs-tnm-size><operator keyref="equalToOrLessThan"/>1cm</cs-tnm-size>
<cs-tnm-criteria>is limited to the thyroid.</cs-tnm-criteria>
<cs-tnm-subcat>T1b</cs-tnm-subcat>
<cs-tnm-size><operator keyref="greaterThan"/>1 cm but <operator keyref="equalToOrLessThan"/>2 cm in greatest dimension
</cs-tnm-size>
<cs-tnm-criteria>is limited to the thyroid.</cs-tnm-criteria>
</cs-tnm-categories>
<cs-tnm-categories>
<cs-tnm-category>T2</cs-tnm-category>
<cs-tnm-size>
<ul>
<li><operator keyref="greaterThan"/>2 cm, but</li>
<li><operator keyref="equalToOrLessThan"/>4 cm</li>
</ul>
</cs-tnm-size>
<cs-tnm-criteria>is limited to the thyroid. </cs-tnm-criteria>
</cs-tnm-categories>
<cs-tnm-categories>
<cs-tnm-category>T3</cs-tnm-category>
<cs-tnm-size><operator keyref="greaterThan"/>4 cm in greatest dimension</cs-tnm-size>
<cs-tnm-criteria>is limited to the thyroid.</cs-tnm-criteria>
<cs-tnm-size>any size</cs-tnm-size>
<cs-tnm-criteria>
<p>has minimal extrathyroid extension such as extension to <ul id="ul_nj4_sf4_rm">
<li>sternothyroid muscle, or</li>
<li>perithyroid soft tissues.</li>
</ul></p>
</cs-tnm-criteria>
</cs-tnm-categories>
<cs-tnm-categories>
<cs-tnm-category>T4a</cs-tnm-category>
<cs-tnm-size>any size</cs-tnm-size>
<cs-tnm-criteria>
<p>extends beyond the thyroid capsule to invade areas such as the<ul id="ul_sbj_xf4_rm">
<li>subcutaneous soft tissues</li>
<li>larynx</li>
<li>trachea</li>
<li>esophagus, or</li>
<li>recurrent laryngeal nerve.</li>
</ul></p>
</cs-tnm-criteria>
<cs-tnm-criteria>is intrathyroidal anaplastic carcinoma.</cs-tnm-criteria>
</cs-tnm-categories>
<cs-tnm-categories>
<cs-tnm-category>T4b</cs-tnm-category>
<cs-tnm-size>any size</cs-tnm-size>
<cs-tnm-criteria>is invading the prevertebral fascia.</cs-tnm-criteria>
<cs-tnm-criteria>is encasing the<ul id="ul_nzk_yg2_tm">
<li>carotid artery, or</li>
<li>mediastinal vessels.</li>
</ul></cs-tnm-criteria>
<cs-tnm-criteria>is an anaplastic carcinoma with gross extrathyroid extension.</cs-tnm-criteria>
</cs-tnm-categories>
</cs-tnm-table>
I have already developed publishing stylesheets that can render this kind of table, calculating where a cell has to be spanned across rows and adding rows as necessary. (I will email you an example rendering of the table above.)

Do you think it is possible for me to add this kind of functionality to the oXygen Author editor?

Thanks,
Tim.
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Row spanning for simpletables

Post by Radu »

Hi Tim,
Each row must start with a category element, but can be followed by any number of subcategory, size, and criteria elements, in any order.
The short answer would unfortunately be no.
The Oxygen Author rendering page can only display elements in document order, so it would not be able to handle that extra in any order flexibility. Also it cannot create fake empty cell place holders to compensate for the missing cell elements.
Speaking in terms of XML content, what you have there is not a table, of course, you have enough power in the XSLT code to render it as such because you can create XSL:FO structure where it is missing + sort the cells in a certain order. But the CSS-based Oxygen Author visual editing mode does not have this flexibility.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tgrantham
Posts: 25
Joined: Thu Oct 27, 2011 8:03 pm

Re: Row spanning for simpletables

Post by tgrantham »

Thanks, Radu.

I see in your documentation topic "Configuring a Table Cell Span Provider" that I could extend the existing cell span provider to use a custom row span attribute. If we change the content model of our <simpletable> specialization to add a row span attribute to each cell element, is it possible to define a table provider that could automatically update the row span attribute value whenever the user added a new cell element, so that the user doesn't have to do it manually? oXygen already does something similar when the user drags a column separator: oXygen updates the values of the @relcolwidth attribute.

Thanks,
Tim.
tgrantham
Posts: 25
Joined: Thu Oct 27, 2011 8:03 pm

Re: Row spanning for simpletables

Post by tgrantham »

I just realized that a table provider that could update the values on a row spanning attribute would also have to insert the empty cells that get spanned.

Is this possible?

Thanks,
Tim.
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Row spanning for simpletables

Post by Radu »

Hi Tim,

How exactly would the user go around inserting a new cell? Did you define a custom action for this? Or is he using the content completion window to do this?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tgrantham
Posts: 25
Joined: Thu Oct 27, 2011 8:03 pm

Re: Row spanning for simpletables

Post by tgrantham »

The author typically uses a content completion window to insert the new cell element.
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Row spanning for simpletables

Post by Radu »

Hi Tim,

I don't think a table row/col span provider API can help with your use case.
If you create your own schema aware editing handler:

ro.sync.ecss.extensions.api.ExtensionsBundle.getAuthorSchemaAwareEditingHandler()

on the callback:

AuthorSchemaAwareEditingHandlerAdapter.handlePasteFragment(int, AuthorDocumentFragment[], int, AuthorAccess)

you should receive events also for the case in which the user has chosen to insert a cell using the content completion mechanism. In such cases you can perform your custom processing, maybe insert the cell and also look in the hierarchy of AuthorNode nodes to set certain attributes in other places.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tgrantham
Posts: 25
Joined: Thu Oct 27, 2011 8:03 pm

Re: Row spanning for simpletables

Post by tgrantham »

Thanks, Radu.

Tim.
Post Reply