Page 1 of 1

Alt text and KeyRefs

Posted: Sat Jul 15, 2017 1:58 am
by Stacey
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,

Re: Alt text and KeyRefs

Posted: Mon Jul 17, 2017 8:14 am
by Radu
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

Re: Alt text and KeyRefs

Posted: Tue Jul 18, 2017 12:07 am
by Stacey
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!)

Re: Alt text and KeyRefs

Posted: Tue Jul 18, 2017 8:29 am
by Radu
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