Page 1 of 1

Adding alt text to images

Posted: Tue Feb 23, 2021 12:44 am
by lwolftw
Hi all,

We are using OxygenXML to create HTML files for our doc. Right now, we are looking into adding alt text to our images. We were hoping that if we add metadata to our images and then link to it in our HTML file, the metadata will be pulled in as an alt text. Is this even possible? If not, is there an alternative?

Re: Adding alt text to images

Posted: Tue Feb 23, 2021 8:18 am
by Radu
Hi,

Oxygen has predefined support for the DocBook, TEI, DITA vocabularies. What type of XML documents are you working with?
How are you publishing XML to HTML using our application? Are you using custom publishing XSLT stylesheets?
From what I know the alternate text needs to be specified in the output HTML document by setting the alt attribute on the img element. Or maybe you can use some Javascript code to post process the HTML document when it gets loaded in a web browser and somehow dynamically set the "alt" attributes on the "img" elements.

Regards,
Radu

Re: Adding alt text to images

Posted: Tue Feb 23, 2021 5:50 pm
by lwolftw
Hi Radu,

Thanks for answering! We create an HTML file from the get-go and not convert it from XML.

Re: Adding alt text to images

Posted: Wed Feb 24, 2021 8:06 am
by Radu
Hi,

I'm afraid I do not know what "get-go" is or how to help further.

Regards,
Radu

Re: Adding alt text to images

Posted: Wed Apr 28, 2021 4:05 pm
by Nikonov_94
"From the get-go" means "from the beginning", it means that lwolftv works directly on a HTML file, and not on an XML one that's later converted to HTML.

Re: Adding alt text to images

Posted: Thu Apr 29, 2021 10:58 am
by sorin_carbunaru
OK... So, let me see if I understand... The metadata is embedded in the image file itself and the scenario is to extract it from the image and add it to the "alt" attribute in HTML. Is that correct?

If that's correct, then I think https://commons.apache.org/proper/commons-imaging/ may be helpful to you. You could write an Oxygen plug-in that uses this library. You can read more about Oxygen plug-ins at https://www.oxygenxml.com/doc/versions/ ... ugins.html.

Re: Adding alt text to images

Posted: Thu Apr 29, 2021 1:18 pm
by Nikonov_94
I don't know if it's the situation lwolftw is in, but my problem was solved by your answer, thanks, I managed to use the plug-in successfully! I'm an absolute novice, so even this feels like an awesome victory :lol: