Suppressing conditional errors

bloodnok
Posts: 53
Joined: Mon Jun 27, 2011 10:51 pm

Suppressing conditional errors

Post by bloodnok » Thu May 28, 2020 8:33 pm

I get the following error during transformation

Code: Select all

[DOTX010E][ERROR]: Unable to find target for conref="#variables/llAirgap".
There's an understandable if annoying reason for the toolkit to throw the error: the variable it's complaining about is conditional and was excluded in this particular transform scenario.

Problem I'm trying to solve is how to suppress this specific error so that I can more easily see other unexpected errors. Because of where this variable exists, these error messages pollute my logs, making it really difficult to find the unexpected.

This has been a long-standing nit in DITA conditional processing: it throws an error about not being able to find an element that was deliberately excluded.

Any workaround for this nit is very welcome.

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

Re: Suppressing conditional errors

Post by Radu » Fri May 29, 2020 7:07 am

Hi,

Can you give me more details about how the actual DITA code looks like?
Do you have something like:

Code: Select all

<ph conref="..." audience="novice"/>
and you exclude "novice" audience using the filter, but still obtain the problem?
Or do you exclude only the target of the conref but not the source of the conref?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

bloodnok
Posts: 53
Joined: Mon Jun 27, 2011 10:51 pm

Re: Suppressing conditional errors

Post by bloodnok » Fri May 29, 2020 11:19 pm

Fairly certain my scenario is like your first example. I've a variables.dita file with this entry:

Code: Select all

<ph id="llAirgap" props="AirGap">Air Gap </ph>
Other entries embed the above, for example:

Code: Select all

<ph id="llAnalyst"><ph conref="#variables/llAirgap"/>Analyst</ph>
The ditaval for the transform says:

Code: Select all

<prop action="exclude" att="props" val="AirGap"/>

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

Re: Suppressing conditional errors

Post by Radu » Sun May 31, 2020 7:48 am

Hi,

If you want to avoid seeing the error the filter attribute should go also on the attribute which has the conref:

Code: Select all

<ph conref="#variables/llAirgap" props="AirGap"/>
otherwise when the target element is filtered out, the conref can no longer be resolved and thus the error is reported. The error should not be a fatal one.
A trick might be to do this:

Code: Select all

<ph id="llAirgap"><ph props="AirGap">Air Gap </ph></ph>
in order to avoid removing the entire target element, but remove only its contents.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

bloodnok
Posts: 53
Joined: Mon Jun 27, 2011 10:51 pm

Re: Suppressing conditional errors

Post by bloodnok » Wed Jun 03, 2020 5:03 am

What a fabulously simple solution!

Many thanks, Radu.

Post Reply