Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firefox不显示use元素+xlink:href属性引用的路径_Firefox_Svg_Href_Xlink - Fatal编程技术网

Firefox不显示use元素+xlink:href属性引用的路径

Firefox不显示use元素+xlink:href属性引用的路径,firefox,svg,href,xlink,Firefox,Svg,Href,Xlink,我在paths.svg文件中定义了一些路径元素,请以原始文本打开。 当我使用inkscape打开下面代码中显示的file.svg时,这一点很好,但不使用firefox。在Mirage中也没有显示引用的路径: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"

我在paths.svg文件中定义了一些路径元素,请以原始文本打开。 当我使用inkscape打开下面代码中显示的file.svg时,这一点很好,但不使用firefox。在Mirage中也没有显示引用的路径:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="100" width="100">
  <use xlink:href="./glyph-paths.svg#117"
       transform="scale(0.01, 0.01) translate(200, 500)"/>
</svg>
然后,我使用use元素从同一目录中的另一个文件rests.2调用,因此没有服务器等,但我想知道的是,不仅在FireFox中没有显示路径,而且在GIMP和Geeqie上也有相同的行为。实际上,只有Inkscape通过xlink:href:


Inkscape不支持href属性,只支持不推荐使用的xlink:href。所以不是你,只是Inkscape

当我在Inkscape中创建元素时,我手动创建一个href属性来匹配xlink:href,因为使用JavaScript操作href比使用xl更容易;墨水:href


是否将xlink:href保留在最终文件中取决于您,以及是否需要将该文件重新放入Inkscape。

Firefox的安全模型不允许一个本地文件引用另一个本地文件。这是由于一个错误。无论您使用href还是xlink:href,这都是正确的


如果您使用Web服务器通过http或https为文件提供服务,您会发现这样的远程引用在Firefox中是有效的。

但是,为什么在其他svg查看器(如Gimp等)中也没有显示被引用的路径呢。?到目前为止,它只能在Inkscape中显示。此外,在尝试将结果转换为PDF时,没有其他转换器(包括一些联机转换器)可以转换使用的路径。如果我将xlink:href更改为href,也没有任何区别。我不明白为什么这些评论与您的问题相关,即与本地文件一起使用在Firefox上有问题。问题是Firefox安全模型不允许这样做。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
 <path transform="translate(0 0) scale(1 -1)" id="rests.2" d="M80 398c50 -68 90 -118 143 -184c6.22621 -7.92426 9.24864 -16.1689 9.24864 -24.7339c0 -6.56702 -1.77679 -13.3224 -5.24864 -20.2661c-19 -36 -40 -50 -69 -79c-10.4374 -10.8389 -14.9122 -26.0289 -14.9122 -42.9176 c0 -25.1817 9.94817 -54.1399 24.9122 -78.0824c40 -63 65 -107 104 -160c2.19052 -2.98708 3.11205 -6.05347 3.11205 -8.94647c0 -8.00267 -7.0515 -14.6785 -13.7996 -14.6785c-3.0625 0 -6.0625 1.375 -8.3125 4.625 c-18.7932 27.2501 -46.4159 62.4468 -87.0167 62.4468c-2.60722 0 -5.26795 -0.14514 -7.9833 -0.446846c-37.3002 -3.82566 -78.2594 -24.1165 -78.2594 -59.1228c0 -34.3572 13.2203 -53.8112 29.2594 -80.8772c1.90983 -3.24671 2.72542 -6.16515 2.72542 -8.67173 c0 -6.11404 -4.85254 -9.77763 -10.5138 -9.77763c-4.17048 0 -8.77986 1.98813 -12.2116 6.44936c-49 63 -97 106 -104 176c-0.304 2.7968 -0.452741 5.54555 -0.452741 8.24286c0 41.6664 35.4927 71.0611 82.4527 75.7571 c3.25176 0.309691 6.33568 0.451543 9.24434 0.451543c15.8756 0 26.5299 -4.22577 30.7557 -8.45154c6.0717 -5.31274 12.2874 -7.31334 17.2809 -7.31334c6.07303 0 10.3383 2.95907 10.3383 6.51795c0 1.22609 -0.506256 2.52338 -1.61926 3.79539 c-40 43 -69 91 -113 127c-9.72408 8.00806 -15.5219 22.5599 -15.5219 37.1052c0 10.8833 3.24596 21.7629 10.5219 29.8948c22 24 57 47 79 66c16.7435 14.9495 23.8322 33.1173 23.8322 52.5788c0 13.0839 -3.20398 26.7525 -8.83224 40.4212c-12 30 -23 48 -41 80 c-8 14 5 20 12 10z"/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="210.00000mm" height="297.00000mm">

  <use xlink:href="haydn.svg#rests.2"
       transform="translate(200 200)
          scale(0.1)"/>
</svg>