EPUBCheck HTM_061: invalid data-* attribute
Updated:
EPUBCheck HTM_061 is an error message: “"…" is not a valid custom data attribute (it must have at least one character after the hyphen, be XML-compatible, and not contain ASCII uppercase letters).” A data-* attribute name is not valid. A custom data attribute needs at least one character after the hyphen, no uppercase ASCII letters and only characters allowed in XML names.
The official message
"%1$s" is not a valid custom data attribute (it must have at least one character after the hyphen, be XML-compatible, and not contain ASCII uppercase letters).
- Default severity
- Error. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.
- EPUBCheck version
- 5.4.0
EPUBCheck prints this ID with an underscore instead of a hyphen; this page uses the ID exactly as EPUBCheck reports it.
%1$s, %2$s… are filled in with the file, value or element EPUBCheck found.
Typical causes
- Names such as data-, data-Page or data-x:y.
- Attributes generated from a script or a design tool that keeps camelCase names.
How to fix it
- Open the file EPUBCheck names (the message gives the path, line and column) in a text or EPUB editor such as Sigil, or unzip the EPUB and open it there.
- Rename the attribute in lowercase, for example data-page instead of data-Page.
- If a script or stylesheet reads the attribute, update it to the new name too.
- Remove the attribute if nothing in the book uses it.
- Rebuild the EPUB and run EPUBCheck again to confirm the message is gone.
When it's not this
If the attribute is prefixed with a namespace (such as ibooks:something), the rules are those of custom attributes, reported as HTM_054.
Terms used here
Other HTM messages
HTM_060bEPUB reading systems must ignore viewport meta elements in reflowable documents; viewport declaration "…" will be ignored.HTM_062SVG "xlink:href" attribute is deprecated; an "href" attribute should be used instead.HTM_059Viewport "…" property must not be defined more than once, but found values […].HTM_058HTML documents must be encoded in UTF-8, but UTF-16 was detected.HTM_057Viewport "…" value must be a positive number or the keyword "device-…"HTM_056Viewport metadata has no "…" dimension (both "width" and "height" properties are required)
Sources
Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.