# 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