home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 December / PCWorld_2006-12_cd.bin / komunikace / netscape / nsb-install-8-1-2.exe / chrome / RSSPrettyPrint2.xsl < prev    next >
Extensible Markup Language  |  2006-09-12  |  5KB  |  117 lines

  1. <?xml version="1.0"?>
  2.  
  3. <xsl:stylesheet version="1.0"
  4.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  5.                 xmlns:atom="http://purl.org/atom/ns#"
  6.                 xmlns="http://www.w3.org/1999/xhtml">
  7.  
  8.   <xsl:output method="xml"/>
  9.  
  10.   <!-- Main body of stylesheet -->
  11.   <xsl:template match="/atom:feed">
  12.       <mytitle id='rsstitle'>
  13.           <xsl:attribute name="label">
  14.               <xsl:value-of select="atom:head/atom:title|atom:title"/>
  15.           </xsl:attribute>
  16.       </mytitle>
  17.       <myNode anonid="rsslinklist">
  18.           <xsl:call-template name="rsslinks"/>
  19.         </myNode>
  20.         <xsl:call-template name="insert_ad"/>
  21.         <xsl:call-template name="rssitemlist"/>
  22.   </xsl:template>
  23.  
  24.  
  25.     <!-- this generates a list of <rsslink/> entries, one for each article in the document -->
  26.     <xsl:template name="rsslinks">
  27.         <xsl:for-each select="atom:entry">
  28.                 <rsslink>
  29.                     <xsl:attribute name="thislink">
  30.                             <xsl:choose>
  31.                                 <xsl:when test="boolean(atom:link)">
  32.                                     <xsl:value-of select="atom:link/@href"/>
  33.                                 </xsl:when>
  34.                                 <xsl:when test="boolean(atom:head/atom:link)">
  35.                                     <xsl:value-of select="atom:head/atom:link/@href"/>
  36.                                 </xsl:when>
  37.                                 <xsl:when test="boolean(../atom:link)">
  38.                                     <xsl:value-of select="../atom:link/@href"/>
  39.                                 </xsl:when>
  40.                                 <xsl:when test="boolean(../atom:head/atom:link)">
  41.                                     <xsl:value-of select="../atom:head/atom:link/@href"/>
  42.                                 </xsl:when>
  43.                             </xsl:choose>
  44.                     </xsl:attribute>
  45.                 </rsslink>
  46.         </xsl:for-each>
  47.     </xsl:template>
  48.  
  49.     <!-- This is where the code for the ad goes -->
  50.     <xsl:template name="insert_ad">
  51.         <div class="rss-ad" style="float: right;padding-left: 10px;padding-right: 10px;">
  52.             <a HREF="http://ar.atwola.com/link/93214958/aol">
  53.                 <img SRC="http://ar.atwola.com/image/93214958/aol" ALT="Click here to visit our advertiser." width="160" height="600" border="0"/>
  54.             </a>
  55.         </div>
  56.     </xsl:template>
  57.  
  58.     <!-- this prints out all of the rss articles -->
  59.     <xsl:template name="rssitemlist">
  60.         <xsl:for-each select="atom:entry">
  61.             <xsl:sort select="atom:updated" order="descending"/>
  62.             <xsl:sort select="atom:title" order="ascending"/>
  63.             <xsl:sort select="atom:summary" order="ascending"/>
  64.             <div style="font-family: sans-serif;margin-left: 45px;margin-top: 4px;margin-bottom: 16px;">
  65.                 <img class="readcheck" style="float: left;padding-right: 5px;margin-left: -45px;">
  66.                         <xsl:attribute name="aref">
  67.                             <xsl:choose>
  68.                                 <xsl:when test="boolean(atom:link)">
  69.                                     <xsl:value-of select="atom:link/@href"/>
  70.                                 </xsl:when>
  71.                                 <xsl:when test="boolean(atom:head/atom:link)">
  72.                                     <xsl:value-of select="atom:head/atom:link/@href"/>
  73.                                 </xsl:when>
  74.                                 <xsl:when test="boolean(../atom:link)">
  75.                                     <xsl:value-of select="../atom:link/@href"/>
  76.                                 </xsl:when>
  77.                                 <xsl:when test="boolean(../atom:head/atom:link)">
  78.                                     <xsl:value-of select="../atom:head/atom:link/@href"/>
  79.                                 </xsl:when>
  80.                             </xsl:choose>
  81.                         </xsl:attribute>
  82.                 </img>
  83.                 <b>
  84.                     <span class="artitle" style="font-size: 14px;font-weight: bold;color: #000000;">
  85.                         <xsl:value-of select="atom:title"/>
  86.                     </span> 
  87.                      <span class="feedTitle" style="font-size: 14px;color: #7E7E7E;">
  88.                          <xsl:value-of select='atom:head/atom:title'/>
  89.                      </span>
  90.                  </b> 
  91.                 <span class="updated" style="font-size: 14px;    color: #7E7E7E;"><xsl:choose><xsl:when test="boolean(atom:nicedate)"><xsl:value-of select="atom:nicedate"/></xsl:when><xsl:otherwise><xsl:value-of select="atom:updated"/></xsl:otherwise></xsl:choose></span>
  92.                  <br/>
  93.                  <span class="summary"  style="display: block;margin-top: 6px;font-size: 12px;color: #7E7E7E;">
  94.                      <xsl:value-of select="atom:summary"/>
  95.                  </span><a class="readmore" style="display: block;margin-top: 6px;font-size: 12px;color: #1C64CA;">
  96.                     <xsl:attribute name="href">
  97.                             <xsl:choose>
  98.                                 <xsl:when test="boolean(atom:link)">
  99.                                     <xsl:value-of select="atom:link/@href"/>
  100.                                 </xsl:when>
  101.                                 <xsl:when test="boolean(atom:head/atom:link)">
  102.                                     <xsl:value-of select="atom:head/atom:link/@href"/>
  103.                                 </xsl:when>
  104.                                 <xsl:when test="boolean(../atom:link)">
  105.                                     <xsl:value-of select="../atom:link/@href"/>
  106.                                 </xsl:when>
  107.                                 <xsl:when test="boolean(../atom:head/atom:link)">
  108.                                     <xsl:value-of select="../atom:head/atom:link/@href"/>
  109.                                 </xsl:when>
  110.                             </xsl:choose>
  111.                     </xsl:attribute>Read More...</a>
  112.             </div><xsl:if test="position()!=last()"><hr/></xsl:if>
  113.         </xsl:for-each>
  114.     </xsl:template>
  115.  
  116. </xsl:stylesheet>
  117.