The <tref> Element

The use of the <tref> element has many similarities to the way the <use> element works. The text to be inserted is created in a <text> element nested within the <defs> element toward the beginning of an SVG document. The referenced <text> element has an ID attribute that the referencing <tref> element makes use of by means of the xlink:href attribute.

In this simple example, copyright information is defined in a <text> element whose ID is CopyrightInfo. That element is then referenced by the <tref> element later in the SVG document.

Listing 4.14. (tref01.svg)
 <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/PR-SVG-20010719/ DTD/svg10.dtd"> <svg width="600" height="300"> ...

Get Designing SVG Web Graphics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.