Suppressing conditional errors

Post here questions and problems related to editing and publishing DITA content.
bloodnok
Posts: 54
Joined: Mon Jun 27, 2011 10:51 pm

Suppressing conditional errors

Post by bloodnok »

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: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Suppressing conditional errors

Post by Radu »

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: 54
Joined: Mon Jun 27, 2011 10:51 pm

Re: Suppressing conditional errors

Post by bloodnok »

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: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Suppressing conditional errors

Post by Radu »

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: 54
Joined: Mon Jun 27, 2011 10:51 pm

Re: Suppressing conditional errors

Post by bloodnok »

What a fabulously simple solution!

Many thanks, Radu.
Post Reply