Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • inkscape inkscape
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1,525
    • Issues 1,525
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 137
    • Merge requests 137
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Inkscape
  • inkscapeinkscape
  • Issues
  • #1757
Closed
Open
Created Dec 11, 2019 by Dion Moult@dionmoult

External `<use>` elements don't reference external elements correctly (only checks including document's defs)

Note: this is cross-posted from https://inkscape.org/forums/beyond/embedded-svg-does-not-display-markers/ - I have cross-posted it here because 1) this may be a bug in 0.92, and 2) when I try to open foo.svg in Inkscape 1.0 beta, Inkscape crashes (which is definitely a bug) Edit: crash fixed, bug in 0.92 still occurs in 1.0

It was also reported in https://bugs.launchpad.net/inkscape/+bug/1777984

Steps to replicate

  1. Open foo.svg in inkscape (contains a <use> that references the root element of bar.svg
  2. Compare to bar.svg in Inkscape (contains elements that have markers. These markers are defined in the <defs> of bar.svg)

What happened?

  • the marker don't display in foo.svg, but do when bar.svg is opened directly.

Generally, what is happening is that

  • If your document has a <use> element that references an element from a separate document, use directives or markers (basically just links) in that external document will not function properly (except for further external elements).
  • The links in the external document will match the original document instead (if there is a matching id)
  • Even if the xlink:hrefs in the external document refer to elements that are nested within the 'd entity, those will not function correctly.

What should have happened?

  • the marker should have displaced
  • more generally, <use> elements should deeply clone the contents of the referenced element (see https://www.w3.org/TR/SVG11/struct.html#UseElement). Thus links inside the referenced elements should still work.

Attachments

foo.svg and bar.svg from this case

and from the launchpad issue (shows example where the referenced document links to a gradient and a shape, rather than a marker)

snippet from file.svg

<use xlink:href="external.svg#use-me" />

snippet from external.svg

    <g id="use-me">
      <circle id="path815" cx="32" cy="32" r="24"
              style="fill:url(#linearGradient1758);fill-opacity:1" />
      <use xlink:href="#path815" transform="translate(64)"
           style="stroke:#800000" />
    </g>

and another minimal case from the comments below: ink-linker.svg

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg viewBox="0 0 50 50" height="50" width="50" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <use xlink:href="ink-linked.svg#root" />
</svg>

ink-linked.svg

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg id="root" viewBox="0 0 50 50" height="50" width="50" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <rect x="0" y="0" width="50" height="50" id="original_object" />
  <use xlink:href="#original_object" id="clone" fill="blue" />
</svg>

We expect the blue clone to be visible, as it is if we explicitly reference the document the reference is from for all links. So ink-linked.svg is changed to

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg id="root" viewBox="0 0 50 50" height="50" width="50" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <rect x="0" y="0" width="50" height="50" id="original_object" />
  <use xlink:href="ink-linked.svg#original_object" id="clone" fill="blue" />
</svg>

This doesn't work with markers afaik.

Version info

1.0beta and 0.92 and 0.92.2 2405546, 2018-03-11

Search terms: (launchpad, gitlab: inkscape/inkscape, gitlab: inkscape/inbox) "external reference" "external link" "reference file" "link file"

Edited Jul 30, 2020 by Nathan Lee
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking