XML technologies / SVG / Creating graphic elements from templates / Solutions
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
The tag
<symbol>creates a symbol that serves as a template for creating elements. Symbols are rendered only when you create an element, or instance, from them. Groups, even when defined as invisible, are rendered immediately.In principle, symbols can also be stored in external files, as the SVG standard allows. Adobe SVG Viewer 2.0 does not yet support this, but you can test such references with Batik.
Stylesheets are defined in a
<style>tag inside a CDATA section. They begin with the applicable tag name, optionally followed by a period and a custom class name. The following listing defines two stylesheets for the<text>tag.
<style type="text/css">
<![CDATA[text {fill:black;font-size:12px} text.wichtig {fill:red;font-size:13px}]]>
</style>
Stylesheets without a custom class name apply automatically to all tags of that name. Others can be assigned through the
classattribute of the relevant tag. The following text, for example, receives the stylesheettext.wichtig:
<text x="10" y="20" class="wichtig">test</text>
Copyright © verlag moderne industrie GmbH 2001
You may print the online version for your private use.
Otherwise, this chapter from “Das Einsteigerseminar SVG — Webgrafiken mit XML” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
verlag moderne industrie GmbH, Justus-von-Liebig-Straße 1, D-86899 Landsberg/Lech, fon ++49 (0) 81 91 / 125 – 0, leserservice(at)mi-verlag.de
back to top