# 17. 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 (network unavailable, no resource available at the URI given, inability of the user agent to process the type of resource) 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>

## 17.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

      <script src="pop" type="application/x-javascript, text/x-newspeak" />

      <style src="midnight" type="text/css, text/x-mystyle" />

      <p src="w3c-logo" type="image/png, image/jpeg;q=0.2">W3C logo</p>

      <span src="logo.png">Our logo</span>

      <span src="theme.mp3" type="audio/x-mpeg">Our theme jingle</span>

Implementation: RELAX NG