SVG 1.2 - 27 October 2004

Previous | Top | Next

17 Non-graphical enhancements

17.1 Externally referenced documents

For the following section, the term "primary document" refers to an outermost SVG document or SVG document fragment. If an SVG document is loaded directly by a web browser (e.g., the browser views file foo.svg), then it is the primary document. If an SVG document as a whole is referenced for inclusion by a parent document, such as using the html:object or svg:image elements, then that document itself is also a primary document. If an SVG document fragment is embedded inline within a non-SVG document, then the outermost svg element defines the root element for a subtree which acts as a primary document.

Implementations are free to optimize for the case of large resource library loaded into multiple primary documents, but logically each primary document represents its own separate, self-contained document instance. In particular, the conceptual processing model is that events (e.g., the document load event) are fired; scripts are executed in normal fashion and resource documents are modifiable by scripts; coordinate systems transformations are applied; stylesheets are applied and the CSS cascade is run; timelines are initiated and animations execute; sXBL transformations are applied; etc. For example, if document A.svg includes an svg:image element which refers to B.svg, then both are primary documents, and both represent separate, self-contained documents with their own scripting contexts and animation timelines.

The term "resource document" refers to a complete, self-contained SVG document which has at least one of its elements referenced as a resource by a primary document. For example, suppose document A.svg is loaded into a browser for viewing, and this document refers to a gradient element within B.svg via a URI reference. In this case, A.svg is a primary document and B.svg is a resource document.

Each primary document has an associated dictionary that maps all URLs for resource documentsit references; initially it is populated only with the primary document itself. Each resource or subresource loaded directly or indirectly is resolved through that dictionary with resource documents downloaded as needed.

The conceptual model is that each resource documents are loaded only once; if the same resource document is referenced multiple times directly or indirectly by the same primary document, that resource document is only retrieved and processed one time. Thus, if a primary document references both a gradient element and a filter effect from the resource document, the resource document is loaded only once.

The conceptual processing model for resource documents is that the document is processed as a complete and separate SVG document instance. The only difference between a resource document and a primary document is that the primary document is rendered directly to the canvas, whereas all resource documents are conceptually rendered to an invisible (offscreen) canvas. In particular, the conceptual processing model is that events (e.g., the document load event) are fired; scripts are executed in normal fashion and resource documents are modifiable by scripts; coordinate systems transformations are applied; stylesheets are applied and the CSS cascade is run; timelines are initiated and animations execute; sXBL transformations are applied; etc.

Because of HTTP redirects, the same source document might be retrieved from multiple different source URIs. The rule for SVG is that documents are considered to be unique based on string comparisons of the full URI after resolving relative URIs into absolute URIs and after taking into account HTTP redirects (i.e., use the post-redirect URI instead of the original source URI).

17.2 Referencing external titles, descriptions and metadata

SVG 1.2 adds the xlink:href attribute to the title, desc and metadata elements, allowing them to reference of external content. In each case the URI must point to data that can be included as content of the referencing element.

SVG encourages the use of a common metadata format for inclusion of copyright information. Metadata relevant to the data copyright of the entire document should be added to metadata element of the topmost svg element. This allows the author to unambiguously state the licensing terms for the entire document. The scheme may also be used elsewhere in the document, for pieces that have different licensing. For example, an SVG font may have specific licensing details expressed in its own metadata element.

Note that inclusion of this metadata does not provide the author with a method in which to protect or enforce their copyright, it simply bundles the copyright information with the content in a defined manner. Providing methods, technical or non-technical, for data protection is currently beyond the scope of the SVG specification. For more information on protecting XML content see XML Encryption.

The suggested vocabulary for Copyright information is the Creative Commons Metadata Set. This does not exclude the use of other metadata schemes.

Below is an example of providing a copyright license that allows public distribution and reproduction with attribution but disallows commercial use:

<svg>
  <metadata>
    <rdf:RDF xmlns:cc="http://web.resource.org/cc/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <cc:work rdf:about="">
        <cc:license>
           <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
           <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
           <cc:requires rdf:resource="http://web.resource.org/cc/Attribution"/>
           <cc:prohibits rdf:resource="http://web.resource.org/cc/CommercialUse"/>
        </cc:license>
      </cc:work>
    </rdf:RDF>
  </metadata>

  <!-- graphics go here -->

</svg>

Below is an example which prohibits reproduction and distribution.

<svg>
  <metadata>
    <rdf:RDF xmlns:cc="http://web.resource.org/cc/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <cc:work rdf:about="">
        <cc:license>
           <cc:prohibits rdf:resource="http://web.resource.org/cc/Reproduction"/>
           <cc:prohibits rdf:resource="http://web.resource.org/cc/Distribution"/>
        </cc:license>
      </cc:work>
    </rdf:RDF>
  </metadata>

  <!-- graphics go here -->

</svg>

Below is an example which refers to an external license:

<svg>
  <metadata>
    <rdf:RDF xmlns:cc="http://web.resource.org/cc/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <cc:work rdf:about="">
        <cc:license rdf:resource="http://www.example.org/copyright"/>
      </cc:work>
    </rdf:RDF>
  </metadata>

  <!-- graphics go here -->

</svg>

Like all metadata processing in SVG, there is no requirement for the SVG User Agent to take any action when it finds copyright information. However, it is recommended that in the cases where a User Agent does understand the Copyright information, then it should use that information. For example, it may display the copyright for source code in a message to the user before it displays the source.

17.4 Specifying a snapshot time

SVG 1.2 adds the snapshotTime attribute to svg elements. The attribute only has an effect on the root svg element.

snapShotTime = " <time>"
Indicates a moment in time which is most relevant for a still-image of the animated svg content. This time can be used as a hint to the SVG User Agent for rendering a still-image of an animated SVG Document, such as a preview. Animatable: no

Below is an example of an svg file with a snapShotTime specified. A User Agent displaying a number of svg files in a file directory by rendering a thumbnail image of each file can use the snapShotTime as the time-to-render when generating the image. The look of the thumbnail for a UA honoring the snapShotTime and for a UA not honoring it is showed below the example.

<svg version="1.2" snapShotTime="3" baseProfile="tiny"
     xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" 
     viewBox="0 0 400 300">

   <rect x="60" y="85" width="256" height="65" fill="none" 
         stroke="rgb(60,126,220)" stroke-width="4"/>

   <text x="65" y="140" fill="rgb(60,126,220)"
         font-family="Myriad-Roman" font-size="60">Hello SVG
      <animateColor attributeName="fill" begin="0" dur="3"
          from="white" to="rgb(60,126,220)"/>  
   </text> 
</svg>

Snapshot time thumbnails