Alt text and KeyRefs

Stacey
Posts: 8

Alt text and KeyRefs

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

Re: Alt text and KeyRefs

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

Re: Alt text and KeyRefs

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

Re: Alt text and KeyRefs

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/dita-comment/201707/msg00000.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

Return to “DITA (Editing and Publishing DITA Content)”

Who is online

Users browsing this forum: No registered users and 1 guest