Page 1 of 1

Getting the currently applied profiling configuration programatically for use in Author Actions

Posted: Fri Dec 14, 2018 11:19 am
by Bruno.Ballarin
Hi,

when executing some Dita custom Author actions on a currently opened dita topic, is there a way to retrieve programmatically the profiling scheme that is currently applied on the opened Dita topic?

The rationale:

When selecting a pool of elements with an xpath to perform a custom operation, it seems that all the selected elements are affected by the operation, even the ones that are excluded under the currently applied profiling scheme.
For instance lets assume I am selecting with an Xpath all the rows in a table in order to apply a custom action. In the example below, 3 rows are selected, 2 of them with profiling attribute "GENERIC_A" and 1 with profiling attribute "GENERIC_B":

Code: Select all


                    <row  otherprops="GENERIC_A">
<entry >cell_content</entry>
<entry >cell_content</entry>
</row>
<row otherprops="GENERIC_A">
<entry >cell_content</entry>
<entry >cell_content</entry>
</row>
<row otherprops="GENERIC_B">
<entry >cell_content</entry>
<entry >cell_content</entry>
</row>
Now lets assume I am applying a profiling scheme on this topic with the following ditaval:

Code: Select all


    <prop att="otherprops" val="GENERIC_A" action="include"/>
<prop att="otherprops" val="GENERIC_B" action="exclude""/>
It results in having the first 2 rows rendered and the 3rd row hidden.

Now if I execute a custom operation on all selected rows, the action affects all 3 rows even if the 3rd row is hidden under the current profiling scheme.

If I would like to only affect the visible rows, I could statically select only the rows with otherprops="GENERIC_A">.

But what if I would like my custom operation to automatically detect the currently applied profiling scheme?
  • Is there a way to retrieve programmatically the "include" or "exclude" profiling configuration applied on an otherprops attribute for the currently opened topic?
  • If not, is there a way to programmatically retrieve the profiling from the ditaval if both the ditaval and the topic are associated in the same map?

Re: Getting the currently applied profiling configuration programatically for use in Author Actions

Posted: Fri Dec 14, 2018 11:39 am
by Radu
Hi Bruno,

Maybe you could try to use something like this:

authorAccess.getEditorAccess().getStyles(node).isFilteredOut()

on each node that you want to process.

Regards,
Radu

Re: Getting the currently applied profiling configuration programatically for use in Author Actions

Posted: Mon Dec 17, 2018 7:42 pm
by Bruno.Ballarin
Perfect, thank you.

Code: Select all


  InRow = authorAccess.getDocumentController().findNodesByXPath("/topic/abstract/table/tgroup/tbody/row", true, true, true);
for(i = 0; i < InRow.length; i++){
if (!authorAccess.getEditorAccess().getStyles(InRow[i]).isFilteredOut()) {
// my processing here (applied to only the rows that are not excluded by my profiling configuration)
}
}
Bruno