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

Bypassing missing images without being visible in output

Wed Nov 02, 2016 5:40 pm

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: 96
Location: Münster/Germany

Re: Bypassing missing images without being visible in output

Wed Nov 02, 2016 6:37 pm

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
Join the DOCTALES DITA development team :arrow: https://doctales.atlassian.net/wiki
John McGowan
Posts: 3

Re: Bypassing missing images without being visible in output

Wed Nov 02, 2016 7:47 pm

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: 120

Re: Bypassing missing images without being visible in output

Thu Nov 03, 2016 5:48 pm

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

Re: Bypassing missing images without being visible in output

Fri Nov 04, 2016 1:21 pm

Thanks Alin.
Can this be added directly into the processing instructions?
alin
Site Admin
Posts: 120

Re: Bypassing missing images without being visible in output

Fri Nov 04, 2016 2:40 pm

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

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 0 guests