SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    ohio
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    RSS ASP Parser Looks good in IE But Not Firefox

    So there are two main issues. #1, In IE it looks pretty good, BUT i get these weird two characters that preceed the news feed on the line before:
    Other than that it looks good and does what i want it to do = grab an RSS feed (.xml) from my other website and display it bulleted down the left side.

    Problem is in Firefox. I know I do not want to be ignorant anymore saying that IE is the only browser to prepare for (this is a far cry considering I use Safari on a Mac primarily). So, in looking at firefox (at least on mac) it looks like it spits out the same two characters and then spits out the RSS in raw HTML.

    Can anyone help? I think this is a valuable utility that a lot of people could make use of on their websites. And PS, i'm not a coder, so if something is obvious, please be nice - i borrowed most of the code (open source).

    The Code:

    ASP:
    Code:
    <%
    Sub getXML(sourceFile)
    dim styleFile
    dim source, style
    styleFile = Server.MapPath("news.xsl")
    
    set source = Server.CreateObject("Msxml2.DomDocument")
    source.async = false
    source.setProperty "ServerHTTPRequest", true
    source.load CStr(sourceFile)
    
    set style = Server.CreateObject("Msxml2.DomDocument")
    style.async = false
    style.load styleFile
    
    source.transformNodeToObject style, Response
    set source = nothing
    set style = nothing
    
    End Sub
    %>
    .xsl:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
    <xsl:template match="*">
    <xsl:for-each select="//*[local-name()='item']">
    <xsl:if test="position() &lt; 6">
    <li>
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="*[local-name()='link']"/>
    </xsl:attribute>
    <xsl:attribute name="target">
    <xsl:text>top</xsl:text>
    </xsl:attribute>
    <xsl:value-of select="*[local-name()='title']"/>
    </a>
    </li>
    </xsl:if>
    </xsl:for-each>
    </xsl:template>
    <xsl:template match="/">
    <xsl:apply-templates/>
    </xsl:template>
    </xsl:stylesheet>
    html/asp:
    Code:
     <td colspan="2" class="leftMenuItems">
    <% getXML("http://www.mozongo.com/index.xml") %>
    </td>
    Thanks everyone who can offer any help!
    -Matt

  2. #2
    SitePoint Addict flyingpylon's Avatar
    Join Date
    Mar 2002
    Location
    Fishers, IN USA
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's probably related to character encoding somehow. I wrote my own parser and ran into a lot of issues with that. The problem is that msxml can't use iso-based encoding, so it uses utf-16 by default (I think). Are you using any special characters in your titles, etc. such as "curly" or "smart" quotes, etc.?

    Or since you're only seeing the problem in Firefox, maybe the encoding type is not being set correctly in the page that gets output?

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    ohio
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, it is only parsing the text of the titles, and all the titles come out normal. The special characters are inserted before the titles - and in all web browsers...

    But does that explain why Firefox shoots out the raw HTML onto the page rather displaying the links like IE does...

    Thanks though, you gave me a few ideas to look into - anyone else?
    -Matt


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
  •