Skip to content

href attributes without the xlink namespace are not recognised

Summary:

If an attribute is not properly namespaced, Inkscape will ignore it. Take this example: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/use

It's something I've had issues with for many years. I work a lot with SVG for web applications and often use Inkscape to generate PDF/PNG files on the server from files generated on the web. I always need to run over the SVG files and do some tweaks. Adding the xlink: prefix is the most common one.

Steps to reproduce:

Save the following SVG example to a file and open it in Inkscape:

<svg viewBox="0 0 30 10" xmlns="http://www.w3.org/2000/svg">
  <circle id="myCircle" cx="5" cy="5" r="4" stroke="blue" />
  <use href="#myCircle" x="10" fill="blue" />
  <use href="#myCircle" x="20" fill="white" stroke="red" />
</svg>

What happened?

The use elements should show, but they don't.

What should have happened?

The use elements should be rendered.

Version info

Inkscape 1.2.2 (b0a8486541, 2022-12-01)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information