1 Reply Latest reply: Nov 22, 2012 9:28 AM by dgatwood42 RSS

    SVG Support and <switch>

    dgatwood42

      I'm trying to use SVG to render a fixed-layout page containing islands of HTML content (for wrapping reason).  The content works correctly in browsers, but ADE 2.0 chokes on it completely.  It looks like it isn't handling the <switch> tag correctly.  More precisely, it is throwing away everything inside it.  Even if I remove the <foreignObject> tags entirely, it fails to render the <text> tags inside them.

       

      Am I missing something subtle?  Does anybody know a workaround?  What's the best way of ensuring that the development team actually finds out about this bug and fixes it?

       

      <?xml version="1.0" encoding="utf-8"?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

       

       

      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">

      <head>

      <title>Early Colonial Life</title>

      <link rel="stylesheet" type="text/css" href="nookstyles.css" />

      <link rel="stylesheet" type="text/css" href="nookstyles2.css" />

      </head>

      <body>

      <div class="partpage">

      <svg width="6in" height="9in" baseProfile="tiny" viewBox="0 0 4320 6480" preserveAspectRatio="xMidYMid">

        <g transform="scale(10)">

      <g fill="none" stroke="green" stroke-width="1"><line x1="0" y1="0" x2="431" y2="0" /><line x1="431" y1="0" x2="431" y2="647" /><line x1="431" y1="647" x2="0" y2="647" /><line x1="0" y1="647" x2="0" y2="0" /></g>

          <switch>

              <foreignObject x="0" y="148" width="432" height="300" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" requiredExtensions="http://www.w3.org/1999/xhtml">

                  <div class="pp_partnum" xmlns="http://www.w3.org/1999/xhtml">Part I:</div>

              </foreignObject>

              <text x="216" y="148" text-anchor="middle" >Part I:</text>

          </switch>

          <switch>

              <foreignObject x="0" y="200" width="432" height="300" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" requiredExtensions="http://www.w3.org/1999/xhtml">

                  <div class="pp_title" xmlns="http://www.w3.org/1999/xhtml">Early Colonial Life</div>

              </foreignObject>

              <text x="216" y="200" text-anchor="middle" >Early Colonial Life</text>

          </switch>

          <switch>

              <foreignObject x="0" y="538" width="432" height="140" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" requiredExtensions="http://www.w3.org/1999/xhtml">

                  <div class="pp_subtitle" xmlns="http://www.w3.org/1999/xhtml">Spring, 2304</div>

              </foreignObject>

              <text x="216" y="538" text-anchor="middle" >Spring, 2304</text>

          </switch>

        </g>

      </svg>

      </div>

      </body>

      </html>

        • 1. Re: SVG Support and <switch>
          dgatwood42 Community Member

          Adding further fun, if I remove the switch tags and add an HTML <body>  tag, ADE renders the content.  However, either of these changes causes the EPUB file to fail epubcheck validation (which is a bug in epubcheck—added a follow-up comment to issue 166), and neither workaround should be needed.

           

          So I have a workaround, but not a workaround I can actually do anything with until the bug in epubcheck gets fixed, because no reseller will accept books that fail to pass epubcheck validation.  Grr.

           

          Either way, unless I'm missing something fairly significant conceptually, this is a serious bug in ADE that needs to be fixed.