<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="/gus_xslt.xsl"?>
<gus_xslt
  xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://starling.ws/XML/howto.xsd">&#160;        
<head>
  <description>How to create an Atom feed.</description>
  <navigation ToC="Table of Contents" section="yes" topic="yes" subtopic="no" subsubtopic="no" links="yes"/>
  <syndication atom="http://starling.us/cgi-bin/gus_atom_xsl.pl?atom=starling_us_atom.xml!sort_order=Title"/>
  <cgi img="yes" img_action="/cgi-bin/gus_web_photo.pl" img_path="/atom/" />
  <pdfmarks body="no" section="no" topic="no" subtopic="no" subsubtopic="no"/>
  <title>Atom Feeds</title>
  <keywords>Starling, XML, Atom</keywords>
  <author>Ĝan Ŭesli Starling</author>
  <copyright>2007, Ĝan Ŭesli Starling</copyright>
</head>
<body>
  <title>How to Create an Atom Feed</title>
  <p class="center"><a class="button" href="http://starling.us/gus_netbsd/">&#160;home: http://starling.us/gus_netbsd&#160;</a>
  <br/>
  <br/>copyright 2007 by Ĝan Ŭesli Starling</p>
  <p></p>
  
<!-- 
  ← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ⇦ ⇧ ⇨ ⇩ 
  º “ ” ‘ ’ Ĝ ĝ Ĥ ĥ Ĵ ĵ Ŝ ŝ Ŭ ŭ
  ―
-->
        
  <!-- SECTION DELIMITER -->  
    
  <section>
    <title>Atom Feeds</title>
    <p>This is a really simple how-to. It may look like a lot, but not to worry. You won’t be needing most of it, not unless you want to be sort of fancy. About half details extra frills which you may not much care about. And some of what remains describes what not to do in very exacting detail. Feel free to either skip or skim through those. Let the <code>Table of Contents</code> be your guide.</p>
    <p>My history on this topic is as follows: I first got interested in the idea of news feeds late in 2003. It seemed a really cool idea, very modern and state-of-the-art for Internet trends. The hot protocol then was <code>RSS</code>. And my interest is evidenced by the third photo in <a class="button" href="http://starling.us/skajler/2003_christmas_eve/">Link</a> where I am happily displaying one of my gifts of the season...the O&#8217;Reilly manual for <code>RSS</code> wherein I learnt of the then-warring camps among newsfeed proponents...all those competing protocols. So I put it off for some years.</p>
    <p>Now is time and I have elected to go with the <code>Atom 1.0</code> protocol on account of its being supported by the <code>IETF</code> <note>(Internet Engineering Task Force)</note>, a standards governing body.</p>

  </section>
  
  <!-- SECTION DELIMITER -->  
  
  <section>
    <title>Example Atom Feed</title>
	<p>Here for your casual study is the format of my own <code>Atom</code> feed. It is pretty simple, as you can see.</p>

<pre>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
<note>&lt;?xml-stylesheet type="text/xsl" href="http://your_own_domain.net/your_xslt.xsl"?&gt;</note>
&lt;feed xmlns="http://www.w3.org/2005/Atom"&gt;
  &lt;id&gt;<warn>http://your_own_domain.net/atom.xml</warn>&lt;/id&gt;
  &lt;title&gt;<note>Title of Your Atom Feed</note>&lt;/title&gt;
  &lt;updated&gt;<warn>2007-01-01T00:00:02Z</warn>&lt;/updated&gt;
  &lt;link rel="self" href="<warn>http://your_own_domain.net/atom.xml</warn>" type="application/atom+xml" /&gt;

  &lt;author&gt;
    &lt;name&gt;<note>Your Own Name</note>&lt;/name&gt;
    &lt;uri&gt;<note>http://your_own_domain.net</note>&lt;/uri&gt;
    &lt;email&gt;<note>you@wherever.com</note>&lt;/email&gt;
  &lt;/author&gt;
  
  &lt;entry&gt;
    &lt;title&gt;<note>Some Title</note>&lt;/title&gt;
    &lt;category term="<note>Some Category</note>"/&gt; 
    &lt;id&gt;<warn>http://your_own_domain.net/some/path/whatever.html</warn>&lt;/id&gt;
    &lt;published&gt;<note>2007-01-01T00:00:00Z</note>&lt;/published&gt;
    &lt;updated&gt;<warn>2007-01-01T00:00:00Z</warn>&lt;/updated&gt;
    &lt;link href="<note>http://your_own_domain.net/some/path/whatever.html</note>"/&gt;
    &lt;summary&gt;<note>Some few details here.</note>&lt;/summary&gt;
    &lt;content&gt;<note>A somewhat more detailed, but still none-too-lengthy excerpt from the linked-to document here.</note>
    &lt;/content&gt;
  &lt;/entry&gt;

&lt;/feed&gt;
</pre>

    <p>Note in particular the <code>entry</code> node, that is to say the <code>&lt;entry&gt;</code> and <code>&lt;/entry&gt;</code> tags plus everything between. A real feed has more than just one set of those, usually quite a few in fact. Entries are the main component of any feed.</p>
    <p>Now take note of the colored parts. Those parts colored <warn>red</warn> are items you have to be really careful about. Do them wrong and your <code>Atom</code> feed will be invalid. Some of the others, those colored <note>teal</note> are nowhere near so critical. Some whole nodes are even optional. These distinctions I will explain in the topics below.</p>

    <topic>
      <title>Critical Aspects</title>
      <p>Those parts which I show in <warn>red</warn> have to be formatted just so. Be very careful that...</p>
      <ul>
        <li>All text should be <code>Unicode</code>, unless you change the <code>encoding</code> attribute in the very top-most node. That is what the <code>encoding="UTF&#8211;8"</code> stands for, <code>Unicode Text Format, 8-bit</code>. Not to worry, though. Know that <code>Unicode</code> is a super-set of plain <code>ASCII</code>. So if you edit your <code>Atom</code> feed in a plain text editor you will generally be okay. Avoid word-processors like the plague. Your average word-processor will embed all kinds of invisible markers which are pure gobble-de-gook to any other program except itself. So on <code>UNIX</code> use <code>Gedit</code> or <code>VI</code> or some such. On <code>Win32</code> use <code>TextPad</code> or <code>Notepad</code> or such like.</li>
        <li>Each and every <code>&lt;id&gt;</code> node must be both unique and permanent. That goes for the <code>&lt;id&gt;</code> of the feed itself and the <code>&lt;id&gt;</code>'s of each individual <code>&lt;entry&gt;</code> node. 
          <ul>
            <li>You can use a web <code>URL</code> since that will be unique.</li>
            <li>But do not ever change an <code>&lt;entry&gt;</code>&#8217;s individually embeded <code>&lt;id&gt;</code> ever. Not even if later you change the <code>&lt;link&gt;</code> which is pointed to.</li>
            <li>Since I own my own domain it almost never happens that I move or rename a file. To do so would cost me standing on Google, Yahoo, et al. So my <code>URL</code>&#8217;s are at about as permanent as I am myself. And beyond that I shall not worry.</li>
            <li>Better alternatives exist to be used in place of a <code>URL</code> for all your <code>&lt;id&gt;</code> nodes. They are, however, more complicated, requiring detailed explanation. So those I&#8217;ll go into separately further down this same page.</li>
          </ul>
        </li>
        <li>Each and every <code>&lt;updated&gt;</code> node must likewise be unique. Those each must represent a unique (to this <code>Atom</code> document) date and time. 
          <ul>
            <li>An <code>Atom</code> validator will rightly refuse to believe that you are capable of updating two documents exactly at the same time down to the very second.</li>
            <li>The date portion must absolutely be in the format of <code>CCYY-MM-DD</code>, such that the birthday of the USA would be on <code>1776-07-04</code> or the attack on Pearl Harbor on <code>1941-12-07</code> or Y2K at midnight on <code>2000-01-01</code>. You get the idea.</li>
            <li>The <code>T</code> delimits between date and time. The <code>Z</code> stands for <code>Zulu</code> time in US military parlance...and <code>Zed</code> time to a Brit or an Aussie. To short wave radio listeners and ham radio operators <note>(like myself, call sign KY8D)</note> it might be known as <code>GMT</code> <note>(Greenwich Mean Time)</note> or <code>UTC</code> <note>(Universal Coordinated Time)</note>. But for the purposes of <code>XML</code> we must denote it with the <code>Z</code>.</li>
            <li>The <code>Atom</code> protocol does allow for time offsets. But why add to the confusion?</li>
            <li>If you run a <code>UNIX</code> system, just do <code>date -u</code> on the <code>CLI</code> to get <code>UTC</code> time. I expect that <code>Win32</code> must have a similar function.</li>
          </ul>
        </li>
      </ul>
      <br/>
	</topic>

    <topic>
      <title>Non-critical Aspects</title>
      <p>Those parts which I show in <note>teal</note> can be either omitted (if they are nodes) or treated loosely, if they are ordinary text. Be aware that...</p>
      <ul>
        <li>The <code>&lt;?xml-stylesheet ... ?/&gt;</code> node is optional. You only need it if you have an <code>XSLT</code> or <code>CSS</code> stylesheet for governing how your <code>Atom</code> feed should appear if viewed directly using a web browser such as <code>Firefox</code> or <code>MSIE</code>. Stylesheets are optional because <code>Atom/RSS</code> feeds are usually viewed with feed-readers, not web browsers. But I like to cover all bases. So I wrote my own <code>XSLT</code> stylesheet.</li>
        <li>The rest of the format should be pretty obvious. A <code>&lt;link ... &gt;</code> node should contain a link <code>URL</code> to the file you are linking to. Both summary and content nodes are obvious enough.</li>
      </ul>
      <br/>
	</topic>

    <topic>
      <title>Critical Browser Quirks</title><inlink>browser_quirk</inlink>
      <p>Here is a case of what can happen when you elect to do job too completely. Below I give you a more-than-valid <code>Atom</code> feed. Compare it to the one above and you will find but a single difference. This one is better, too good, in fact. The feed below is too exacting. How so? It is over-compliant with the published <code>XML</code> standards for having made proper use of <code>XML namespaces</code>.</p>
      <p>Know that such use of namespaces is not only perfectly valid but otherwise generally encouraged. This being the case, all <code>Atom</code> protocol validating engines will proclaim the <code>Atom</code> feed shown below to be perfectly valid. At least one other <code>Atom</code> tutorial will exemplify this practice.</p> 
      <p>But, alas, there exists a big problem. The authors of both <code>Firefox&#160;2.0</code> and <code>MSIE&#160;7</code> browsers seem not to have read the <code>XML</code> standards <note>(of which both <code>Atom</code> and <code>RSS</code> are minor subsets)</note>. Thus a quirk exists in that both browsers will properly auto-discover feeds this exacting, but improperly, they will both fail to load them. One of the two will even proclaim such a feed <i>not valid</i>. It will be lying. No other <code>Atom</code> tutorial mentions this quirk. So it took me a couple of days to puzzle it out on my own.</p>
      <p>In short, however perfectly correct the example which fillows might otherwise be... <b>Do <warn>not</warn> do as shown below...</b></p>      

<pre>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
<note>&lt;?xml-stylesheet type="text/xsl" href="http://your_own_domain.net/your_xslt.xsl"?&gt;</note>
&lt;<warn>atom:</warn>feed xmlns<warn>:atom</warn>="http://www.w3.org/2005/Atom"&gt;
  &lt;<warn>atom:</warn>id&gt;<note>http://your_own_domain.net/atom.xml</note>&lt;/<warn>atom:</warn>id&gt;
  &lt;<warn>atom:</warn>title&gt;<note>Title of Your Atom Feed</note>&lt;/<warn>atom:</warn>title&gt;
  &lt;<warn>atom:</warn>published&gt;<note>2007-01-01T00:00:02Z</note>&lt;/<warn>atom:</warn>published&gt;
  &lt;<warn>atom:</warn>updated&gt;<note>2007-01-01T00:00:02Z</note>&lt;/<warn>atom:</warn>updated&gt;
  &lt;<warn>atom:</warn>link rel="self" href="<note>http://your_own_domain.net/atom.xml</note>" type="application/atom+xml" /&gt;

  &lt;<warn>atom:</warn>author&gt;
    &lt;<warn>atom:</warn>name&gt;<note>Your Own Name</note>&lt;/<warn>atom:</warn>name&gt;
    &lt;<warn>atom:</warn>uri&gt;<note>http://your_own_domain.net</note>&lt;/<warn>atom:</warn>uri&gt;
    &lt;<warn>atom:</warn>email&gt;<note>you@wherever.com</note>&lt;/<warn>atom:</warn>email&gt;
  &lt;/<warn>atom:</warn>author&gt;
  
  &lt;<warn>atom:</warn>entry&gt;
    &lt;<warn>atom:</warn>title&gt;<note>Some Title</note>&lt;/<warn>atom:</warn>title&gt;
    &lt;<warn>atom:</warn>category term="<note>Some Category</note>"/&gt; 
    &lt;<warn>atom:</warn>id&gt;<note>http://your_own_domain.net/some/path/whatever.html</note>&lt;/<warn>atom:</warn>id&gt;
    &lt;<warn>atom:</warn>updated&gt;<note>2007-01-01T00:00:00Z</note>&lt;/atom:updated&gt;
    &lt;<warn>atom:</warn>link href="<note>http://your_own_domain.net/some/path/whatever.html</note>"/&gt;
    &lt;<warn>atom:</warn>summary&gt;<note>Some few details here.</note>&lt;/<warn>atom:</warn>summary&gt;
    &lt;<warn>atom:</warn>content&gt;<note>A somewhat more detailed, but still none-too-lengthy excerpt from the linked-to document here.</note>
    &lt;/<warn>atom:</warn>content&gt;
  &lt;/<warn>atom:</warn>entry&gt;

&lt;/<warn>atom:</warn>feed&gt;
</pre> 
      
	</topic>
  </section>
  
  <!-- SECTION DELIMITER -->  
  
  <section>
    <title>For Even Better ID-Tags</title>
    <p>In the top-most <code>Atom</code> feed example here presented, I employed permanent <code>URL</code>&#8217;s as <code>&lt;id&gt;</code> nodes. That could easliy work for me because I own my domains with every intention of maintaining them in perpetuity. But what if I did not? How then to insure that my <code>&lt;id&gt;</code> tags shall always remain unique? This can be done by following a different procedure.</p>
    <p>Suppose, for instance, I wanted to compose a guaranateed-unique <code>&lt;id&gt;</code> node for a link pointing to the anchor tag <code>&lt;a id="sublink_3"&gt;</code> somewhere within an <code>index.html</code> file. I would begin with said linked-to <code>URL</code> and modify it slightly like so...</p>
    
    <ol>
      <li>Throw away the protocol...
        <ul>
          <li><code><b><warn>http://</warn></b>your_own_domain.net/whatever/index.html#sublink_3</code> &#160;&#160;&#160;becomes&#160;&#160;&#160;  <code>your_own_domain.net/whatever/index.html#sublink_3</code></li>
        </ul>  
      </li>
      <li>Swap out pound signs <note>(#)</note>, if any, for slashes <note>(/)</note>...
        <ul>
          <li><code>your_own_domain.net/whatever/index.html<b><warn>#</warn></b>sublink_3</code> &#160;&#160;&#160;becomes&#160;&#160;&#160;  <code>your_own_domain.net/whatever/index.html<b><warn>/</warn></b>sublink_3</code></li>
        </ul>  
      </li>
      <li>Embed a comma, date <note>(as CCYY-MM-DD)</note> and a colon... 
        <ul>
          <li><code>your_own_domain.net/whatever/index.html/sublink_3</code> &#160;&#160;&#160;becomes&#160;&#160;&#160;  <code>your_own_domain.net<b><warn>,2007-02-19:</warn></b>/whatever/index.html/sublink_3</code></li>
        </ul>  
      </li>
      <li>Add the tag-URI prefix and a colon...
        <ul>
          <li><code>your_own_domain.net,2007-02-19:/whatever/index.html/sublink_3</code> &#160;&#160;&#160;becomes&#160;&#160;&#160;  <code><b><warn>tag:</warn></b>your_own_domain.net,2007-02-19:/whatever/index.html/sublink_3</code></li>
        </ul>  
      </li>
    </ol>    
    
    <p>And that would be that. The <code>Atom</code> feed would then have had <code>&lt;id&gt;</code> nodes which looked like these...</p>
    
<pre>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
<note>&lt;?xml-stylesheet type="text/xsl" href="http://your_own_domain.net/your_xslt.xsl"?&gt;</note>
&lt;feed xmlns="http://www.w3.org/2005/Atom"&gt;
  &lt;id&gt;<warn>tag:your_own_domain.net,2007-01-01:/atom.xml</warn>&lt;/id&gt;
  &lt;title&gt;<note>Title of Your Atom Feed</note>&lt;/title&gt;
  &lt;updated&gt;<note>2007-01-01T00:00:02Z</note>&lt;/updated&gt;
  &lt;link rel="self" href="<note>http://your_own_domain.net/atom.xml</note>" type="application/atom+xml" /&gt;

  &lt;author&gt;
    &lt;name&gt;<note>Your Own Name</note>&lt;/name&gt;
    &lt;uri&gt;<note>http://your_own_domain.net</note>&lt;/uri&gt;
    &lt;email&gt;<note>you@wherever.com</note>&lt;/email&gt;
  &lt;/author&gt;
  
  &lt;entry&gt;
    &lt;title&gt;<note>Some Title</note>&lt;/title&gt;
    &lt;category term="<note>Some Category</note>"/&gt; 
    &lt;id&gt;<warn>tag:your_own_domain.net,2007-01-01:/some/path/index.html/item_link</warn>&lt;/id&gt;
    &lt;published&gt;<note>2007-01-01T00:00:00Z</note>&lt;/published&gt;
    &lt;updated&gt;<note>2007-01-01T00:00:00Z</note>&lt;/updated&gt;
    &lt;link href="<note>http://your_own_domain.net/some/path/index.html#item_link</note>"/&gt;
    &lt;summary&gt;<note>Some few details here.</note>&lt;/summary&gt;
    &lt;content&gt;<note>A somewhat more detailed, but still none-too-lengthy excerpt from the linked-to document here.</note>
    &lt;/content&gt;
  &lt;/entry&gt;

&lt;/feed&gt;
</pre>

  <p>Unless the article you link to is nested within a much larger web page, there will not likely be an inside-the-page, item link such as <code>#foo</code> or <code>#bar</code>. But just possibly you might. So I elected to show how to deal with that.</p>
    
  </section>
  
  <!-- SECTION DELIMITER -->  
  
  <section>
    <title>Validating Feeds</title>
    <p>As with <code>XHTML</code> and all the <code>XML</code> family, it is a good idea to validate your <code>Atom</code> document. You can do that, sort-of, by using the <code>File Open</code> feature of any modern web browser. An even better, more informative way, is to employ an on-line validator.</p>

<p style="line-height:150%;"><b>Feed Validator:</b>
<br/><a class="button" href="http://feedvalidator.org">Link</a> 
&#160;&#160;For <code>Atom</code> and older <code>RSS</code> feeds alike.
</p>
  </section>
  
  <!-- SECTION DELIMITER -->  

  <section>
    <title>Optional Stylesheets</title>
    <p>Why bother with an, admittedly optional, <code>XSLT</code> stylesheet? To save yourself time and effort is one reason. To aid your readers is another. By way of simple demonstration know that you are viewing an <code>XML/XSLT</code> document now. This little howto was very easy to write. It will be even easier to maintain. It is easy because the Table of Contents and all of the button links wrote themselves. Likewise all of the horizontal rules, colorizing, etc. I have a howto for that process also: <a class="button" href="http://starling.us/xml">Link</a>.</p>
    <p>Know also that the <code>Atom</code> protocol is based on <code>XML</code> so both <code>XSLT</code> and <code>CSS</code> stylesheets will work with an <code>Atom</code> feed. No way at all is a stylesheet required, though. Most people read <code>Atom</code> documents in a feed-reader, either a stand-alone utility, or one built into their favorite browser. So stylesheets are just a frill, some eye-candy for the benefit of whoever might (for whatever reason) view your feed with an ordinary web browser...at least the way I write them. You could also target PDF readers, or whatever other format, using an <code>XSLT</code> stylesheet.</p>
    <p>In my own <code>XSLT</code> and <code>CSS</code> stylesheets I only ever target web browsers. It is really quite simple to use both together, embedding  a little bit of <code>CSS</code> within any given <code>XSLT</code> stylesheet. I have two of those: one for plain, browser-destined, <code>XML</code>; and yet another for <code>Atom</code> feeds. See mine below. Feel free to steal from either of them if it please you. If you use them mostly whole, please retain my copyright.</p>

    <topic>
      <title>Browser-viewable Atom Feeds</title>
      <p>Below are links to my <code>XSLT</code> stylesheets and <code>Atom</code> feeds employing such to facilitate browser-viewing.</p>
      <p>You will note that I named this <code>Atom</code> feed using the <code>*.xml</code> extension rather than the <code>*.atom</code> extension. I did this because some experimentation revealed that <code>Firefox</code> would not display an <code>*.atom</code> file no matter what <code>MIME</code> type <code>Apache</code> served it as. I also read elsewhere that this is a known <code>Firefox</code> quirk.</p>           

<p style="line-height:150%;"><b>Enhancements à la XSLT:</b>
<br/><a class="button" href="http://starling.us/gus_xslt.xsl">Link</a> 
&#160;&#160;<b>XSL</b> &#8212; For <code>index.xml</code> docs generally.
<br/><a class="button" href="http://starling.us/gus_atom.xsl">Link</a> 
&#160;&#160;<b>XSL</b> &#8212; For <code>atom.xml</code> docs specifically.
<br/><a class="button" href="http://starling.us/starling_us_atom.xml">Link</a> 
&#160;&#160;<b>Atomic Starling</b> &#8212; An XSLT-enhanced <code>Atom</code> feed
</p>
	  </topic>
	  
    <topic>
      <title>User-resortable Atom Feeds</title>
      <p>As handy as <code>Atom</code> and <code>RSS</code> feeds can be when viewed by a custom reader, when viewed in an ordinary web browser their static quality soon pales. Rather then just let them lie there, all static and rather dead looking, let us make make them re-sortable.</p>    
      <p>I knew that this would be very easy to do using <code>Perl/CGI</code>. Nevertheless I still beat my head against the wall for most of a week trying to make a go of it without resorting to <code>CGI</code>. First I tried to do it in pure <code>XSLT</code>. Utter futility. Browsers do not yet support <code>xsl-import</code> in their <code>XSLT</code> engines. Yet another annoying quirk. Alas, and alack.</p>
      <p>So next I tried to marry <code>XSLT</code> and <code>JavaScript</code>. Googling around I dug up one post where someone else managed this, after more than a month of their own trial-and-error. But it requried browser-sniffing and accomodating competing <code>DOM</code>&#8217;s...to which I am fiercely allergic.</p>       
      <p>After some few days of my own discouraging trial-and-error, I gave up in renewed utter disgust for <code>JavaScript</code> and fell back to trusty <code>Perl/CGI</code>. Here is the result. As always, I release it under the Perl artistic license. Do whatever you like with it.</p>

<p style="line-height:150%;"><b>Enhancements à la Perl/CGI:</b>
<br/><a class="button" href="./gus_atom_xsl_pl.txt">Link</a> 
&#160;&#160;<b>Perl/CGI</b> &#8212; My <code>/cgi-bin/gus_atom_xsl.pl</code> script.
<br/><a class="button" href="http://starling.us/cgi-bin/gus_atom_xsl.pl?atom=starling_us_atom.xml!sort_order=Updated">Link</a> 
&#160;&#160;<b>Atomic Starling</b> &#8212; Same <code>Atom</code> feed, but provided with a re-sort button.
</p>
	  </topic>
	  
	  <topic>
	    <title>Browser-Override Workaround</title>
	    <p>The browsers too have gotten into displaying news feeds. But the way they have done it is both artless and heavy handed. Prior to versions <code>MSIE&#160;7</code> and <code>Firefox&#160;2.0</code> most things <code>XSLT</code>-ish worked as they ought. But in those latter versions that pair have turned artless with respect to both <code>Atom</code> and <code>RSS</code> in failing to check if said feed may not already have a stylesheet and heavy handed in over-riding them with internal defaults.</p>
	    <p>Complaints have been issued. And I expect they will be addressed. But we shall have to await future updates before that should happen. In the meantime the best recourse envolves a cheap trick to bypass this annoying misfeature. Both <code>MSIE&#160;7</code> and <code>Firefox&#160;2.0</code> give up trying to sniff out a feed protocol after reading the first 512&#160;bytes of an <code>XML</code> file.</p>
	    <p>Being now informed of this trip-limit, feed authors employing <code>XSLT</code> are editing their <code>XML</code> to begin with a 512-byte comment. This will often consist of an anti-Firefox/MSIE rant on the problem. I employ an excerpt in Esperanto translation from the first chapter of a Polish novel about ancient Egypt.</p>	    

<pre>	      
&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
&lt;?xml-stylesheet type="text/xsl" href="/gus_atom.xsl"?&gt;<warn>
&lt;!--
                       La Faraono
                   verkis Boleslaw Prus
                      tadukis Kabe

                       Ĉapitro Unu

En la tridektria jaro de la feliĉa regado de Ramses XII, Egipto
festis du solenojn, kiuj plenigis ĝiajn ortodoksajn loĝantojn per
fiero kaj feliĉo. En la monato Meĥir, en decembro, revenis Tebojn,
plen kovrita per multekostaj donacoj, la dio Ĥongu, kiu dum tri
jaroj kaj  naŭ monatoj vojaĝis en la lando Buĥten, resanigis tie
la reĝan filinon Bent-res kaj forpelis la malbonan spiriton ne 
nur el la reĝa familio, sed eĉ el la citadelo de Buĥten.

Nu, jen! Sufiĉas por 512 bitoj. Lasu ke oni vidu mian XSLT-on.
--&gt;</warn>
&lt;feed xmlns="http://www.w3.org/2005/Atom"&gt;	
</pre>
	    
	  </topic>
	  
  </section>
  
  <!-- SECTION DELIMITER -->  
  
  <section>
    <title>Browser Auto-Discovery</title>
    <p>As soon as your feed will validate, you&#8217;ll want for folks to start reading it. The way to make that easy for them is called <i>auto-discovery</i>. What this means is that should someone visit your regular web page, their browser will automatically discover that an <code>Atom</code> feed exists in relation to that ordinary web page. A little orange feed-icon will appear in said browser&#8217;s <code>URL</code> window. Your visitor clicks on said icon and is granted opportunity to <i>subscribe</i> to your feed. It is all very easy.</p>
    <p>For auto-discovery to work, you must embed a new tag in the <code>&lt;head&gt;</code> of the <code>HTML</code> code for that ordinary web page. Such a tag will look like this...</p>
    
<pre>&lt;head&gt;
    &lt;link 
        rel="<warn>alternate</warn>" 
        type="<warn>application/atom+xml</warn>" 
        href="<warn>http://your_own_domain.net/atom.xml</warn>"
        title="<note>Name of Your Feed</note>" /&gt;
&lt;/head&gt;
</pre>    
  
  <p>I broke that tag into separate lines by attribute for clarity. Make yours into a single line if you prefer. Those attributes with  <warn>red</warn> entries are required, that with a <note>teal</note> entry is optional. Web browsers tend to ignore the title, but not all user-agents <note>(hopefully search-engines among them)</note> are so indiscriminating. Taking no chances, I always put it in.</p>  
  
  <p>In fact, with the <code>type="application/atom+xml"</code> attribute in your auto-discovery tag, it won&#8217;t even matter whether you have an <code>AddType</code> for <code>*.atom</code> at all in the <code>httpd.conf</code> of your <code>Apache 2</code> webserver. I found that out while running experiments to puzzle out that infuriating <code>XML namespace</code> browser quirk.</p>
    
  </section>
  
  <!-- SECTION DELIMITER -->  
  
  <section>	
    <title>Configs for Apache</title>
    <p>Note, that for a stylesheet to have effect, your web server must be prepared to serve both the doc and the stylesheet properly. For that to happen, on an <code>Apache</code> web-server at any rate, you need to have entries like these in your <code>httpd.conf</code> configuration file. I just tack them on at the very end.</p>

<pre># Custom changes by me
DirectoryIndex index.html index.xml
AddType text/xml *.xml
AddType text/xml *.xsl
AddType application/atom+xml *.atom 
</pre>

    <p>Those are from my own <code>Apache 2.0</code> web-server. A commercial outfit should already have those set up. But you may, just possibly, have need to remind them. They serve several purposes...</p>
    <ul>
      <li>The <code>DirectoryIndex</code> line says to serve <code>index.xml</code> if <code>index.html</code> is absent in a directory. That allows you to use a <code>URL</code> like just plain <code>http://foobar</code> instead of <code>http://foobar/index.xml</code> in links. It is neater.</li>
      <li>The <code>AddType</code> lines allow the server to inform browsers what to do with certain kinds of files. Without them browsers may not always recognize what they are getting. Viewers might see a query from their browser instead of the page. Such query would ask, <i>Open with...</i> or <i>Download?</i> when trying to view the feed, <code>XML</code> doc, or whatever.</li>
    </ul>
    <br/>
  </section>
  
  <!-- SECTION DELIMITER -->  

  <section>
    <title>Further Information</title>
    <p>Here are some further information web-links to help get you started publishing your own <code>Atom</code> feeds and/or reading the feeds of others.</p>

<p style="line-height:150%;"><b>General info on Atom 1.0 feeds:</b>
<br/><a class="button" title="Atom Enabled" href="http://atomenabled.org">Link</a> 
&#160;&#160;AtomEnabled.org
<br/><a class="button" title="Article" href="http://news.com.com/2100-1032-5157662.html">Link</a> 
&#160;&#160;Google spurns RSS <note>(in favor of Atom)</note> for rising blog format.
<br/>
<br/><b>More on authoring Atom 1.0 feeds:</b>
<br/><a class="button" title="Another How-to" href="http://www.freemarketingzone.com/rss/create-atom-feed.html">Link</a> 
&#160;&#160;Another authoring howto.
<br/><a class="button" title="Another How-to" href="http://www.timfanelli.com/item/howto_create_atom_feed">Link</a> 
&#160;&#160;Yet another authoring howto. <note>(The one too exacting!)</note>
<br/><a class="button" title="Article" href="http://www.biglist.com/lists/xsl-list/archives/200509/msg00147.html">Link</a> 
&#160;&#160;Howto for JavaScript &amp; XSLT <note>(in stead of Perl/CGI)</note>
<br/>
<br/><b>Readers for Atom 1.0 feeds</b>
<br/><a class="button" title="Simple Pie" href="http://simplepie.org/demo/?feed=http%3A%2F%2Fstarling.us%2Fcgi-bin%2Fgus_atom_xsl.pl%3Fatom%3Dstarling_us_atom.xml%21sort_order%3DTitle">Link</a>  
&#160;&#160;SimplePie &#8212; An on-line feed reader.
<br/><a class="button" title="Thunderbird" href="http://www.scubausa.net/mike/atom_feed_how-to.html">Link</a> 
&#160;&#160;Mozilla Thunderbird &#8212; Subscribing to feeds.
<br/><a class="button" title="Feed Readers" href="http://www.google.com/search?hl=en&amp;q=%22atom+reader%22&amp;btnG=Google+Search">Link</a> 
&#160;&#160;Google on feed readers.
<br/><a class="button" title="Feed Readers" href="http://dir.yahoo.com/Computers_and_Internet/Data_Formats/XML__eXtensible_Markup_Language_/RSS/RSS_Readers_and_Aggregators/">Link</a> 
&#160;&#160;Yahoo on feed readers.
</p>

  </section>
  
  <!-- SECTION DELIMITER -->  

  <section>
    <title>Webmaster</title>
    <p><a class="button" href="mailto:gan@starling.us">E-Mail</a>
    &#160;This page is composed in XML format using a plain ASCII text editor. I last revised it on 2007-02-25 at 13:37:35 hours UTC testing in the Firefox 1.5.0.1 browser. Please email to report any problems (other than MSIE’s CSS shortcomings).</p>
  </section>
    
        <!-- SECTION DELIMITER -->
   
    </body>
</gus_xslt>    

