epub validator "Duplicate ID" image error

I originally posted this problem in the Tech Support section here:

It seems like something that could do with fixing, so I thought I’d make a note of it in the bug section.

When trying to validate my epub file at validator.idpf.org/ I get the error messages for my images:

Error while parsing file ‘Duplicate ID ‘s1.png’’.

In the compiled html file I can see that each separator image is given the same attribute: “id=s1.png”, instead of being unique, which causes errors.

I am adding them within the text by using placeholders: <$IMG: /path/to/file/Images/s1.png;W=300>

I tried to update to 3.01 in the hope of fixing this, but it seems that the only change is that the file extension has been removed from the id, but I still get errors for duplicate id’s withing the same html file.

The 3.01 update also introduced an error in the Table of contents, whereby the title is now given a paragraph attribute, which also causes an error in the epub validator. But this appears to be a problem other users have come across with a workaround here: http://literatureandlatte.com/forum/viewtopic.php?p=255893#p255893

I am trying to get my epubs accepted on Smashwords Premium, but unfortunately they get rejected if they won’t validate.

The ToC issue is fixed for 3.0.2. Could you please send me a sample project showing the duplicate IDs issue? This works fine for me, so there must be something in the way it’s set up that is different.

Hi Keith,

thanks for your reply, and great to hear that the TOC issue has been fixed.

I’ve sent a project into Tech support with the files that are failing the validator.

I have been adding the same image multiple times, directly into the text using placeholders:


Perhaps that is causing problems?

Many thanks,

Thanks, Ian. Yes, it seems that adding the image using the <$img> tag when the image is part of the project works okay, but when the image is stored externally, images end up using the same ID. The fact that they use the same ID is intentional as it goes through MultiMarkdown first, but as this is causing problems for epub validation I have fixed this so that images use unique IDs no matter what in 3.0.2.

All the best,

That’s brilliant, thanks Keith!

Look forward to the update. :slight_smile: