# 18. 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) 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>

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

Implementation: RELAX NG

## 18.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: Open
Resolution: None
User: None

Notes:

17 Embedding Attributes - Invalid XHTML 2 documents PR #7731
State: Open
Resolution: None
User: None

Notes:

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

Notes:

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

Notes:

17 Embedding Attributes Success/Failure status codes. PR #7734
State: Open
Resolution: None
User: None

Notes:
The 200 codes are classified as SUCCESS, so there should be no doubt. An empty document is perfectly acceptable, so 204 is also a success 400 are all failures. 401: the HTTP req says the reply SHOULD be shown to the user. It doesn't say it has to be shown by embedding it at the position where the URL was. It could be shown in a dialogue box, or a separate window.

[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: Open
Resolution: None
User: None

Notes:

[XHTML 2] Embedded Resources containing links PR #7737
State: Open
Resolution: None
User: None

Notes:

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

Notes:

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

Notes:

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

Notes:

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

Notes: