XML technologies / SVG / Adding hyperlinks and external files / Using external files correctly / The switch tag
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
External files or SVG tags and attributes unsupported by some browsers or plug-ins present a problem: code works correctly only when all requirements are met. Unsupported features may impair the image’s quality.
SVG’s <switch> tag can prevent a graphic, group or element from displaying when requirements are unmet. Define the conditions with its attributes and place the affected elements inside it.
All attributes work alike. Assign a single required feature or a list. The plug-in or browser checks that each feature or extension is available. Only if all are available does the attribute evaluate to the Boolean value (true). When all attributes evaluate to true, the contents of the <switch> tag are executed and rendered.
The tag supports these attributes:
requiredFeaturesspecifies required SVG features. Possible values areorg.w3c.svg,org.w3c.svg.dynamic,org.w3c.svg.static,org.w3c.dom.svg.static,org.w3c.svg.animation,org.w3c.dom.svg.animation,org.w3c.svg.dynamic,org.w3c.svg.allandorg.w3c.dom.svg.all. Their meanings appear in the table. Separate multiple values with spaces.requiredExtensionsspecifies required language extensions as one or more URLs. Valid values depend on the extension. None currently exist, so this attribute is not yet needed.systemLanguagespecifies the required system language. Provide graphic text in several languages and display the one matching the operating system to create multilingual graphics easily. Separate multiple languages with commas. Language codes are not yet standardized or defined.
Note:
Adobe SVG Viewer currently supports only the attribute requiredExtensions, so the others have no practical role yet.
The table explains values for the attribute requiredFeatures.
Table: Values for the attribute requiredFeatures of the <switch> tag.
Value | Meaning |
|---|---|
| Requires support for at least one feature, |
| Requires correct execution of all static SVG elements, including paths, rectangles, circles, groups and filters. |
| Requires all SVG elements defined by |
| Requires, in addition to the static elements defined by |
| Requires all SVG elements defined by |
| Requires, in addition to features defined by |
| Requires support for all SVG specification attributes and tags. |
| Requires support for all SVG specification attributes and tags, accessible to scripts through the DOM. |
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