19. XHTML Embedding Attributes Module

Contents

This section is normative.

The Embedding Attributes module defines the Embedding attribute collection.

This collection causes the contents of a remote resource to be embedded in the document in place of the element's content. If accessing the remote resource fails, for whatever reason (e.g., network unavailable, no resource available at the URI given, inability of the user agent to process the type of resource) or an associated @ismap attribute fails, the content of the element must be processed instead.

Note that this behavior makes documents far more robust, and gives much better opportunities for accessible documents than the longdesc attribute present in earlier versions of XHTML, since it allows the description of the resource to be included in the document itself, rather than in a separate document.

Example

<p src="holiday.png" srctype="image/png">
	<span src="holiday.gif" srctype="image/gif">
		An image of us on holiday.
	</span>
</p>
<table src="temperature-graph.png" srctype="image/png">
<caption>Average monthly temperature over the last 20 years</caption>
<tr><th>Jan</th><th>Feb</th><th>Mar</th><th>Apr</th><th>May</th><th>Jun</th>
    <th>Jul</th><th>Aug</th><th>Sep</th><th>Oct</th><th>Nov</th><th>Dec</th>
</tr>
<tr><td> 4</td><td> 2</td><td> 7</td><td> 9</td><td>13</td><td>16</td>
    <td>17</td><td>17</td><td>14</td><td>11</td><td> 7</td><td> 4</td>
</tr>
</table>

19.1. Embedding Attribute Collection

encoding = Encodings
This attribute specifies the allowable encoding of the external resource referenced by the @src attribute. At its most general, it is a comma-separated list of encodings, such as "utf-8", "utf8, utf-16", or "utf-8, utf-16, *".

The user agent must use this list as the field value of the accept-charset request header when requesting the resource using HTTP.

If this attribute is not present, the user agent must use its default value of the accept-charset request header.

User agents should use a similar technique when using other protocols that allow encoding negotation

When using protocols that do not allow encoding negotiation to retrieve resources whose encodings are not self-identifying, the user agent should use the first encoding in the attribute's value as the indication of the resource.

Example

<style type="text/css" src="style/home" encoding="utf-8" /> 
src = URI
This attribute specifies the location of an external source for the contents of the element. Actuation occurs as the default action of a [DOM] load event for the element that the attribute occurs on.

What happens if the src fails

If the src attribute target is not available, the contents of the element are processed. Is there a DOM event that is raised in this context as well?

At the Dulles f2f we discussed the possibility of relying upon DOM events to raise these - but ensure that XHTML refers to DOM events for any elements / attributes that have behaviors in addition to semantics.

srctype = ContentTypes

This attribute specifies the allowable content types of the resource referenced by the relevant @src URI.

Example

<handler src="pop" srctype="application/x-javascript, text/x-newspeak" />
<style src="midnight" srctype="text/css, text/x-mystyle" />
<p src="w3c-logo" srctype="image/png, image/jpeg;q=0.2">W3C logo</p>
<span src="logo.png">Our logo</span>
<span src="theme.mp3" srctype="audio/x-mpeg">Our theme jingle</span>

Implementations: RELAX NG, XML Schema

19.2. Issues

Re: Formal Response to My issue on styling embedding attributes. PR #7724
State: Open
Resolution: None
User: None

Notes:
Original message at: http://lists.w3.org/Archives/Public/www-html-editor/2005AprJun/0064 This is a reply to issue 7655, where SP also replied

17 Embedding Attributes User aborted downloads. PR #7730
State: Approved
Resolution: Accepted
User: None

Notes:
Any failure to completely process the reference results in falling back. User abort is also such a failure. We will ensure that the definition of the embedding attributes is clear about this.

17 Embedding Attributes - Invalid XHTML 2 documents PR #7731
State: Approved
Resolution: Modify and Accept
User: None

Notes:
The working group believes that if a resource is successfully accessed, the fallback is NOT accessed even if the resource cannot be appropriately rendered by the user agent. We will ensure the specification makes this clear. Moreover, things brought in via the src attribute are in an independent context - just as in the object element.

[XHTML 2] 17.1 Encoding attribute PR #7732
State: Approved
Resolution: Reject
User: None

Notes:
The encoding applies to retrieving a specific version of a resource to hand off to a resource processor for an embedded attribute. It has nothing to do, per se, with the capabilities of the user agent. We will make it clear in the text that this is the case.

[XHTML 2] Embedding attributes and nextFocus PR #7733
State: Approved
Resolution: Modify and Accept
User: None

Notes:
Embedded content is not in the document flow, so it is not availabnle for use in nextfocus. We will clarify this.

17 Embedding Attributes Success/Failure status codes. PR #7734
State: Approved
Resolution: Modify and Accept
User: None

Notes:
This specification should not specify anything about how the underlying protocols associated with a URI scheme report success or failure. We will clarify in the spec that this is the responsibility of the associated protocol.

[XHTML 2] 17 Embedding Attributes - srcType PR #7735
State: Approved
Resolution: None
User: None

Notes:
Add note to section that effect is defined in the datatype definition.

[XHTML 2] Embedding XHTML Resources Linking. PR #7736
State: Approved
Resolution: Modify and Accept
User: None

Notes:
Content brought in via the src attribute is placed *within* the surrounding element, so any annotation on the surrounding element would apply to that element. In this case, the href attribute would make the surrounding element (the a) linkable. We will clarify this in the specification.

[XHTML 2] Embedded Resources containing links PR #7737
State: Approved
Resolution: Modify and Accept
User: None

Notes:
Embedded content is in an independent context, so any links within that content would replace the embedded content, and not effect the surrounding document. We will examine providing functionality to embed content inline in a specification separately.

[XHTML 2] Embedding Attributes Examples PR #7738
State: Approved
Resolution: Reject
User: None

Notes:
The purpose of this example is to demonstrate that it is possible to use src on tables. While it might be more sensible to embed the table within an img element, it would not achieve the same result in the example.

[XHTML 2] 17 Clipping of embedded documents to viewport. PR #7739
State: Approved
Resolution: Accepted
User: None

Notes:
The embedded resource is in its own context and has its own environment (e.g., object or iframe) and any styling would be relative to that environment.

[XHTML 2] 17 Embedding Attributes PR #7774
State: Approved
Resolution: Accepted
User: None

Notes:
We will provide additional use cases and examples.

xhtml2 attributes type, srctype and hreftype PR #7892
State: Approved
Resolution: Accepted
User: None

Notes:
We will add srclang. All the embedding attributes should be equivalent to the linking attributes. We will also ensure that @type is used consistently.