Musings of a Philadelphia Physician who has served the community for six decades

Return to Home

Related Topics

Website Development
The website technology supporting Philadelphia Reflections is PHP, MySQL and DHTML. The web hosting service is Internet Planners. The development of this website has provided an opportunity to learn new technology, to try out different techniques for getting noticed by the search engines and the trials and tribulations of dealing with malicious hackers and spammers who range from the annoying to the abusive. This collection of articles documents some of our experiences and we hope that people surfing the web looking for solutions to problems we've encountered will benefit.

Stylesheet for ATOM feed

Even though neither IE 7 nor Firefox 3.0.8 will render a stylesheet for an ATOM or RSS feed delivered over the network, we have set them up in hopes that someday this anomaly will be cured.

No aggregator I have ever seen goes to the basic trouble of sorting their input feeds by modified date, relying on the feed creator to "push" the latest onto the top of the stack. Our XSL stylesheet does sort by modified date, among other nice things.

Here's the XSL stylesheet for our ATOM feed, including sorting the entries:

<?xml version="1.0" encoding="utf-8"?>

<!--                                   -->
<!--     Philadelphia Reflections      -->
<!--   XSL Stylesheet for ATOM feed    -->
<!--                                   -->

<!-- Grateful acknowledgement to -->

<xsl:stylesheet version="1.0"
    <xsl:output method="html" encoding="utf-8"/>
    <xsl:template match="/">
      <title>ATOM Feed for Philadelphia Reflections</title>
      <link rel="stylesheet" href="" type="text/css"/>
      <link rel="stylesheet" href="" type="text/css"/>
      <style type="text/css">
        .notvisible {visibility: hidden;}
        <xsl:apply-templates select="/atom:feed"/>
    <xsl:template match="/atom:feed">
      <div class="topbox">
        <p><img src="" alt="ATOM feed icon" /> 
        This is the <strong>ATOM-feed </strong> 
        for the <a href=""><xsl:value-of select="atom:title"/></a>
        website.<br />
        ATOM feeds allow you to stay up to date with the latest additions and changes 
        on  <xsl:value-of select="atom:title"/>.</p>
      <div class="contbox">
            <div class="mainbox">
            <div class="itembox">
              <h1><xsl:value-of select="atom:title"/></h1>
              <p><xsl:value-of select="atom:subtitle"/></p>

              <ul id="entries">
                <xsl:apply-templates select="atom:entry">
                  <xsl:sort select="atom:updated" order="descending"/>


          <td valign="top" width="30%">
            <div class="subscrbox">
            <div class="padrhsbox">
              <h2>Subscribe to this feed</h2>
              <p>If you use one of the following web-based News Readers,
                click on the appropriate button to subscribe to the RSS feed.</p>
              <a href="#" onClick="window.location='' + window.location;return false;">
                <img height="17" width="91" vspace="3" border="0" alt="my yahoo" src=""/>
              <a href="#" onClick="window.location=''+ window.location;return false;">
                <img height="18" width="91" vspace="3" border="0" alt="bloglines" src=""/>
              <a href="#" onClick="window.location=''+ window.location;return false;">
                <img height="17" width="91" vspace="3" border="0" alt="newsgator" src=""/>
              <a href="#" onClick="window.location=';a=' + window.location + '&amp;t={title}';return false;">
                <img src="" vspace="3" border="0" alt="Subscribe with Pluck RSS reader"/>
              <a href="#" onClick="window.location='' + window.location;return false;">
                <img src="" vspace="3" border="0" alt="Subscribe in Rojo"/>
              <a href="#" onClick="window.location='' + window.location;return false;">
                <img src="" vspace="3" border="0" alt="Add to Google"/>
              <hr />
              <p>If you would like to receive an email whenever changes are made, please send me an email and I'll be glad to add you. 
              <br /><br /><a href="">Click to send an email</a></p>


    <xsl:template match="atom:entry">
      <li style="margin-bottom: 25px; height: auto;">
        <a href="{atom:link/@href}">
          <xsl:value-of select="atom:title"/>
          &#8212; <xsl:value-of select="substring-before(atom:updated,'T')"/>
        <div class="item_desc">
          <xsl:value-of select="atom:summary" disable-output-escaping="yes"/> <!-- disable-output-escaping="yes" does not work with Firefox 3.0.8 -->



Thanks, this is a good stylesheet for Atom xml!
Posted by: Fabio   |   Nov 8, 2012 5:25 AM

Please Let Us Know What You Think

(HTML tags provide better formatting)

Because of robot spam we ask you to confirm your comment: we will send you an email containing a link to click. We apologize for this inconvenience but this ensures the quality of the comments. (Your email will not be displayed.)
Thank you.