Count of rows in a DITA table

ann.jensen
Posts: 230
Joined: Wed Jun 17, 2015 10:19 am

Count of rows in a DITA table

Post by ann.jensen » Tue Feb 13, 2018 3:30 pm

Hi,
Is there any way of identifying the number of rows in a DITA table through Oxygen XML Author?
Thanks in advance,
Ann

Radu
Posts: 6569
Joined: Fri Jul 09, 2004 5:18 pm

Re: Count of rows in a DITA table

Post by Radu » Tue Feb 13, 2018 3:48 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

ann.jensen
Posts: 230
Joined: Wed Jun 17, 2015 10:19 am

Re: Count of rows in a DITA table

Post by ann.jensen » Tue Feb 13, 2018 5:35 pm

Hi Radu,
That worked perfectly :-)
thanks again,
Ann

ann.jensen
Posts: 230
Joined: Wed Jun 17, 2015 10:19 am

Re: Count of rows in a DITA table

Post by ann.jensen » Tue Feb 13, 2018 7:13 pm

Is it possible to use something like CSS in Oxygen Author to automatically include this value in the DITA table title.
Regards,
Ann

Radu
Posts: 6569
Joined: Fri Jul 09, 2004 5:18 pm

Re: Count of rows in a DITA table

Post by Radu » Wed Feb 14, 2018 10:14 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

ann.jensen
Posts: 230
Joined: Wed Jun 17, 2015 10:19 am

Re: Count of rows in a DITA table

Post by ann.jensen » Thu Feb 15, 2018 1:59 pm

Thank you for making these things so doable :-)

Post Reply