[Wylug-help] Embedding SVG directly in XHTML (Viewing in Firefox 3)

Dave Fisher wylug-help at davefisher.co.uk
Fri Aug 8 14:31:00 BST 2008


On Fri, Aug 08, 2008 at 01:58:29PM +0100, Dave Fisher wrote:
> But I really want to put the SVG code directly into XHTML, to avoid
> unnecessary HTTP requests.

To answer my own question, the problem is that you need to jump through
a couple of hoops to make Firefox use its XML parser instead of the HTML one:

  1. Set file extension to .xhtml
  2. Make sure that the xmlns attribute is 100% compatible with the
     DOCTYPE declaration e.g.

     This DOCTYPE:

     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">

     Requires this xmlns:

     <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


     NOT

     <html xmlns="http://www.w3.org/TR/xhtml1" xml:lang="en" lang="en">

     Which is seems fine for other variations of an XHTML 1.0 DOCTYPE.


Decent documentation here:

   http://wiki.svg.org/index.php?title=Inline_SVG

Dave




More information about the Wylug-help mailing list