-
Notifications
You must be signed in to change notification settings - Fork 63
Description
This is an issue that will probably disappear by itself when moving to SVG 2. I think that it can still be useful to document it in the meantime.
From what I understand, in SVG 1.1, one should use xlink:href for the <use> tag, but in SVG 2, it has been replaced by href. Some people ( https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/href ) argue that one could use both just in case, but I feel that this solution would not be in the spirit of TyXML (as such a document would not strictly follow neither SVG 1.1 nor SVG 2).
Currently in TyXML, there are two functions a_href and a_xlink_href. The a_xlink_href function produces xlink:href and is marked as depreciated, whilst a_href produces href.
The issue is that the doctype that TyXML produces indicates SVG 1.1:
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">The link http://www.w3.org/2000/svg seems to be mutable (so I guess that it currently means SVG 2?).
If I open such an SVG file with Inkscape, by default (there might be an option to change this behaviour), the <use href> are simply ignored, which is frustrating.
In order to generated SVG files that can be opened in Inkscape, I have to use a_xlink_href instead of a_href. In practise I just do the following to just use a_href without thinking too much about it:
let module Svg = struct
include Svg
let a_href = a_xlink_href
endThe generated files are then understood by Inkscape. (And I get warning messages about a_xlink_href being depreciated.)
In Tyxml_js, there is no generated doctype when adding the SVG within the DOM using Html.svg, so Firefox assumes that we are in SVG 2 and xlink:href won't be recognised: for the <use> tags to work, I need to use href instead.
It's a bit frustrating. Now that I understand the issue, I can work around this, but it took me some time. This issue will solve itself when TyXML will follow SVG 2, but I feel that a_xlink_href shouldn't be marked as depreciated in the meantime.