How to extract an Atom feed from an HTML5 document (whatwg r3116)

How to extract an Atom feed from an HTML5 document (whatwg r3116)

Diffs for this change per section: 
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#rdf-0
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#image-map
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#extracting-bibtex
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#browsers
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#the-aside-element
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#dom-area-rellist
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#dom-article-pubdate
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#attr-article-cite
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#dom-area-protocol
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#atom
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#atom-namespace
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#attr-hyperlink-usemap
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#attr-article-pubdate
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#dom-article-cite
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#status-of-this-document
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#a-vocabulary-and-associated-apis-for-html-and-xhtml
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#processing-model
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#editor-s-draft-date-1-january-1970
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#extracting-atom
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#the-article-element
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#htmlarticleelement
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2274.html#image-maps

http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html
http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2273&r2=1.2274&f=h
http://html5.org/tools/web-apps-tracker?from=3115&to=3116

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.2273
retrieving revision 1.2274
diff -u -d -r1.2273 -r1.2274
--- Overview.html 19 May 2009 01:11:55 -0000 1.2273
+++ Overview.html 22 May 2009 05:55:23 -0000 1.2274
@@ -152,7 +152,7 @@
    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
    <!--ZZZ:-->
    <!--<h2 class="no-num no-toc">W3C Working Draft 23 April 2009</h2>-->
-   <h2 class="no-num no-toc" id="editor-s-draft-date-1-january-1970">Editor's Draft 19 May 2009</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-date-1-january-1970">Editor's Draft 22 May 2009</h2>
    <!--:ZZZ-->
    <dl><!-- ZZZ: update the month/day (twice), (un)comment out
     <dt>This Version:</dt>
@@ -245,7 +245,7 @@
   track.
   <!--ZZZ:-->
   <!--This specification is the 23 April 2009 Working Draft.-->
-  This specification is the 19 May 2009 Editor's Draft.
+  This specification is the 22 May 2009 Editor's Draft.
   <!--:ZZZ-->
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>This specification is also being produced by the <a href="http://www.whatwg.org/">WHATWG</a>. The two specifications are
   identical from the table of contents onwards.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- context and rationale (required) --><p>This specification is intended to replace (be a new version of)
@@ -761,7 +761,8 @@
      <li><a href="#rdf-0"><span class="secno">5.5.2 </span>RDF</a></li>
      <li><a href="#vcard-0"><span class="secno">5.5.3 </span>vCard</a></li>
      <li><a href="#icalendar"><span class="secno">5.5.4 </span>iCalendar</a></li>
-     <li><a href="#bibtex-0"><span class="secno">5.5.5 </span>BibTeX</a></ol></ol></li>
+     <li><a href="#bibtex-0"><span class="secno">5.5.5 </span>BibTeX</a></li>
+     <li><a href="#atom"><span class="secno">5.5.6 </span>Atom</a></ol></ol></li>
  <li><a href="#browsers"><span class="secno">6 </span>Web browsers</a>
   <ol>
    <li><a href="#windows"><span class="secno">6.1 </span>Browsing contexts</a>
@@ -11106,11 +11107,12 @@
    <dt>Content attributes:</dt>
    <dd><a href="#global-attributes">Global attributes</a></dd>
    <dd><code title="attr-article-cite"><a href="#attr-article-cite">cite</a></code></dd>
-   <!-- v2 attributes to give the date authored, date published, name of author, etc -->
+   <dd><code title="attr-article-pubdate"><a href="#attr-article-pubdate">pubdate</a></code></dd>
    <dt>DOM interface:</dt>
    <dd>
 <pre class="idl">interface <dfn id="htmlarticleelement">HTMLArticleElement</dfn> : <a href="#htmlelement">HTMLElement</a> {
            attribute DOMString <a href="#dom-article-cite" title="dom-article-cite">cite</a>;
+           attribute DOMString <a href="#dom-article-pubdate" title="dom-article-pubDate">pubDate</a>;
 };</pre>
    </dd>
   </dl><p>The <code><a href="#the-article-element">article</a></code> element <a href="#represents">represents</a> a
@@ -11138,10 +11140,14 @@
   obtain the corresponding citation link, the value of the attribute
   must be <a href="#resolve-a-url" title="resolve a url">resolved</a> relative to the
   element. User agents should allow users to follow such citation
-  links.</span><div class="impl">
+  links.</span><p>The <dfn id="attr-article-pubdate" title="attr-article-pubdate"><code>pubdate</code></dfn>
+  attribute may be used to specify the time and date that the article
+  was first published. If present, the <code title="attr-article-pubdate"><a href="#attr-article-pubdate">pubdate</a></code> attribute must be a
+  <a href="#valid-global-date-and-time-string">valid global date and time string</a> value.<div class="impl">
 
   <p>The <dfn id="dom-article-cite" title="dom-article-cite"><code>cite</code></dfn> DOM
-  attribute must <a href="#reflect">reflect</a> the element's <code title="attr-article-cite"><a href="#attr-article-cite">cite</a></code> content attribute.</p>
+  attribute must <a href="#reflect">reflect</a> the element's <code title="attr-article-cite"><a href="#attr-article-cite">cite</a></code> content attribute. The <dfn id="dom-article-pubdate" title="dom-article-pubDate"><code>pubDate</code></dfn> DOM attribute
+  must <a href="#reflect">reflect</a> the element's <code title="attr-article-pubdate"><a href="#attr-article-pubdate">pubdate</a></code> content attribute.</p>
 
   </div><h4 id="the-aside-element"><span class="secno">4.4.5 </span>The <dfn><code>aside</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
    <dd><a href="#flow-content-0">Flow content</a>.</dd>
@@ -22837,10 +22843,10 @@
 
   <p>The <code><a href="#the-area-element">area</a></code> element also suports the complement of
   <a href="#url-decomposition-attributes">URL decomposition attributes</a>, <dfn id="dom-area-protocol" title="dom-area-protocol"><code>protocol</code></dfn>, <dfn id="dom-area-host" title="dom-area-host"><code>host</code></dfn>, <dfn id="dom-area-port" title="dom-area-port"><code>port</code></dfn>, <dfn id="dom-area-hostname" title="dom-area-hostname"><code>hostname</code></dfn>, <dfn id="dom-area-pathname" title="dom-area-pathname"><code>pathname</code></dfn>, <dfn id="dom-area-search" title="dom-area-search"><code>search</code></dfn>, and <dfn id="dom-area-hash" title="dom-area-hash"><code>hash</code></dfn>. These must follow the
-  rules given for URL decomposition attributes, with the <a href="#concept-uda-input" title="concept-uda-input">input</a> being the result of <a href="#resolve-a-url" title="resolve a url">resolving</a> the element's <code title="attr-area-href">href</code> attribute relative to the
+  rules given for URL decomposition attributes, with the <a href="#concept-uda-input" title="concept-uda-input">input</a> being the result of <a href="#resolve-a-url" title="resolve a url">resolving</a> the element's <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code> attribute relative to the
   element, if there is such an attribute and resolving it is
   successful, or the empty string otherwise; and the <a href="#concept-uda-setter" title="concept-uda-setter">common setter action</a> being the
-  same as setting the element's <code title="attr-area-href">href</code> attribute to the new output
+  same as setting the element's <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code> attribute to the new output
   value.</p>
 
   </div><h4 id="image-maps"><span class="secno">4.8.14 </span>Image maps</h4><!-- TESTS
@@ -22857,9 +22863,9 @@
   <code><a href="#the-object-element">object</a></code> element representing an image, may be associated
   with an image map (in the form of a <code><a href="#the-map-element">map</a></code> element) by
   specifying a <dfn id="attr-hyperlink-usemap" title="attr-hyperlink-usemap"><code>usemap</code></dfn> attribute on
-  the <code><a href="#the-img-element">img</a></code> or <code><a href="#the-object-element">object</a></code> element. The <code title="attr-area-usemap">usemap</code> attribute, if specified, must
-  be a <a href="#valid-hash-name-reference">valid hash-name reference</a> to a <code><a href="#the-map-element">map</a></code>
-  element.<div class="example">
+  the <code><a href="#the-img-element">img</a></code> or <code><a href="#the-object-element">object</a></code> element. The <code title="attr-hyperlink-usemap"><a href="#attr-hyperlink-usemap">usemap</a></code> attribute, if specified,
+  must be a <a href="#valid-hash-name-reference">valid hash-name reference</a> to a
+  <code><a href="#the-map-element">map</a></code> element.<div class="example">
 
    <p>Consider an image that looks as follows:</p>
 
@@ -22887,8 +22893,8 @@
   <h5 id="processing-model"><span class="secno">4.8.14.2 </span>Processing model</h5>
 
   <p>If an <code><a href="#the-img-element">img</a></code> element or an <code><a href="#the-object-element">object</a></code> element
-  representing an image has a <code title="attr-area-usemap">usemap</code> attribute specified, user
-  agents must process it as follows:</p>
+  representing an image has a <code title="attr-hyperlink-usemap"><a href="#attr-hyperlink-usemap">usemap</a></code> attribute specified,
+  user agents must process it as follows:</p>
 
   <ol><li><p>First, <a href="#rules-for-parsing-a-hash-name-reference">rules for parsing a hash-name reference</a>
    to a <code><a href="#the-map-element">map</a></code> element must be followed. This will return
@@ -39493,7 +39499,7 @@
 
       <p>If the element is, or is a descendant of, an
       <code><a href="#the-address-element">address</a></code> element that <a href="#applyToSection">applies</a> to <a href="#the-body-element-0">the
-      <code>body</code> element</a>, an the <a href="#concept-item" title="concept-item">item</a> has the type <code title="md-vcard"><a href="#md-vcard">vcard</a></code>, generate the following
+      <code>body</code> element</a>, and the <a href="#concept-item" title="concept-item">item</a> has the type <code title="md-vcard"><a href="#md-vcard">vcard</a></code>, generate the following
       triple:</p>
 
       <dl class="triple"><dt>subject   <dd> <a href="#the-document-s-current-address">the document's current address</a>
@@ -40340,7 +40346,440 @@
 
    <li><p>Append aU+007D RIGHT CURLY BRACKET character (}) to <var title="">output</var>.</li>
 
-  </ol><h2 id="browsers"><span class="secno">6 </span>Web browsers</h2><div class="impl">
+  </ol><h4 id="atom"><span class="secno">5.5.6 </span>Atom</h4><p>Given a <code>Document</code> <var title="">source</var>, a user
+  agent must run the following algorithm to <dfn id="extracting-atom" title="extracting
+  Atom">extract an Atom feed</dfn>:<ol><li><p>If the <code>Document</code> <var title="">source</var> does
+   not contain any <code><a href="#the-article-element">article</a></code> elements, then return nothing
+   and abort these steps. This algorithm can only be used with
+   documents that contain distinct articles.</p>
+
+   <li><p>Let <var title="">R</var> be an empty <a href="#xml-documents" title="XML
+   documents">XML</a> <code>Document</code> object whose <a href="#the-document-s-address" title="the document's address">address</a> is user-agent
+   defined.</li>
+
+   <li><p>Append a <code title="">feed</code> element in the
+   <a href="#atom-namespace">Atom namespace</a> to <var title="">R</var>.</li>
+
+   <li>
+
+    <p>For each element <var title="">candidate</var> that is, or is a
+    descendant of, an <code><a href="#the-address-element">address</a></code> element that <a href="#applyToSection">applies</a> to <a href="#the-body-element-0">the <code>body</code>
+    element</a>, and that is an <a href="#concept-item" title="concept-item">item</a> that has the type <code title="md-vcard"><a href="#md-vcard">vcard</a></code>, if there is a property <var title="">property</var> named <code title="md-vcard-fn"><a href="#md-vcard-fn">fn</a></code>
+    whose <a href="#concept-item-corresponding" title="concept-item-corresponding">corresponding
+    item</a> is <var title="">candidate</var>, and the <a href="#concept-property-value" title="concept-property-value">value</a> of <var title="">property</var> is not an <a href="#concept-item" title="concept-item">item</a>, then append an <code title="">author</code> element in the <a href="#atom-namespace">Atom namespace</a>
+    to the root element of <var title="">R</var> whose contents is a
+    text node with its data set to the <a href="#concept-property-value" title="concept-property-value">value</a> of <var title="">property</var>.</p>
+
+   </li>
+
+   <li>
+
+    <p>If there is a <code><a href="#the-link-element">link</a></code> element whose <code title="attr-link-rel"><a href="#attr-link-rel">rel</a></code> attribute's value includes the
+    keyword <code title="rel-icon"><a href="#rel-icon">icon</a></code>, and that element also
+    has an <code title="attr-link-href"><a href="#attr-link-href">href</a></code> attribute, then
+    append an <code title="">icon</code> element in the <a href="#atom-namespace">Atom
+    namespace</a> to the root element of <var title="">R</var>
+    whose contents is a text node with its data set to the
+    <a href="#absolute-url">absolute URL</a> resulting from <a href="#resolve-a-url" title="resolve a
+    url">resolving</a> the value of the <code title="attr-link-href"><a href="#attr-link-href">href</a></code> attribute relative to the
+    <code><a href="#the-link-element">link</a></code> element.</p>
+
+    <!-- could check ratio, could check type... -->
+
+   </li>
+
+   <li>
+
+    <p>Append an <code title="">id</code> element in the <a href="#atom-namespace">Atom
+    namespace</a> to the root element of <var title="">R</var>
+    whose contents is a text node with its data set to <a href="#the-document-s-current-address">the
+    document's current address</a>.</p>
+
+   </li>
+
+   <li>
+
+    <p>Optionally: Let <var title="">x</var> be a <code title="">link</code> element in the <a href="#atom-namespace">Atom
+    namespace</a>. Add a <code title="">rel</code> attribute whose
+    value is the string "<code title="">self</code>" to <var title="">x</var>. Append a text node with its data set to the
+    (user-agent defined) <a href="#the-document-s-address" title="the document's
+    address">address</a> of <var title="">R</var> to <var title="">x</var>. Append <var title="">x</var> to the root element
+    of <var title="">R</var>.</p>
+
+    <p class="note">This step would be skipped when the document <var title="">R</var> has no convenient <a href="#the-document-s-address" title="the document's
+    address">address</a>. The presence of the <code title="">rel="self"</code> link is a "should"-level requirement in
+    the Atom specification.</p>
+
+   </li>
+
+   <li>
+
+    <p>Let <var title="">x</var> be a <code title="">link</code>
+    element in the <a href="#atom-namespace">Atom namespace</a>. Add a <code title="">rel</code> attribute whose value is the string "<code title="">alternate</code>" to <var title="">x</var>. Add a <code title="">type</code> attribute whose value is the string "<code title="">text/html</code>" to <var title="">x</var>. Append a text
+    node with its data set to <a href="#the-document-s-current-address">the document's current
+    address</a> to <var title="">x</var>. Append <var title="">x</var> to the root element of <var title="">R</var>.</p>
+
+   </li>
+
+   <li>
+
+    <p>Let <var title="">x</var> be a <code title="">link</code>
+    element in the <a href="#atom-namespace">Atom namespace</a>. Add a <code title="">rel</code> attribute whose value is the string "<code title="">alternate</code>" to <var title="">x</var>. If the
+    document being converted is an <a href="#html-documents" title="HTML documents">HTML
+    document</a>, add a <code title="">type</code> attribute whose
+    value is the string "<code title="">text/html</code>" to <var title="">x</var>. Otherwise, the document being converted is an
+    <a href="#xml-documents" title="XML documents">XML document</a>; add a <code title="">type</code> attribute whose value is the string "<code title="">application/xhtml+xml</code>" to <var title="">x</var>. Append a text node with its data set to
+    <a href="#the-document-s-current-address">the document's current address</a> to <var title="">x</var>. Append <var title="">x</var> to the root element
+    of <var title="">R</var>.</p>
+
+   </li>
+
+   <li><p>Let <var title="">subheading text</var> be the empty
+   string.</li>
+
+   <li><p>Let <var title="">heading</var> be the first element of
+   <a href="#heading-content-0">heading content</a> whose nearest ancestor of
+   <a href="#sectioning-content-0">sectioning content</a> is the <a href="#the-body-element-0">the body
+   element</a>, if any, or null if there is none.</li>
+
+   <li>
+
+    <p>Take the appropriate action from the following list, as
+    determined by the type of the <var title="">heading</var>
+    element:</p>
+
+    <dl><dt>If <var title="">heading</var> is null</dt>
+
+     <dd>
+
+      <p>Let <var title="">heading text</var> be the
+      <code><a href="#textcontent">textContent</a></code> of <a href="#the-title-element-0">the <code>title</code>
+      element</a>, if there is one, or the empty string
+      otherwise.</p>
+
+     </dd>
+
+     <dt>If <var title="">heading</var> is a <code><a href="#the-hgroup-element">hgroup</a></code> element</dt>
+
+     <dd>
+
+      <p>If <var title="">heading</var> contains no child
+      <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&ndash;<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> elements, let <var title="">heading text</var> be the empty string.</p>
+
+      <p>Otherwise, let <var title="">headings list</var> be a list of
+      all the <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&ndash;<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element children
+      of <var title="">heading</var>, sorted first by descending
+      <a href="#rank">rank</a> and then in <a href="#tree-order">tree order</a> (so
+      <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>s first, then <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code>s, etc, with each
+      group in the order they appear in the document). Then, let <var title="">heading text</var> be the <code><a href="#textcontent">textContent</a></code> of
+      the first entry in <var title="">headings list</var>, and if
+      there are multiple entries, let <var title="">subheading
+      text</var> be the <code><a href="#textcontent">textContent</a></code> of the second entry
+      in <var title="">headings list</var>.</p>
+
+     </dd>
+
+     <dt>If <var title="">heading</var> is an <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&ndash;<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element</dt>
+
+     <dd>
+
+      <p>Let <var title="">heading text</var> be the
+      <code><a href="#textcontent">textContent</a></code> of <var title="">heading</var>.</p>
+
+     </dd>
+
+    </dl></li>
+
+   <li>
+
+    <p>Append a <code title="">title</code> element in the <a href="#atom-namespace">Atom
+    namespace</a> to the root element of <var title="">R</var>
+    whose contents is a text node with its data set to <var title="">heading text</var>.</p>
+
+   </li>
+
+   <li>
+
+    <p>If <var title="">subheading text</var> is not the empty string,
+    append a <code title="">subtitle</code> element in the <a href="#atom-namespace">Atom
+    namespace</a> to the root element of <var title="">R</var>
+    whose contents is a text node with its data set to <var title="">subheading text</var>.</p>
+
+   </li>
+
+   <li><p>Let <var title="">global update date</var> have no
+   value.</li>
+
+   <li>
+
+    <p>For each <code><a href="#the-article-element">article</a></code> element <var title="">article</var> that does not have an ancestor
+    <code><a href="#the-article-element">article</a></code> element, run the following steps:</p>
+
+    <ol><li><p>Let <var title="">E</var> be an <code title="">entry</code> element in the <a href="#atom-namespace">Atom namespace</a>,
+     and append <var title="">E</var> to the root element of <var title="">R</var>.</li>
+
+     <li><p>Let <var title="">heading</var> be the first element of
+     <a href="#heading-content-0">heading content</a> whose nearest ancestor of
+     <a href="#sectioning-content-0">sectioning content</a> is <var title="">article</var>,
+     if any, or null if there is none.</li>
+
+     <li>
+
+      <p>Take the appropriate action from the following list, as
+      determined by the type of the <var title="">heading</var>
+      element:</p>
+
+      <dl><dt>If <var title="">heading</var> is null</dt>
+
+       <dd>
+
+        <p>Let <var title="">heading text</var> be the empty
+        string.</p>
+
+       </dd>
+
+       <dt>If <var title="">heading</var> is a <code><a href="#the-hgroup-element">hgroup</a></code> element</dt>
+
+       <dd>
+
+        <p>If <var title="">heading</var> contains no child
+        <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&ndash;<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> elements, let <var title="">heading text</var> be the empty string.</p>
+
+        <p>Otherwise, let <var title="">headings list</var> be a list
+        of all the <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&ndash;<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element
+        children of <var title="">heading</var>, sorted first by
+        descending <a href="#rank">rank</a> and then in <a href="#tree-order">tree
+        order</a> (so <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>s first, then
+        <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code>s, etc, with each group in the order they
+        appear in the document). Then, let <var title="">heading
+        text</var> be the <code><a href="#textcontent">textContent</a></code> of the first entry
+        in <var title="">headings list</var>.</p>
+
+       </dd>
+
+       <dt>If <var title="">heading</var> is an <code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&ndash;<code><a href="#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element</dt>
+
+       <dd>
+
+        <p>Let <var title="">heading text</var> be the
+        <code><a href="#textcontent">textContent</a></code> of <var title="">heading</var>.</p>
+
+       </dd>
+
+      </dl></li>
+
+     <li>
+
+      <p>Append a <code title="">title</code> element in the
+      <a href="#atom-namespace">Atom namespace</a> to <var title="">E</var> whose
+      contents is a text node with its data set to <var title="">heading text</var>.</p>
+
+     </li>
+
+     <li>
+
+      <p>For each element <var title="">candidate</var> that is, or is
+      a descendant of, an <code><a href="#the-address-element">address</a></code> element that <a href="#applyToSection">applies</a> to <var title="">article</var>, and that is an <a href="#concept-item" title="concept-item">item</a> that has the type <code title="md-vcard"><a href="#md-vcard">vcard</a></code>, if there is a property <var title="">property</var> named <code title="md-vcard-fn"><a href="#md-vcard-fn">fn</a></code> whose <a href="#concept-item-corresponding" title="concept-item-corresponding">corresponding item</a> is
+      <var title="">candidate</var>, and the <a href="#concept-property-value" title="concept-property-value">value</a> of <var title="">property</var> is not an <a href="#concept-item" title="concept-item">item</a>, then append an <code title="">author</code> element in the <a href="#atom-namespace">Atom
+      namespace</a> to <var title="">E</var> whose contents is a
+      text node with its data set to the <a href="#concept-property-value" title="concept-property-value">value</a> of <var title="">property</var>.</p>
+
+     </li>
+
+     <li>
+
+      <p>Clone <var title="">article</var> and its descendants into an
+      environment that has <a href="#concept-bc-noscript" title="concept-bc-noscript">scripting
+      disabled</a>, has no <a href="#plugin" title="plugin">plugins</a>, and
+      fails any attempt to <a href="#fetch" title="fetch">fetch</a> any
+      resources. Let <var title="">cloned article</var> be the
+      resulting clone <code><a href="#the-article-element">article</a></code> element.</p>
+
+     </li>
+
+     <li>
+
+      <p>Remove from the subtree rooted at <var title="">cloned
+      article</var> any <code><a href="#the-article-element">article</a></code> elements other than the
+      <var title="">cloned article</var> itself, any
+      <code><a href="#the-header-element">header</a></code>, <code><a href="#the-footer-element">footer</a></code>, or <code><a href="#the-nav-element">nav</a></code>
+      elements whose nearest ancestor of <a href="#sectioning-content-0">sectioning
+      content</a> is the <var title="">cloned article</var>, and
+      the first element of <a href="#heading-content-0">heading content</a> whose nearest
+      ancestor of <a href="#sectioning-content-0">sectioning content</a> is the <var title="">cloned article</var>, if any.</p>
+
+     </li>
+
+     <li>
+
+      <p>If <var title="">cloned article</var> contains any
+      <code><a href="#the-ins-element">ins</a></code> or <code><a href="#the-del-element">del</a></code> elements with <code title="attr-mod-datetime"><a href="#attr-mod-datetime">datetime</a></code> attributes whose
+      values <a href="#parse-a-global-date-and-time-string" title="parse a global date and time string">parse
+      as global date and time strings</a> without errors, then let
+      <var title="">update date</var> be the value of the <code title="attr-mod-datetime"><a href="#attr-mod-datetime">datetime</a></code> attribute that parses
+      to the newest <a href="#concept-datetime" title="concept-datetime">global date and
+      time</a>.</p>
+
+      <p>Otherwise, let <var title="">update date</var> have no
+      value.</p>
+
+      <p class="note">This value is used below; it is calculated here
+      because in certain cases the next step mutates the <var title="">cloned article</var>.</p>
+
+     </li>
+
+     <li>
+
+      <p>If the document being converted is an <a href="#html-documents" title="HTML
+      documents">HTML document</a>, then: Let <var title="">x</var>
+      be a <code title="">content</code> element in the <a href="#atom-namespace">Atom
+      namespace</a>. Add a <code title="">type</code> attribute
+      whose value is the string "<code title="">html</code>" to <var title="">x</var>. Append a text node with its data set to the
+      result of running the <a href="#html-fragment-serialization-algorithm">HTML fragment serialization
+      algorithm</a> on <var title="">cloned article</var> to <var title="">x</var>. Append <var title="">x</var> to <var title="">E</var>.</p>
+
+      <p>Otherwise, the document being converted is an <a href="#xml-documents" title="XML documents">XML document</a>: Let <var title="">x</var> be a <code title="">content</code> element in
+      the <a href="#atom-namespace">Atom namespace</a>. Add a <code title="">type</code> attribute whose value is the string "<code title="">xml</code>" to <var title="">x</var>. Append a
+      <code><a href="#the-div-element">div</a></code> element to <var title="">x</var>. Move all the
+      child nodes of the <var title="">cloned article</var> node to
+      that <code><a href="#the-div-element">div</a></code> element, preserving their relative
+      order. Append <var title="">x</var> to <var title="">E</var>.</p>
+
+     </li>
+
+     <li>
+
+      <p>Establish the value of <var title="">id</var> and <var title="">has-alternate</var> from the first of the following to
+      apply:</p>
+
+      <dl><dt>If the <var title="">article</var> node has a <code title="attr-article-cite"><a href="#attr-article-cite">cite</a></code> attribute</dt>
+
+       <dd>Let <var title="">id</var> be the <a href="#absolute-url">absolute URL</a>
+       resulting from <a href="#resolve-a-url" title="resolve a url">resolving</a> the
+       value of the <code title="attr-article-cite"><a href="#attr-article-cite">cite</a></code>
+       relative to the <var title="">article</var> element. Let <var title="">has-alternate</var> be true.</dd>
+
+       <dt>If the <var title="">article</var> node has a descendant
+       <code><a href="#the-a-element">a</a></code> or <code><a href="#the-area-element">area</a></code> element with an <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code> attribute and a <code title="attr-a-rel">rel</code> attribute whose value includes
+       the <code title="rel-bookmark"><a href="#link-type-bookmark">bookmark</a></code> keyword</dt>
+
+       <dd>Let <var title="">id</var> be the <a href="#absolute-url">absolute URL</a>
+       resulting from <a href="#resolve-a-url" title="resolve a url">resolving</a> the
+       value of the <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code>
+       attribute of the first such <code><a href="#the-a-element">a</a></code> ot <code><a href="#the-area-element">area</a></code>
+       element, relative to the element. Let <var title="">has-alternate</var> be true.</dd>
+
+       <dt>If the <var title="">article</var> node has an <code title="attr-id"><a href="#the-id-attribute">id</a></code> attribute</dt>
+
+       <dd>Let <var title="">id</var> be <a href="#the-document-s-current-address">the document's current
+       address</a>, with the fragment identifier (if any) removed,
+       and with a new fragment identifier specified, consisting of the
+       value of the <var title="">article</var> element's <code title="attr-id"><a href="#the-id-attribute">id</a></code> attribute. Let <var title="">has-alternate</var> be false.</dd>
+
+       <dt>Otherwise</dt>
+
+       <dd>Let <var title="">id</var> be a user-agent defined
+       undereferencable yet globally unique <a href="#absolute-url">absolute
+       URL</a>. Let <var title="">has-alternate</var> be
+       false.</dd>
+
+      </dl></li>
+
+     <li>
+
+      <p>Append an <code title="">id</code> element in the <a href="#atom-namespace">Atom
+      namespace</a> to <var title="">E</var> whose contents is a
+      text node with its data set to <var title="">id</var>.</p>
+
+     </li>
+
+     <li>
+
+      <p>If <var title="">has-alternate</var> is true: Let <var title="">x</var> be a <code title="">link</code> element in the
+      <a href="#atom-namespace">Atom namespace</a>. Add a <code title="">rel</code>
+      attribute whose value is the string "<code title="">alternate</code>" to <var title="">x</var>. Append a
+      text node with its data set to <var title="">id</var> to <var title="">x</var>. Append <var title="">x</var> to <var title="">E</var>.</p>
+
+     </li>
+
+     <li>
+
+      <p>If <var title="">article</var> has a <code title="attr-article-pubdate"><a href="#attr-article-pubdate">pubdate</a></code> attribute, and <a href="#parse-a-global-date-and-time-string" title="parse a global date and time string">parsing that
+      attribute's value as a global date and time string</a> does
+      not result in an error, then let <var title="">publication
+      date</var> be the value of that attribute.</p>
+
+      <p>Otherwise, let <var title="">publication date</var> have no
+      value.</p>
+
+     </li>
+
+     <li>
+
+      <p>If <var title="">update date</var> has no value but <var title="">publication date</var> does, then let <var title="">update date</var> have the value of <var title="">publication date</var>.</p>
+
+      <p>Otherwise, if <var title="">publication date</var> has no
+      value but <var title="">update date</var> does, then let <var title="">publication date</var> have the value of <var title="">update date</var>.</p>
+
+     </li>
+
+     <li>
+
+      <p>If <var title="">update date</var> has a value, and <var title="">global update date</var> has no value or is less recent
+      than <var title="">update date</var>, then let <var title="">global update date</var> have the value of <var title="">update date</var>.</p>
+
+     </li>
+
+     <li>
+
+      <p>If <var title="">publication date</var> and <var title="">update date</var> both still have no value, then let
+      them both value a value that is a <a href="#valid-global-date-and-time-string">valid global date and
+      time string</a> representing the <a href="#concept-datetime" title="concept-datetime">global date and time</a> of the
+      moment that this algorithm was invoked.</p>
+
+     </li>
+
+     <li>
+
+      <p>Append an <code title="">published</code> element in the
+      <a href="#atom-namespace">Atom namespace</a> to <var title="">E</var> whose
+      contents is a text node with its data set to <var title="">publication date</var>.</p>
+
+     </li>
+
+     <li>
+
+      <p>Append an <code title="">updated</code> element in the
+      <a href="#atom-namespace">Atom namespace</a> to <var title="">E</var> whose
+      contents is a text node with its data set to <var title="">update date</var>.</p>
+
+     </li>
+
+    </ol></li>
+
+   <li>
+
+    <p>If <var title="">global update date</var> has no value, then
+    let it have a value that is a <a href="#valid-global-date-and-time-string">valid global date and time
+    string</a> representing the <a href="#concept-datetime" title="concept-datetime">global date and time</a> of the date
+    and time of the <code>Document</code>'s source file's last
+    modification, if it is known, or else of the moment that this
+    algorithm was invoked.</p>
+
+   </li>
+
+   <li>
+
+    <p>Insert an <code title="">updated</code> element in the
+    <a href="#atom-namespace">Atom namespace</a> into the root element of <var title="">R</var> before the first <code title="">entry</code> in
+    the <a href="#atom-namespace">Atom namespace</a> whose contents is a text node with
+    its data set to <var title="">global update date</var>.</p>
+
+   </li>
+
+   <li><p>Return the Atom document <var title="">R</var>.</li>
+
+  </ol><p>The <dfn id="atom-namespace">Atom namespace</dfn> is: <code>http://www.w3.org/2005/Atom</code><h2 id="browsers"><span class="secno">6 </span>Web browsers</h2><div class="impl">
 
   <p>This section describes features that apply most directly to Web
   browsers. Having said that, unless specified elsewhere, the

Received on Friday, 22 May 2009 05:57:46 UTC