Does anybody know a way to use a SVG in a other SVG?
I know only this way:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox = "0 0 1000 1000" version = "1.1">
<defs>
<svg id="MySvg" width="5cm" height="5cm" version="1.1" xmlns="http://www.w3.org/2000/svg" testAttrib = "value on startup">
<g id="group2" fill="blue" >
<rect x="1cm" y="3cm" width="1cm" height="1cm" />
<rect x="3cm" y="3cm" width="1cm" height="1cm" />
</g>
</svg>
</defs>
<use x="10" y="100" xlink:href="#MySvg" testAttrib = "value after change"/>
</svg>
But this only works if the other svg is in the same file.
Normally the link must also works with:
Code: Select all
<use x="10" y="100" xlink:href="otherfile.svg#MySvg" testAttrib = "value after change"/>
But it does not work.
A other question is, how to define own attribute (e.g.: testAttrib) in the source-svg, redefine it in the use-svg and use/check it in the source-svg.
The way above in my code does not work.
Thanks for solutions and ideas