Apply formatting to first column of table based on "otherprops" attribute value

paulkhillier
Posts: 13
Joined: Wed Jun 27, 2018 12:44 am

Apply formatting to first column of table based on "otherprops" attribute value

Post by paulkhillier » Tue Jul 31, 2018 12:05 am

Hello Oxygen Users and Team,

I am trying to apply formatting to the first column of a two-column table that describes "Report Properties" using the "DITA Map PDF - based on DITA & CSS (WYSIWYG)" transformation scenario.

In our current output solution (TopLeaf), the formatting is applied IF the <table> "otherprops" attribute has a value of "cheader". In order to support Legacy documentation with Oxygen I need to maintain this method and apply the same formatting as <thead> to the first column of a <table> when "otherprops=cheader" only.

Table Header Row Formatting

Code: Select all

*[class~="topic/thead"] {
font-family: "Segoe UI", Arial, sans-serif;
color: white;
font-size: 0.9em;
background-color: #6aade4;
font-weight:bold;
margin-top: 1em;
text-align: left;
}

Sample Code for Report Properties Table

Code: Select all

		<table id="table_26CBA0303BC74D48A2059FDB335D71D1" [b]otherprops="cheader"[/b]> 
<title>Report Properties</title>
<tgroup cols="2"><colspec colnum="1" colname="col1"
colwidth="1.85in"/><colspec colnum="2" colname="col2" colwidth="5in"/>
<tbody>
<row>
<entry colname="col1">
<p>Report System Name
</p>
</entry>
<entry colname="col2">
<p>Redacted
</p>
</entry>
</row>
<row>
<entry colname="col1">
<p>Report Business Name
</p>
</entry>
<entry colname="col2">
<p> Redacted
</entry>
</row>
<row>
<entry colname="col1">
<p>Report Control Name
</p>
</entry>
<entry colname="col2">
<p>RBCEFT0.P
</p>
</entry>
</row>
<row>
<entry colname="col1">
<p>Type
</p>
</entry>
<entry colname="col2">
<p>Scheduler
</p>
</entry>
</row>
<row>
<entry colname="col1">
<p>Sort Order
</p>
</entry>
<entry colname="col2">
<p>N/A
</p>
</entry>
</row>
<row>
<entry colname="col1">
<p>Format
</p>
</entry>
<entry colname="col2">
<p>XML
</p>
</entry>
</row>
<row>
<entry colname="col1">
<p>Output File Name
</p>
</entry>
<entry colname="col2">
<p>WIREFILE.REDCDN
</p>
</entry>
</row>
<row>
<entry colname="col1">
<p>Output Directory
</p>
</entry>
<entry colname="col2">
<p> Interface
</p>
</entry>
</row>
</tbody>
</tgroup>
</table>
]

What would be a suggested method to effectively implement this solution?

With regards,

Paul HIllier

Dan
Posts: 397
Joined: Mon Feb 03, 2003 10:56 am

Re: Apply formatting to first column of table based on "otherprops" attribute value

Post by Dan » Tue Jul 31, 2018 4:22 pm

Hello Paul,

Fist you should use instead of "otherprops" attribute the "outputclass" attribute. The "otherprops" attribute is filetered out during the processing of the merged map. You can use the oXygen refactoring actions to make this change (or a simple find/replace in files across the project).
I have recorded an issue to leave the profiling attributes in place into the intermediate merged map.

After that you should try to match the first entry from the table rows. Like:

Code: Select all



*[class~="topic/table"][outputclass="cheader"] >
*[class~="topic/tgroup"] >
*[class~="topic/tbody"] >
*[class~="topic/row"] >
*[class~="topic/entry"]:first-child{
font-family: "Segoe UI", Arial, sans-serif;
color: white;
font-size: 0.9em;
background-color: #6aade4;
font-weight:bold;
margin-top: 1em;
text-align: left;
}

Thank you for your feedback,
Many regards,

Dan

paulkhillier
Posts: 13
Joined: Wed Jun 27, 2018 12:44 am

Re: Apply formatting to first column of table based on "otherprops" attribute value

Post by paulkhillier » Tue Jul 31, 2018 6:01 pm

Hi Dan,

I am working with 100s of legacy topics (reports) that use "otherprops". Is there another, less elegant method I can use to style output based on this attribute?

Regards,

Paul H

Costin
Posts: 591
Joined: Mon Dec 05, 2011 6:04 pm

Re: Apply formatting to first column of table based on "otherprops" attribute value

Post by Costin » Tue Jul 31, 2018 6:03 pm

Hello,

Unfortunately not, as, like Dan said, the attribute is filtered at transformation time by the engine.

The only workaround is to set an outputclass attribute like advised.

Best Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

paulkhillier
Posts: 13
Joined: Wed Jun 27, 2018 12:44 am

Re: Apply formatting to first column of table based on "otherprops" attribute value

Post by paulkhillier » Tue Jul 31, 2018 6:36 pm

Hi Costin and Dan,

Understood and thanks for your help. I am reviewing the XML Refactoring Tool dialog box and options and I am not clear on how to achieve what would be the ideal result, which is to add a new attribute to tables containing otherprops="cheader", such as outputclass="columnheader". Can you please refer me to the best resource for this tool?

Regards,

Paul Hillier

paulkhillier
Posts: 13
Joined: Wed Jun 27, 2018 12:44 am

Re: Apply formatting to first column of table based on "otherprops" attribute value

Post by paulkhillier » Tue Jul 31, 2018 8:21 pm

Hi Oxygen Team,

I think I figured it out and am posting my solution for the forum...the key is to specify "table" as the element, as otherprops is used in multiple elements across our documentation set.

1. Menu > XML Refactoring > Rename Attribute
2. For Element, specify table.
3. For Output, specify otherprops.
4. For New Local Name, specify outputclass.
5. Click Next.
6. Select Working Sets.
7. Click Choose.
8. Click New Working Set.
9. Specify a name for the Working Set (for example, Reports).
10. Click Add Resources > Folders...
11. Select folder(s) to include in the XML Refactoring process.
12. Click OK.
13. Click Preview.
Resources are analyzed and the Preview window is displayed once completed.
14. In the Changes To Be Performed area, review the identfied files.
15. Click Finish.

With Regards,

Paul Hillier

mdslup
Posts: 116
Joined: Tue Mar 06, 2018 1:34 am

Re: Apply formatting to first column of table based on "otherprops" attribute value

Post by mdslup » Wed Aug 01, 2018 2:06 am

Would a find and replace of some kind not work?

You could do a simple find and replace across all your legacy files:

FIND: otherprops=cheader
REPLACE: outputclass=cheader

Alternatively, you could do some kind of xpath, xquery, xslt hacking to change all your source files.

Post Reply