Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Why can't I view XML in gecko

    <?xml version="1.0" encoding="ISO-8859-1"?>

    <?xml-stylesheet type="text/xsl" href="hello_world.xsl"?>

    <!DOCTYPE kar_trends [

    <!ELEMENT home_page (para*)>

    <!ELEMENT para (#PCDATA)>

    ]>

    <home_page>

    <para>Hello world!</para>

    </home_page>


    viewed in any gecko browser, all I see is the node data - like a text file - instead of the result of the transformation. What am I doing wrong?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Newcastle, England
    Posts
    178
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Change the name of your xsl file to hello_world.xml - I had the same problem until Jason pointed out that text/xsl is not a recognised mime-type.

    patrick

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excellent!

    So - XSL stylesheets have to have the XML extension, because they're XML ... makes sense.

    But I noticed that with

    <?xml-stylesheet type="text/xml" href="hello_world.xsl.xml"?>

    it doesn't work in IE6 anymore ... but with "text/xsl" as the mimetype and .xml as the extension, it works in both.

    Is that one of those IE being stupid things ... that actually there is no such thing as "text/xsl" ?

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Newcastle, England
    Posts
    178
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, it's an IE workaround - refer to the stylesheet type as text/xsl in the declaration or IE won't parse it. Mozilla just ignores this part of the declaration.

    patrick

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Mozilla doesn't really ignore it - this attribute is really just informative in a way that it tells the browser what to expect. Since the real file is sent with text/xml or application/xml, and mozilla has a parser for those, it gets parsed anyway.


    IE on the other hand doesn't have a very compliant mime-type handling, and instead relies solely on the type attribute, and with an unregistred mime-type value at that.


    As for the text/xsl mime-type, it's very unlikely it would get registred. As it is an xml language, it would more likely be text/xsl+xml or application/xsl+xml, if text/xml and a namespace declaration weren't good enough.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

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