XML technologies / SVG / Adding hyperlinks and external files / Solutions

(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)

  1. The empty SVG file could look as follows:

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg>
  <desc>Diese Datei enthält Symbole</desc>
</svg>

  1. The text containing the © character could be defined as follows:

<g>
  <text x="0" y="12">&#169; 2001 by Helma Spona</text>
</g>

  1. Create the hyperlink with the <a> tag, which must enclose the <text> tag.

<g>
  <a xlink:href="http://www.helma-spona.de">
    <text x="0" y="12" style="font-size:10px;fill:red;stroke:none">&#169; 2001 by Helma Spona</text>
  </a>
</g>

  1. Assuming you name the group in the file vorlagen.svg “cr”, the second file’s code could look as follows:

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg>
  <use transform="translate(10,30)" xlink:href="vorlagen.svg#cr"/>
</svg>

  1. To start Batik, extract the ZIP file into a directory of your choice if you have not already done so. Then double-click the file batik.jar. The window may take a few seconds to appear, so be patient. Then select File / Open File to open the file.

  2. The <image> tag for the graphic could look as follows:

<image width="64" height="49" xlink:href="mk.gif" /> 

  1. Again, define the hyperlink with the <a> tag, which encloses the <image> tag:

<a xlink:href="http://www.helma-spona.de">
  <image width="64" height="49" xlink:href="mk.gif" />
</a>

   

 

 

 

back to top