Bypassing missing images without being visible in output

Questions about XML that are not covered by the other forums should go here.
John McGowan
Posts: 3
Joined: Wed Nov 02, 2016 4:54 pm

Bypassing missing images without being visible in output

Post by John McGowan »

Hi,

I am looking for a way to bypass images that are not in a referenced image directory.
I need to do this to streamline images when docs are translated externally or when the image is not applicable to a certain region or customer.
The issues is that I need to do this so that there is no visible hint in the DHTML output that the image is missing - as if in error.
Anyone know of a good way to do this, either in DITA itself or with JS?

Thanks.
xephon
Posts: 159
Joined: Mon Nov 24, 2014 1:49 pm
Location: Greven/Germany

Re: Bypassing missing images without being visible in output

Post by xephon »

Hi John,

maybe you could use a Schematron rule to check the href value and force the user by error message/quickfix to set the required filter attributes on that element. Would that help?

Greetings,
Stefan
stefan-jung.org – Your DITA/DITA-OT XML consultant
John McGowan
Posts: 3
Joined: Wed Nov 02, 2016 4:54 pm

Re: Bypassing missing images without being visible in output

Post by John McGowan »

Hi Stefan,

Maybe I wasn't clear.
I want to make it possible to bypass the link error, so that it is not visible in the output.
For example, if I have a doc with several flavors, and I only want to include the image in two flavors, but I want to have the link in all flavors, then I need to be able to do that without getting the ubiquitous red cross in the output when it couldn't locate the image.
Also, I do not want to do it with conditionals for all flavors and languages.
Tricky one, I know :)
alin
Site Admin
Posts: 275
Joined: Thu Dec 24, 2009 11:21 am

Re: Bypassing missing images without being visible in output

Post by alin »

Hello,

You can try to use the following JS code:

Code: Select all


$(".image").error(function(){
$(this).hide();
});

The procedure of inserting custom content into the output HTML files can be found at:
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
John McGowan
Posts: 3
Joined: Wed Nov 02, 2016 4:54 pm

Re: Bypassing missing images without being visible in output

Post by John McGowan »

Thanks Alin.
Can this be added directly into the processing instructions?
alin
Site Admin
Posts: 275
Joined: Thu Dec 24, 2009 11:21 am

Re: Bypassing missing images without being visible in output

Post by alin »

John McGowan wrote:Thanks Alin.
Can this be added directly into the processing instructions?
What do you mean by that? Can you give me an example?
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply