xlink:href replaced by href in gradient defs

Bug #436569 reported by jazzynico on 2009-09-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Scour
Undecided
Unassigned

Bug Description

Tested on Ubuntu 9.04 and Windows XP, Scour rev. 146.
xlink:href attributes in gradient defs are replaced by href attributes in the optimized file.

Example from the attached file:
Original.
<linearGradient y2="0.91666669" x2="0.51618570" y1="0.16666391" x1="0.51618570" id="linearGradient1657" xlink:href="#linearGradient841"/>
Optimized
<linearGradient id="linearGradient1657" y2="0.91667" href="#linearGradient841" y1="0.16666" x2="0.51619" x1="0.51619"/>

I've tried each command line option (and combinations) with no success.

Strangely, Inkscape is not affected if I use Save As>Optimized SVG with the same Scour files as extension.
Really weird, isn't it?

jazzynico (jazzynico) wrote :
codedread (codedread) wrote :

Ok, I finally reduced the input file to the bare minimum to cause the problem. The issue seems to be because the actual SVG file is not valid - there are multiple gradients defined with the same ID.

<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="256pt" height="3170.0000pt">

  <defs>
    <linearGradient id="linearGradient841">
      <stop id="stop842" offset="0.00000000" style="stop-color:#0082ab;stop-opacity:1;"/>
      <stop id="stop843" offset="1" style="stop-color:white;stop-opacity:0;"/>
    </linearGradient>
    <linearGradient y2="0.91666669" x2="0.51618570" y1="0.16666391" x1="0.51618570" id="linearGradient1657" xlink:href="#linearGradient841"/>
  </defs>

  <rect height="69.247704" width="319.89233" fill="url(#linearGradient1657)"/>

  <defs>
    <linearGradient id="linearGradient841">
      <stop style="stop-color:#0082ab;stop-opacity:1;" offset="0.00000000" id="stop842"/>
      <stop style="stop-color:white;stop-opacity:0;" offset="1" id="stop843"/>
    </linearGradient>
    <linearGradient xlink:href="#linearGradient841" id="linearGradient2465" x1="76.846634" y1="-7656.4473" x2="76.846633" y2="-7528.6605" gradientTransform="matrix(2.149642,0.000000,0.000000,0.465194,-0.130153,3495.428)" gradientUnits="userSpaceOnUse"/>
  </defs>

  <rect fill="url(#linearGradient2465)" width="319.99103" height="69.247704"/>

</svg>

Note that these gradient elements are _identical_. This is probably an artifact from pulling it from DocBook XML?

I will continue to investigate this from the scour side and see if I can work around it. But if you remove the duplicate gradients I think the problem should go away.

codedread (codedread) wrote :

Even though it's invalid SVG, it's now fixed and committed in r147

Changed in scour:
status: New → Fix Committed
codedread (codedread) on 2009-09-28
Changed in scour:
status: Fix Committed → Fix Released
jazzynico (jazzynico) wrote :

Thanks! It works like a charm!
Now I have to find out were this invalid code comes from...

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers