Page 1 of 1

Count of rows in a DITA table

Posted: Tue Feb 13, 2018 3:30 pm
by ann.jensen
Hi,
Is there any way of identifying the number of rows in a DITA table through Oxygen XML Author?
Thanks in advance,
Ann

Re: Count of rows in a DITA table

Posted: Tue Feb 13, 2018 3:48 pm
by Radu
Hi Ann,

Maybe if the caret is inside the table, you could run an XPath using our XPath toolbar with something like:

Code: Select all

ancestor-or-self::table/count(.//row)
Regards,
Radu

Re: Count of rows in a DITA table

Posted: Tue Feb 13, 2018 5:35 pm
by ann.jensen
Hi Radu,
That worked perfectly :-)
thanks again,
Ann

Re: Count of rows in a DITA table

Posted: Tue Feb 13, 2018 7:13 pm
by ann.jensen
Is it possible to use something like CSS in Oxygen Author to automatically include this value in the DITA table title.
Regards,
Ann

Re: Count of rows in a DITA table

Posted: Wed Feb 14, 2018 10:14 am
by Radu
Hi Ann,

Sure, you need to use a CSS selector like:

Code: Select all

*[class~="topic/table"] > *[class~="topic/title"]:after{
content: " [Number of rows]:" oxy_xpath('ancestor::table/count(.//row)');
}
The oxy_xpath may induce editing performance problems though so please do not use it if you have very large topics.

More about using your custom editing CSS with DITA:

http://blog.oxygenxml.com/2016/10/custo ... iting.html

Regards,
Radu

Re: Count of rows in a DITA table

Posted: Thu Feb 15, 2018 1:59 pm
by ann.jensen
Thank you for making these things so doable :-)