Adding alt text to images

<oXygen/> general issues.
lwolftw
Posts: 2
Joined: Tue Feb 23, 2021 12:37 am

Adding alt text to images

Post by lwolftw » Tue Feb 23, 2021 12:44 am

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?

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

Re: Adding alt text to images

Post by Radu » Tue Feb 23, 2021 8:18 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

lwolftw
Posts: 2
Joined: Tue Feb 23, 2021 12:37 am

Re: Adding alt text to images

Post by lwolftw » Tue Feb 23, 2021 5:50 pm

Hi Radu,

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

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

Re: Adding alt text to images

Post by Radu » Wed Feb 24, 2021 8:06 am

Hi,

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

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

Nikonov_94
Posts: 4
Joined: Wed Apr 28, 2021 10:51 am

Re: Adding alt text to images

Post by Nikonov_94 » Wed Apr 28, 2021 4:05 pm

"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.

sorin_carbunaru
Posts: 363
Joined: Mon May 09, 2016 9:37 am

Re: Adding alt text to images

Post by sorin_carbunaru » Thu Apr 29, 2021 10:58 am

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.

Nikonov_94
Posts: 4
Joined: Wed Apr 28, 2021 10:51 am

Re: Adding alt text to images

Post by Nikonov_94 » Thu Apr 29, 2021 1:18 pm

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:

Post Reply