Search code examples
svgepubepub3

Epubcheck: "Error while parsing file 'element "animate" not allowed here..."


I get the following error from epubcheck 3.0.1 on a v3 epub,

Error while parsing file 'element "animate" not allowed here; expected the element end-tag or element "desc", "metadata" or "title"'.

with the following (heavily abridged for here) markup.

page0001.xhtml:

<?xml version="1.0"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
    <head>
        <title>Title</title>
    </head>
    <body>
        <div class="author-signature">
            <svg version="1.1" id="self-writing-author-signature" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1918.481px" height="277.577px" viewBox="0 281.535 1918.481 277.577" enable-background="new 0 281.535 1918.481 277.577" xml:space="preserve">
                <path id="sig-by" fill="none" stroke-dasharray="1057.016845703125,1057.016845703125" stroke="none" stroke-width="20" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M263.75,364.167c-7.011,19.632-21.317,39.133-42.25,45l-41.5,30c-3.824,20.125-25.998,31.36-16.174,54.457 c8.2,19.276,25.843,29.402,46.735,24.013c44.587-11.503,34.35-74.295,7.939-101.47l-4.25-45 c0.039,12.186,15.013,38.818,0.276,46.053c-10.267,5.041-27.781,27.543-40.072,18.511c-34.203-25.136-10.987-56.058-18.03-60.148 c-5.601-3.254-14.229-5.121-27.424-4.915l9.5,22.5c6.385,10.05-61.562,77.319-83.436,19.976c-11.739-30.774-5.86-78.666,22.21-98.09 c51.94-35.939,55.01,19.861,37.701,52.102C99.354,396.259,37.558,402.735,10,402.167">
                    <animate attributeName="stroke" from="none" to="#000000" begin="0" dur="100ms" fill="freeze"/>
                    <animate id="byAnim" attributeName="stroke-dashoffset" from="0" to="0" dur="1s" begin="0" fill="freeze" keySplines="0 0.5 0.5 1" calcMode="linear" values="-1057.016845703125;0"/>
                </path>
            </svg>
        </div>
    </body>
</html>

It's basically a fragment of an SVG animation that shows an author's signature writing itself.

From what I've read, and what I've tested with online SVG markup validation, the SVG is fine. It's OK to have animate elems as children of a path elem. I'm antsy about this because from what I've read, epubcheck is an acid test for getting published on digital stores, but I'm struggling to see a way around this error, other than bank on the grace of the digital stores to ignore this and stock it anyway.

Can anyone help with the above?


Solution

  • SVG animation elements are not allowed by EPUB 3, see:

    http://www.idpf.org/epub/301/spec/epub-contentdocs.html#sec-svg-restrictions