SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Aug 2011
    Location
    Inland Empire, CA
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trouble with XSL parsing XML to HTML

    I've been trying to give my XML feed some style since Chrome doesn't have a default XML style.
    I got most of it figured out, but my last problem is that the 'description' field in the XML is coming out as paragraph text, but it's ignoring all of the HTML tags already imbedded in the 'description'
    The XML Feed is located here: http://www.ezup.com/ezrss.php
    This is my XSL code:
    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="utf-8"/>
    <xsl:template match="/">
    <html>
      <head>
        <title><xsl:value-of select="rss/channel/title"/> Feed</title>
        <style type="text/css">
        @import url(includes/css/rss.css);
        </style>
      </head>
      <body>
        <div id="explanation">
          <h1>E-Z UP RSS Feed</h1>
          <p>You are viewing an <acronym title="Really Simple Syndication">RSS</acronym> feed.  An RSS feed is a file allowing users a way to read updates to a website either through a third party RSS aggregator or other form of RSS syndication service.<br/>  You can find out more about the RSS file format at the <a href="http://en.wikipedia.org/wiki/RSS_(file_format)">Wikipedia RSS entry</a>.</p>
          <p>You may use the <acronym title="Uniform Resource Locater">URL</acronym> of this document for any RSS purposes.</p>
        </div>
        <div id="content">
          <xsl:for-each select="rss/channel/item">
          <div class="article">
            <h2><a href="{link}" rel="bookmark"><xsl:value-of select="title"/></a></h2>
    		<p class="date"><xsl:value-of select="pubDate" /></p>
            <p><xsl:value-of select="description" /></p>
    		
          </div>
          </xsl:for-each>
        </div>
      </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,598
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    That feed looks OK to me. Could you give more details about what's getting ignored in the description? The code you posted above deson't look like what appears on that page you linked to. Above, you have <p> tags inside the <description>s. I don't know much about this, but I'm not sure that's a good idea.

  3. #3
    SitePoint Member
    Join Date
    Aug 2011
    Location
    Inland Empire, CA
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's only breaking down in Chrome.
    When you see the description in Chrome it's not showing the special characters correctly, so there are a lot of '&nbsp;' '<br/>', etc. It also shows the raw anchor tags instead of normal links.
    The <p> tags aren't in the description, they're just wrapping it. If I leave them out, nothing changes.

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,598
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Chrome has really lousy support for RSS—if it can be said to support it at all. Your feed displays better in Chrome than mine does. Perhaps that's because you are using .php rather than .xml. Someone more experienced needs to step in.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •