While running biblatex with \nocite commands, I got the following error message(s) when running epubcheck after tex4ebook.

ERROR(RSC-005): Testfile.epub/OEBPS/Testfileli3.html(19,88): Validierungsfehler: Der Wert des Attributs "id" ist ungültig; es muss ein XML-Name ohne Doppelpunkte sein

validation error: The value of attribute "id" is invalid; is has to be a XML-name without colon

The MWE would be the following, but it only reproduced the error 1 time. In my sourcefile.tex I got 175 \nocite commands and got 173 identical error messages with epubcheck.






Is there a fix for it? --> Yes, see Answer 1. It worked reducing the epubcheck error number from 123 to 20.

Update 1

I now have 20 errors left with epubcheck, which seem all related to the \pageref{somelabel} command. epubcheck gives ERROR(RSC-012) Fragmentbezeichner ist nicht angegeben and points to the following example in the html files (out of the 20):

(wie vorangehend, bei Andrej
Sacharow<a id='dx17-18004'></a> ab Seite <a href='#x11-12001r9'>249<!--  tex4ht:ref: AndrejSacharow   --></a>, gesehen und angedeutet)

and points to the page number "249". But this \pageref is located in ordinary body of text, without embedding in other command and env.

Up to now it was not possible to reproduce the epubcheck error in a MWE.

1 Answer 1


This issue should be fixed by make4ht DOM filters, but I found that this particular filter is broken. I've fixed that in make4ht sources, bur if you don't want to update it, you can use this build file instead:

local domfilter = require "make4ht-domfilter"

local allowed_chars = {
  ["-"] = true,
  ["."] = true
local function fix_colons(id)
  -- match every non alphanum character
  return id:gsub("[%W]", function(s)
    -- some characters are allowed, we don't need to replace them
    if allowed_chars[s] then return s end
    -- in other cases, replace with underscore
    return "_"

local function id_colons(obj)
  -- replace : characters in links and ids with unserscores
    local name = string.lower(obj:get_element_name(el))
    if name == "a" then
      local href = el:get_attribute("href")
      -- don't replace colons in external links
      if href and not href:match("[a-z]%://") then
        local base, id = href:match("(.*)%#(.*)")
        if base and id then
          id = fix_colons(id)
          el:set_attribute("href", base .. "#" .. id)
    local id  = el:get_attribute("id")
    if id then
      el:set_attribute("id", fix_colons(id))
  return obj

local process = domfilter {id_colons}

Make:match("html$", process)

Compile using:

I also found another issue, and that is a wrong formatting of DOI numbers. It can be fixed using this configuration file:


Compile using:

$ tex4ebook -e build.lua -c config.cfg filename.tex

This is the result:

enter image description here

  • Thank you Michal. I updated tex4ht right now and tried tex4ebook -a debug -c config.cfg -e build.lua Mysource.tex. It gets an epub file. But with epubcheck still 173 error messages of above sort appear. I think, as we had recently, I will and need to wait for another update in tlmgr update --list vor make4ht.
    – Thomkrates
    Apr 8 at 12:11
  • @Thomkrates the build file should replace all wrong characters in id, you shouldn't get errors now.
    – michal.h21
    Apr 8 at 12:25
  • Yes, with one of my sourcefile.tex it worked and I got a valid epub with epubcheck. - But with my other two projects I get the error message "error illegal storage address", and this can not be solved by changing the font (I tried 3 of them), which was some days ago a solution. I now do not get an epub with running tex4ebook -a debug -c Myconfig.cfg -e build.lua -m index Mysourcename.tex.
    – Thomkrates
    Apr 8 at 14:33
  • It seems to me as if this file -e build.lua from your answer, Michal, does not work when both biber and xindy is needed in the -e makefile.mk4. Since I get no epub output when using -e build.lua. But when running mymakefile.mk4 with biber and xindy in it an epub output is given, but then with error messages in epubcheck. So I think build.lua needs to be adjusted to this need. Without the need of both, epubcheck generated a valid epub file out of another sourcename.tex when using your -e build.lua file from above.
    – Thomkrates
    Apr 8 at 19:12
  • @Thomkrates yes, you will need to join build files, if you want to run also xindy and biber. I think you can just copy the older build file with instrucitons for Xindy and Biber at the end of this one.
    – michal.h21
    Apr 10 at 8:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .