Sigil-Ebook / flightcrew

Automatically exported from code.google.com/p/flightcrew
GNU General Public License v3.0
34 stars 11 forks source link

SVG not allowed in XHTML? #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Validate the epub here: http://djelibeibi.unex.es/files/test.epub

If I understand the spec correctly, it should be a valid ePUB. Instead, I get 
an error:

test.epub/OEBPS/Portada.xhtml(50): error 301: element 'svg' is not allowed for 
content model 
'(p|h1|h2|h3|h4|h5|h6|div|ul|ol|dl|pre|hr|blockquote|address|fieldset|table|swit
ch|form|noscript|ins|del|script)'

According to section 1.4.1.1:

"A document is considered an OPS Content Document if [...] it uses a 
combination of the XHTML subset defined in this document and OPS-specific 
content extensions such as Inline XML Islands and Inline SVG"

See also this discussion: 
http://www.daisy.org/epub/issues/clarify-which-external-dtds-are-allowed-epub

So, either I don't understand the spec (which is true, anyway), or FlightCrew 
is being too strict?

Original issue reported on code.google.com by jel...@gmail.com on 3 Oct 2010 at 9:13

GoogleCodeExporter commented 9 years ago
I knew I would get this report, and I was pretty sure it would come from you 
since I got this error on the books you made that I used while testing. :)

The error is sound, it's just that the <svg> element is not allowed to be a 
direct child of the <body>. See the OPS spec, section 2.5: 
http://www.idpf.org/doc_library/epub/OPS_2.0.1_draft.htm#Section2.5.3

"svg elements may be used anywhere XHTML img elements could be used"

and similar text can be found throughout the spec. Bottom line, <svg> can go 
where <img> can go, and <img> is not allowed to be a child of the <body>.

So just wrap it in a <div>.

Original comment by Strahinja.Markovic@gmail.com on 3 Oct 2010 at 9:46

GoogleCodeExporter commented 9 years ago
I see...

Just a question, do you use the NVDL definition in Appendix A (can it be used 
at all?)?

Original comment by jel...@gmail.com on 3 Oct 2010 at 10:06

GoogleCodeExporter commented 9 years ago
Issue 4 has been merged into this issue.

Original comment by Strahinja.Markovic@gmail.com on 3 Oct 2010 at 11:18

GoogleCodeExporter commented 9 years ago
No, I wrote a custom XML Schema. As I've said, just wrap the <svg> in a <div>.

The NVDL schema does not perform structural validation for SVG, it just 
"routes" validation of SVG to the SVG RNG schema.

Original comment by Strahinja.Markovic@gmail.com on 3 Oct 2010 at 11:23

GoogleCodeExporter commented 9 years ago

Original comment by Strahinja.Markovic@gmail.com on 3 Oct 2010 at 11:23