(This section is still under construction.)
One goal for SVG is to provide a mechanism by which other XML language processors can render into an area within an SVG drawing, with those renderings subject to the various transformations and compositing parameters that are currently active within the SVG document. One particular example of this is to provide a frame for the HTML/CSS processor so that dynamically reflowing text (subject to SVG transformations and compositing) could be inserted into the middle of an SVG document. Another example is inserting a MathML expression into an SVG drawing.
This facility would include a capability for some sort for an alternative representation of the embedded foreign object so that something meaningful might appear in SVG viewing environments which do not have the ability to process the embedded foreign object. One way this might work would be via a <switch> element and system-required attribute similar to the corresponding facilities within the SMIL 1.0 Recommendation.
To illustrate the desired capabilities with an example, we'll assume that:
<?xml version="1.0" standalone="yes"?> <svg width="4in" height="3in" xmlns = 'http://www.w3.org/Graphics/SVG/svg-19990412.dtd'> <desc>This example uses the switch element to provide a fallback graphical representation of an equation, if MathML is not supported. </desc> <!-- The <switch> element will process the first child element whose testing attributes evaluate to true.--> <switch> <!-- Process the MathML if the system-required attribute evaluates to true (i.e., the user agent supports MathML embedded within SVG). --> <foreignobject system-required="http://www.w3.org/TR/REC-MathML-19980407" width="100" height="50"> <!-- MathML content goes here --> </foreignobject> <!-- Else, process the following alternate SVG. Note that there are no testing attributes on the <g> element. If no testing attributes are provided, it is as if there were testing attributes and they evaluated to true.--> <g> <!-- Draw a red rectangle with a text string on top. --> <rect style="fill: red"/> <text>Formula goes here</text> </g> </switch> </svg>
Download this example
It is not required that SVG processors support the ability to invoke other arbitrary processors to handle embedded foreign object types; however, all conforming SVG processors would need to support the <switch> element and should be able to render valid SVG elements when they appear as one of the alternatives within a <switch> element.
It is expected that commercial Web browsers at a minimum will support the ability for SVG to embed content from other XML grammars which use CSS layout or XSL to format their content, with the resulting CSS- or XSL-formatted content subject to SVG transformations and compositing.
(The exact mechanism for providing these capabilities hasn't been decided yet. Many details need to be worked out.)