SVG Tiny 1.2 – 20081222

14 Linking

Contents

14.1 References

14.1.1 Overview

On the Internet, resources are identified using IRIs (Internationalized Resource Identifiers). For example, an SVG file called someDrawing.svg located at http://example.com might have the following IRI:

http://example.com/someDrawing.svg

An IRI can also address a particular element within an XML document by including an IRI fragment identifier as part of the IRI. An IRI which includes an IRI fragment identifier consists of an optional base IRI, followed by a "#" character, followed by the IRI fragment identifier. For example, the following IRI can be used to specify the element whose ID is "Lamppost" within file someDrawing.svg:

http://example.com/someDrawing.svg#Lamppost

Altering the 'xlink:href' attribute

If the 'xlink:href' attribute of an element in the tree is altered by any means (e.g. script, declarative animation) such that a new resource is referenced, the new resource must replace the existing resource, and must be rendered as appropriate. For specific effects on the scripting context when a 'script' element's 'xlink:href' attribute is altered, see Script processing.

14.1.2 IRIs and URIs

Internationalized Resource Identifiers (IRIs) are a more generalized complement to Uniform Resource Identifiers (URIs). An IRI is a sequence of characters from the Universal Character Set [UNICODE]. A URI is constructed from a much more restricted set of characters. All URIs are already conformant IRIs. A mapping from IRIs to URIs is defined by the IRI specification, which means that IRIs can be used instead of URIs in XML documents, to identify resources. IRIs can be converted to URIs for resolution on a network, if the protocol does not support IRIs directly.

Previous versions of SVG, following XLink, defined a IRI reference type as a URI or as a sequence of characters which must result in a URI reference after a particular escaping procedure was applied. The escaping procedure was repeated in the XLink 1.0 specification [XLINK10], and in the W3C XML Schema Part 2: Datatypes specification [SCHEMA2]. This copying introduced the possibility of error and divergence, but was done because the IRI specification was not yet standardized.

In this specification, the correct term IRI is used for this "URI or sequence of characters plus an algorithm" and the escaping method, which turns IRIs into URIs, is defined by reference to the IRI specification [RFC3987], which has since become an IETF Proposed Standard. Other W3C specifications are expected to be revised over time to remove these duplicate descriptions of the escaping procedure and to refer to IRI directly.

14.1.3 Syntactic forms: IRI and FuncIRI

IRIs are used in the 'xlink:href' attribute. Some attributes allow both IRIs and text strings as content. To disambiguate a text string from a relative IRI, the functional notation <FuncIRI> is used. This is simply an IRI delimited with a functional notation. Note: For historical reasons, the delimiters are "url(" and ")", for compatibility with the CSS specifications. The FuncIRI form is used in presentation attributes and navigation attributes.

SVG makes extensive use of IRI references, both absolute and relative, to other objects. For example, to fill a rectangle with a linear gradient, you first define a 'linearGradient' element and give it an ID, as in:

Example: 05_07.xml
<linearGradient xml:id="MyGradient">...</linearGradient>

You then reference the linear gradient as the value of the 'fill' property for the rectangle, as in the following example:

Example: 05_08.xml
<rect fill="url(#MyGradient)"/>

14.1.4 Reference restrictions

Some of the elements using IRI references have restrictions on them. Which kinds of IRI references that are allowed on each element is listed in the table below. In SVG, IRI references can be categorized as being one (or more) of the following five types:

For each of the above five IRI types, A – E, there is a column in the reference restriction table below indicating whether the given attribute is allowed to have a reference of the given form. An IRI reference that does not comply to the restrictions in the table below is an invalid IRI reference.

Element Referencing attribute A B C D E
An animation element 'xlink:href' Yes, see Identifying the target element for an animation for reference rules. No No No No
'discard' 'xlink:href' Yes, see Identifying the target element for an animation for reference rules. No No No No
'a' 'xlink:href' Yes, see Linking into SVG content. Yes, see Links out of SVG content. Yes Yes Yes
'use' 'xlink:href' Yes, but a 'use' element must not reference an 'svg' element. Yes, but the referenced fragment must not contain scripting, hyperlinking to animations or any externally referenced 'use' or 'animation' elements. No No No
'image' 'xlink:href' No No No Yes, but the 'image' element must reference content that is a raster image format. Yes, but the content within the data: IRI reference must be a raster image.
'animation' 'xlink:href' No No Yes No Yes
'prefetch' 'xlink:href' Yes Yes Yes Yes No
'audio' 'xlink:href' No No No Yes, depending on supported audio formats, indicated by the 'type' attribute. Yes
'video' 'xlink:href' No No No Yes, depending on supported video formats, indicated by the 'type' attribute. Yes
'foreignObject' 'xlink:href' No Yes No Yes Yes
'script' 'xlink:href' No No No Yes, but it must reference an external resource that provides the script content. Yes
'handler' 'xlink:href' Yes Yes No Yes, but it must reference an external resource that provides the script content. Yes
'listener' 'handler'
Yes No No No No
An element on which paint may be specified 'fill' Yes, only referencing a paint server, see Specifying paint. No No No No
An element on which paint may be specified 'stroke' Yes, only referencing a paint server, see Specifying paint. No No No No
An element on which navigation attributes may be specified A navigation attribute Yes, see Specifying navigation. No No No No
'font-face-uri' 'xlink:href' Yes, the reference must be to an SVG 'font' element. Yes, the reference must be to an SVG 'font' element. No No Yes
'mpath' 'xlink:href' Yes, only referencing a 'path' element. No No No No

Additionally, any IRI reference which cannot be resolved is an invalid IRI reference. Examples of reasons for an IRI reference to be unable to be resolved include:

Any required processing for an attribute with an invalid IRI reference is described in the attribute definition. Note that when the 'externalResourcesRequired' attribute has been set to 'true' on the referencing element or one of its ancestors, then an unresolved external IRI reference will result in special handling (see External resources).

A circular IRI reference is an error. Because SVG user agents may vary on when they first detect and abort a circular reference, conforming SVG document fragments must not rely upon circular references. Examples of circular references include:

It is recommended that, wherever possible, referenced elements be defined inside of a 'defs' element. Among the elements that are always referenced are 'linearGradient' and 'radialGradient'. Defining these elements inside of a 'defs' element promotes understandability of the SVG content and thus promotes accessibility.

14.1.5 IRI reference attributes

IRI references are normally specified with an 'href' attribute in the XLink [XLink] namespace. For example, if the prefix of 'xlink' is used for attributes in the XLink namespace, then the attribute is be specified as 'xlink:href'. The value of this attribute forms a reference for the desired resource (or secondary resource, if there is a fragment identifier).

The value of the 'href' attribute must be an Internationalized Resource Identifier.

If the protocol, such as HTTP, does not support IRIs directly, the IRI is converted to a URI by the SVG implementation, as described in section 3.1 of the IRI specification [RFC3987.

Because it is impractical for any application to check that a value is an IRI reference, this specification follows the lead of the IRI Specification in this matter and imposes no such conformance testing requirement on SVG applications.

If the IRI reference is relative, its absolute version must be computed by the method described in XML Base before use [XML-BASE].

Additional XLink attributes can be specified that provide supplemental information regarding the referenced resource.

Schema: xlinkattr
    <define name='svg.XLinkBase.attr' combine='interleave'>
      <optional>
        <attribute name='xlink:type' svg:animatable='true' svg:inheritable='false'>
          <value>simple</value>
        </attribute>
      </optional>
      <optional>
        <attribute name='xlink:role' svg:animatable='false' svg:inheritable='false'>
          <ref name='IRI.datatype'/>
        </attribute>
      </optional>
      <optional>
        <attribute name='xlink:arcrole' svg:animatable='false' svg:inheritable='false'>
          <ref name='IRI.datatype'/>
        </attribute>
      </optional>
      <optional>
        <attribute name='xlink:title' svg:animatable='false' svg:inheritable='false'><text/></attribute>
      </optional>
    </define>

    <define name='svg.XLinkHrefRequired.attr' combine='interleave'>
      <optional>
        <attribute name='xlink:href' svg:animatable='true' svg:inheritable='false'>
          <ref name='IRI.datatype'/>
        </attribute>
      </optional>
    </define>

    <define name='svg.XLinkBaseRequired.attr' combine='interleave'>
      <ref name='svg.XLinkBase.attr'/>
      <ref name='svg.XLinkHrefRequired.attr'/>
    </define>


    <define name='svg.XLinkActuateOnLoad.attr' combine='interleave'>
      <optional>
        <attribute name='xlink:actuate' svg:animatable='false' svg:inheritable='false'>
          <value>onLoad</value>
        </attribute>
      </optional>
    </define>

    <define name='svg.XLinkShowOther.attr' combine='interleave'>
      <optional>
        <attribute name='xlink:show' svg:animatable='false' svg:inheritable='false'>
          <value>other</value>
        </attribute>
      </optional>
    </define>


    <define name='svg.XLinkEmbed.attr' combine='interleave'>
      <optional>
        <attribute name='xlink:show' svg:animatable='false' svg:inheritable='false'>
          <value>embed</value>
        </attribute>
      </optional>
      <ref name='svg.XLinkActuateOnLoad.attr'/>
      <ref name='svg.XLinkBaseRequired.attr'/>
    </define>


    <define name='svg.XLinkRequired.attr' combine='interleave'>
      <ref name='svg.XLinkShowOther.attr'/>
      <ref name='svg.XLinkActuateOnLoad.attr'/>
      <ref name='svg.XLinkBaseRequired.attr'/>
    </define>


    <define name='svg.XLinkReplace.attr' combine='interleave'>
      <optional>
        <attribute name='xlink:show' svg:animatable='false' svg:inheritable='false'>
          <choice>
            <value>new</value>
            <value>replace</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name='xlink:actuate' svg:animatable='false' svg:inheritable='false'>
          <value>onRequest</value>
        </attribute>
      </optional>
      <ref name='svg.XLinkBaseRequired.attr'/>
    </define>

    <define name='svg.XLink.attr' combine='interleave'>
      <optional>
        <ref name='svg.XLinkHrefRequired.attr'/>
      </optional>
      <ref name='svg.XLinkShowOther.attr'/>
      <ref name='svg.XLinkActuateOnLoad.attr'/>
      <ref name='svg.XLinkBase.attr'/>
    </define>
xlink:type = "simple"

Identifies the type of XLink being used. In SVG Tiny 1.2, only simple links are available. In line with the changes proposed in XLink 1.1 [XLINK11], this attribute may be omitted on simple links. Links are simple links by default, so the attribute xlink:type="simple" is optional and need not be explicitly stated. Refer to the XML Linking Language (XLink) [XLINK10].

Animatable: no.

xlink:role = "<IRI>"

An optional IRI reference that identifies some resource that describes the intended property. The value must be an IRI reference as defined in [RFC3987], except that if the IRI scheme used is allowed to have absolute and relative forms, the IRI portion must be absolute. When no value is supplied, no particular role value shall be inferred. Refer to the XML Linking Language (XLink) [XLINK10].

Animatable: no.

xlink:arcrole = "<IRI>"

An optional IRI reference that identifies some resource that describes the intended property. The value must be an IRI reference as defined in [RFC3987], except that if the IRI scheme used is allowed to have absolute and relative forms, the IRI portion must be absolute. When no value is supplied, no particular role value shall be inferred. The arcrole attribute corresponds to the [RDF] notion of a property, where the role can be interpreted as stating that "starting-resource HAS arc-role ending-resource." This contextual role can differ from the meaning of an ending resource when taken outside the context of this particular arc. For example, a resource might generically represent a "person," but in the context of a particular arc it might have the role of "mother" and in the context of a different arc it might have the role of "daughter." Refer to the XML Linking Language (XLink) [XLINK10].

Animatable: no.

xlink:title = "<string>"

The title attribute shall be used to describe the meaning of a link or resource in a human-readable fashion, along the same lines as the role or arcrole attribute. A value is optional; if a value is supplied, it shall contain a string that describes the resource. In general it is preferable to use a 'title' child element rather than a 'title' attribute. The use of this information is highly dependent on the type of processing being done. It may be used, for example, to make titles available to applications used by visually impaired users, or to create a table of links, or to present help text that appears when a user lets a mouse pointer hover over a starting resource. Refer to the XML Linking Language (XLink) [XLINK10].

Animatable: no.

xlink:show = "new' | 'replace' | 'embed' | 'other' | 'none'

This attribute is provided for backwards compatibility with SVG 1.1. It provides documentation to XLink-aware processors. In case of a conflict, the target attribute has priority, since it can express a wider range of values. Refer to the XML Linking Language (XLink) [XLINK10].

Animatable: no.

xlink:actuate = "onLoad'

This attribute is provided for backwards compatibility with SVG 1.1. It provides documentation to XLink-aware processors. Refer to the XML Linking Language (XLink) [XLINK10].

Animatable: no.

In all cases, for compliance with either the "Namespaces in XML 1.0" or the "Namespaces in XML 1.1" Recommendation [XML-NS10][XML-NS], an explicit XLink namespace declaration must be provided whenever one of the above XLink attributes is used within SVG content. One simple way to provide such an XLink namespace declaration is to include an 'xmlns' attribute for the XLink namespace on the 'svg' element for content that uses XLink attributes.

Example: XLink namespace declaration

Example: 05_09.svg
<?xml version="1.0"?>
<svg xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny">
  <desc>Declaring the XLink namespace, as well as the SVG one</desc>
  <image xlink:href="foo.png"/>
</svg>

Example: use and animation

The two files below are the referenced files in the 'use' and animation examples further down.

Example: referencedRect.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 
     version="1.2" baseProfile="tiny" 
     xml:id="animationRef" width="150" height="50" viewBox="0 0 150 50" fill="inherit">  

    <rect xml:id="aMovingRect" width="50" height="50" rx="5" ry="5" fill="inherit" stroke-width="3" stroke="black">
         <animateTransform attributeName="transform" type="translate" values="0,0;0,100" begin="0" dur="2" fill="freeze"/>
    </rect>
</svg>
Example: referencedRect2.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 
     version="1.2" baseProfile="tiny" 
     xml:id="animationRef" width="150" height="50" viewBox="0 0 150 50" fill="inherit">  

    <rect xml:id="aMovingRect" width="50" height="50" rx="5" ry="5" fill="rgb(255,28,141)" stroke-width="3" stroke="black">
         <animateTransform attributeName="transform" type="translate" values="0,0;0,100" begin="0" dur="2" fill="freeze"/>
    </rect>
</svg>

The following example illustrates how to reference SVG content from the 'animation' element. Different 'fill' values are used to show the way properties are inherited on content referenced from the 'animation' element.

Example: animation.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 
     version="1.2" baseProfile="tiny" width="100%" height="100%" viewBox="0 0 580 400">  

    <g fill="rgb(157,0,79)">
        <animation x="20" xlink:href="referencedRect.svg"/>
        <animation x="100"  xlink:href="referencedRect2.svg"/>
        <animation begin="1" x="180" viewport-fill="rgb(255,28,141)" xlink:href="referencedRect.svg"/>
    </g>
    
</svg>

The image below shows the correct rendering of the animation example above. The arrows indicates the animation. The grayed rectangles shows the initial state (i.e. time=0), the colored rectangles shows the final state (animations are completed).
image showing usage of the animation element

The following example illustrates the different ways SVG content can be referenced from a 'use' element. Different 'fill' values are used to show the way properties are inherited on content referenced from the 'use' element.

Example: use.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 
     version="1.2" baseProfile="tiny" width="100%" height="100%" viewBox="0 0 580 400">  
    <defs>
        <g fill="green">
            <rect xml:id="aMovingRect" width="50" height="50" rx="5" ry="5" fill="inherit" stroke-width="3" stroke="black">
                <animateTransform attributeName="transform" type="translate" values="0,0;0,100" begin="0" dur="2" fill="freeze"/>
            </rect>
        </g>
    </defs>
    
    <g fill="rgb(157,0,79)">
        <use x="20" xlink:href="#aMovingRect"/>
            
        <use x="100" fill="rgb(255,28,141)" xlink:href="#aMovingRect"/>
    
        <use x="180" xlink:href="referencedRect.svg#aMovingRect"/>

        <use x="260" fill="rgb(255,28,141)" xlink:href="referencedRect.svg#aMovingRect"/>
    </g>

</svg>

The image below shows the correct rendering of the use example above. The arrows indicates the animation. The grayed rectangles shows the initial state (i.e. time=0), the colored rectangles shows the final state (animations are completed).
image showing usage of the use element

14.1.6 Processing of external references to documents

When an SVG user agent resolves an external reference to a document, how the document is loaded and processed depends on how the document was referenced. As defined below, a document is classified as either a primary document or a resource document, and this classification determines the document's processing with respect to loading of external references.

A primary document is one that is to be presented in whole by the user agent. Specifically, the following are classified as primary documents:

A resource document is a document that has been loaded because parts of it are referenced as resources by an SVG document fragment. Specifically, the following kinds of external references, all of which are references to elements, will cause the loaded document to be classified as a resource document:

Note that neither a primary document nor a resource document need be a complete SVG document (with the rootmost 'svg' element being the document element). Both may be non-SVG documents that contain SVG document fragments.

Each primary document maintains a dictionary that maps IRIs to resource documents. This dictionary is used whenever a resource document is to be loaded because an SVG document fragment within the primary document (or one of its resource documents) references it. Before loading a resource document, its IRI is first looked up in the primary document's dictionary to determine if it has already been loaded. If so, then that already-loaded document is used instead of creating a separate document instance. Thus, for each primary document, a given resource document is loaded only once. Primary documents, however, are always separate, self-contained document instances, and resource documents are not shared between different primary documents.

The IRI used as the key in the dictionary of resource documents must be the absolute IRI after resolving it against any applicable base IRI, and comparisons of the dictionary keys must be performed using a Simple String Comparison, as defined in section 5.3.1 of Internationalized Resource Identifiers [RFC3987].

Whether a document is a primary document or a resource document, its processing once loaded is the same: each SVG document fragment within the document acts as a separate SVG processing context in which events are fired, scripts are executed, an animation timeline is created and animations are run, stylesheets are applied (if supported by the SVG user agent), and so on. Since a resource document is not just a static DOM, any changes to it (be they modifications by script or changing presentation values with animation) will be visible through all references to that resource document.

Note that since IRI references to resources from different primary documents will result in logically separate resource documents being instantiated, an SVG user agent will in general not be able to conserve memory by having only one instance of the resource document in memory. In the case that many primary documents all have references to a single, large, common resource file, this will likely result in a large amount of memory consumed. If the SVG user agent is able to prove that the primary documents will behave exactly the same if a single instance is shared in memory (by using copy-on-write semantics for the resource documents, for example), then such an optimization may of course be performed.

References to any other kinds of document, such as media or external scripts, are not classified as primary or resource documents. Multiple references to media at a particular IRI always result in separate timelines being created.

14.2 Links out of SVG content: the 'a' element

SVG provides an 'a' element, analogous to HTML's 'a' element, to indicate links (also known as hyperlinks or Web links). SVG uses XLink [XLINK10] for all link definitions.

SVG Tiny 1.2 only requires that user agents support XLink's notion of simple links. Each simple link associates exactly two resources, one local and one remote, with an arc going from the former to the latter.

A simple link is defined for each separate rendered element contained within the 'a' element; thus, if the 'a' element contains three 'circle' elements, a link is created for each circle. For each rendered element within an 'a' element, the given rendered element is the local resource (the source anchor for the link).

The remote resource (the destination for the link) is defined by an IRI specified by the XLink 'href' attribute on the 'a' element. The remote resource may be any Web resource (e.g., an image, a video clip, a sound bite, a program, another SVG document, an HTML document, etc.). By activating these links (by clicking with the mouse, through keyboard input, voice commands, etc.), users may traverse hyperlinks to these resources.

If the IRI identifies an animation element within the current SVG document fragment, then activating the 'a' element will hyperlink to the animation, as defined in SMIL 2.1 ([SMIL21], section 10.4.3).

Example 17_01 assigns a link to an ellipse.

Example: 17_01.svg
<?xml version="1.0"?>
<svg width="5cm" height="3cm" viewBox="0 0 5 3" version="1.2" baseProfile="tiny"
     xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

  <title>Example 17_01</title>
  <desc>A simple link on an ellipse.</desc>
  <rect x=".01" y=".01" width="4.98" height="2.98" 
        fill="none" stroke="blue"  stroke-width=".03"/>
  <a xlink:href="http://www.w3.org/">
    <ellipse cx="2.5" cy="1.5" rx="2" ry="1"
             fill="red" />
  </a>
</svg>
Rendering of 17_01.svg

If the above SVG file is viewed by a user agent that supports both SVG and HTML, then clicking on the ellipse will cause the current window or frame to be replaced by the W3C home page.

The element definition schema and content model for 'a' is not defined here. It is defined in all the places it can occur.

Schema: a.at
    <define name='a.AT' combine='interleave'>
      <ref name='svg.Core.attr'/>
      <ref name='svg.Conditional.attr'/>
      <ref name='svg.Properties.attr'/>
      <ref name='svg.FocusHighlight.attr'/>
      <ref name='svg.External.attr'/>
      <ref name='svg.Focus.attr'/>
      <ref name='svg.Transform.attr'/>
      <ref name='svg.XLinkReplace.attr'/>
      <optional>
        <attribute name='target' svg:animatable='true' svg:inheritable='false'>
          <choice>
            <value>_replace</value>
            <value>_self</value>
            <value>_parent</value>
            <value>_top</value>
            <value>_blank</value>
            <ref name='XML-Name.datatype'/>
          </choice>
        </attribute>
      </optional>
    </define>

Attribute definitions:

xlink:type = "simple"

See generic description of 'xlink:type' attribute.

xlink:role = "<IRI>"

See generic description of 'xlink:role' attribute.

xlink:arcrole = "<IRI>"

See generic description of 'xlink:arcrole' attribute.

xlink:title = "<string>"

See generic description of 'xlink:title' attribute.

xlink:show = "new" | "replace"

This attribute is provided for backwards compatibility with SVG 1.1. It provides documentation to XLink-aware processors. If target="_blank" then use xlink:show="new" else use 'replace'. In case of a conflict, the target attribute has priority, since it can express a wider range of values. Refer to the XML Linking Language (XLink) [XLINK10].

Animatable: no.

xlink:actuate = "onRequest"

This attribute is provided for backwards compatibility with SVG 1.1. It provides documentation to XLink-aware processors that an application should traverse from the starting resource to the ending resource only on a post-loading event triggered for the purpose of traversal. Refer to the XML Linking Language (XLink) [XLINK10].

Animatable: no.

xlink:href = "<IRI>"

The location of the referenced object, expressed as an IRI reference.

Animatable: yes.

target = "_replace" | "_self" | "_parent" | "_top" | "_blank" | "<XML-Name>"

This attribute should be used when there are multiple possible targets for the ending resource, such as when the parent document is a multi-frame HTML or XHTML document. This attribute specifies the name or portion of the target window, frame, pane, tab, or other relevant presentation context (e.g., an HTML or XHTML frame, iframe, or object element) into which a document is to be opened when the link is activated. The values and semantics of this attribute are the same as the WebCGM Picture Behavior values [WEBCGM]:

_replace
The current SVG image is replaced by the linked content in the same rectangular area in the same frame as the current SVG image.
_self
The current SVG image is replaced by the linked content in the same frame as the current SVG image. This is the lacuna value, if the target attribute is not specified.
_parent
The immediate frameset parent of the SVG image is replaced by the linked content.
_top
The content of the full window or tab, including any frames, is replaced by the linked content
_blank
A new un-named window or tab is requested for the display of the linked content. If this fails, the result is the same as _top
<XML-Name>
Specifies the name of the frame, pane, or other relevant presentation context for display of the linked content. If this already exists, it is re-used, replacing the existing content. If it does not exist, it is created (the same as '_blank', except that it now has a name).

Note: The value '_new' is not a legal value for target (use '_blank').

Animatable: yes.

focusable = "true" | "false" | "auto"

See attribute definition for description.

Animatable: yes.

Navigation Attributes

See definition.

Typically, HTML user agents, by convention, style the content of anchor elements to indicate that they are links, for example by underlining and changing the color of text and creating a colored border around images and other replacement content. Because SVG is a visual language with irregular shapes and complex link structure (e.g. allowing links within other links), and is intended to allow more precise control over the appearance of the content, SVG user agents should not provide default styling to child content of an 'a' element, instead allowing authors to control the linking conventions.

However, in order to ensure that links are obvious to users and to provide detailed information about each link, SVG user agents should provide a clear indicator when a link is in scope. A link shall be considered to be in scope if one of the child elements of that 'a' element has a pointer device cursor hovered over it or when that element is the currently focused element. The user agent should change the scope indicator to signal that a link is in scope (e.g. the cursor may be changed to a pointing hand, or the focus highlight may be color-coded to indicate the status of the link), should indicate the URI of the link (by displaying it in a status bar, or reading it aloud, for example), and should display any author-supplied information about the link (as with a tooltip). Authors should use the 'xlink:title' attribute appropriately on links, in order to provide information about the link to users.

14.3 Linking into SVG content: IRI fragments and SVG views

14.3.1 Introduction: IRI fragments and SVG views

Because SVG content often represents a picture or drawing of something, a common need is to link into a particular view of the document, where a view indicates the initial transformations so as to present a closeup of a particular section of the document.

14.3.2 SVG fragment identifiers

To link into a particular view of an SVG document, the IRI fragment identifier must be a correctly formed SVG fragment identifier. An SVG fragment identifier defines the meaning of the "selector" or "fragment identifier" portion of IRIs that locate resources of MIME media type "image/svg+xml".

An SVG fragment identifier can come in two forms:

  1. Shorthand bare name form of addressing (e.g., someDrawing.svg#someView). This form of addressing, which allows addressing an SVG element by its ID, is compatible with the fragment addressing mechanism for older versions of HTML and the shorthand bare name formulation in XPointer Framework [XPTRFW].
  2. SVG view specification (e.g., someDrawing.svg#svgView(transform(scale(2))). This form of addressing specifies the desired view of the document (e.g., the region of the document to view, the initial zoom level) completely within the SVG fragment specification. The contents of the SVG view specification is "transform(...)" whose parameters have the same meaning that the corresponding attribute has on a 'g' element has).

An SVG fragment identifier is defined as follows:

SVGFragmentIdentifier ::= BareName |
                          SVGViewSpec

BareName ::= NCName
SVGViewSpec ::= 'svgView(' SVGViewAttributes ')'
SVGViewAttributes ::= SVGViewAttribute |
                      SVGViewAttribute ';' SVGViewAttributes

SVGViewAttribute ::= transformSpec
transformSpec ::= 'transform(' TransformList ')'

where:

An SVG fragment identifier must match the specified grammar. To ensure robust content, authors are recommended to omit spaces between numeric values, or replace these spaces with percent-encoded strings or commas as appropriate.

Note: since fragment identifiers are stripped from IRIs before resolution, there is no need to escape any characters in fragments that are outside the repertoire of US-ASCII.

When a user agent traverses a link to an SVG document fragment, whether from within the same document or from an external source document, then the SVG fragment identifier shall specify the initial view into the SVG document. This applies whether the link is from an SVG 'a' element, an HTML anchor element [HTML4] (i.e., an <a href=...> element in HTML), or any specification using XLink [XLINK10]. The user agent shall take the following steps in determining the effect of the link traversal:

Note: In SVG Tiny 1.2, only a single 'svg' element is allowed. Thus, the closest ancestor 'svg' element and the rootmost 'svg' element are the same. This is not true in other profiles of SVG, where the distinction becomes significant.