Alt text and KeyRefs

Stacey
Posts: 14
Joined: Tue Mar 14, 2017 12:36 am

Alt text and KeyRefs

Post by Stacey » Sat Jul 15, 2017 1:58 am

Hello:

I have my images defined as key refs so I can swap them out. I'm wondering if there's a way to define/tie the Alt text to the image key ref, or maybe the image file, so that when I swap the image out, the alt text matches the image that's used.

For example, if I have an image key ref for "new" and in one instance this is a plus sign and in another it's a sheet of paper, my alt text might reflect one or the other but not both.

Help.

Thanks,

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

Re: Alt text and KeyRefs

Post by Radu » Mon Jul 17, 2017 8:14 am

Hi Stacey,

I concur that would be quite nice if it would be possible. Unfortunately I do not think it is. If you want you can register and ask around on the Yahoo Groups DITA Users List.
Here's one possible workaround, imagine a single topic (which is referenced in the main DITA Map with a keydef:

Code: Select all

<keydef href="imagesRepository.dita" keys="imagesKey"/>
so it does not appear directly in the published output). That single topic contains a lot of images defined inside like:

Code: Select all


...............
<image id="imageID" href="../images/Chrysanthemums.jpg">
<alt>Alternate text</alt>
</image>
...........
From any other topic when you want to insert an image you insert a conkeyref to the image ID defined in this particular topic:

Code: Select all

<image conkeyref="imagesKey/imageID"/>
so if you want to switch you just change the image ID part to point to some other image.

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

Stacey
Posts: 14
Joined: Tue Mar 14, 2017 12:36 am

Re: Alt text and KeyRefs

Post by Stacey » Tue Jul 18, 2017 12:07 am

Okay, Radu. Thanks. :)

I had actually been doing that, but because of the way we're building things, it seems like image keys are preferred. Although I guess I could use image keys in the reuse content... except, I think that puts me back to my original spot, where changing out the image leaves the wrong alt text behind.

Luckily we're currently exporting largely to PDF, so it may not issue for a little while.

(Maybe you'll have some neat new feature by then!)

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

Re: Alt text and KeyRefs

Post by Radu » Tue Jul 18, 2017 8:29 am

Hi Stacey,

We cannot implement such an improvement on our side unless it becomes part of the DITA standard.
I wrote an email about your situation on the DITA technical committee's mailing list:

https://lists.oasis-open.org/archives/d ... 00000.html

Who knows, maybe a future version of the DITA standard will have provisions for this.

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

Post Reply