SitePoint Sponsor

User Tag List

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

    Weird Characters And XSL Not Producing in Firefox

    First off, I'm not a coder, and all the work i have done so far has been mostly editing other peoples code - so i know some, but not a lot - and props to the originals.

    Anyway, i am trying to get a RSS Parser to work - its ASP that utilizes an .xsl file - It works fine in IE and Safari (it shows the first 5 stories w/ links) EXCEPT it displays two funky characters at the top:

    In Netscape and Firefox i get the same funky characters, but instead of getting the right output, it just spits out the raw HTML onto the page....

    Here's the XSL file:

    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="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>
    Let me know if you need to see the ASP portion - thanks everyone in advance!
    -Matt

  2. #2
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change the encoding to UTF-8.

    HTML Code:
     <?xml version="1.0" encoding="UTF-8"?>

    Code:
    <%
      Response.Charset="ISO8859-1"
    %>
    http://www.chilkatsoft.com/ChilkatIConv.asp
    Last edited by Andrew-J2000; Apr 5, 2005 at 23:49.

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    ohio
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, changed that, but it didn't fix anything.
    -Matt

  4. #4
    SitePoint Zealot Med's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure you don't save the file as UTF8 and if you should do so, make sure you save it without the BOM. My guess is that the 2 charachters you are seeing is the BOM (Byte Order Mark).

    Your text editor might save files out as UTF8 default. If you use BBEdit you can change it in the prefs.

  5. #5
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In your ASP code, are you doing:

    Response.Write DOM.xml
    ?

    If so, try changing it to
    DOM.save Response

  6. #6
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    ohio
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, i saved it as UTF-8, No BOM and It looks like it didn't change anything. What should I save it as if i don't use UTF-8? And i should still keep the UTF-8 encoding line in, correct?

    I didn't have that line in the ASP, here's what the ASP code looks like:
    Code:
    <%
    Sub getXML(sourceFile)
    Response.Charset="ISO8859-1"
    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
    %>
    I'm still at a loss - thanks all for helping though....
    -Matt

  7. #7
    SitePoint Zealot Med's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well don't save it as UTF8. Sorry if i wasn't clear on that. I was trying to explain the problem with the BOM. Just save it as ISO-8859-1.
    Can't help you with the ASP, i know nothing about it...

    Good luck

  8. #8
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    ohio
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, no worries. I just found better ASP code. And made it work much smoother. No more problems, but thanks everyone for the help!
    -Matt

  9. #9
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry change it to

    Code:
       Response.Charset="UTF-8"


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
  •