My first XML program.

Discussion in 'XML & RSS' started by pictureboarduk, Jan 23, 2009.

  1. #1
    Hello,

    I am trying to view an .xml file through my browser, the URL I am using is:


    (I have XAMP installed)

    When I do I see the following:

    Then I view this URL:

    I get:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.



    I realize the variables in this last file do not match, but I believe this isn't whats causing the problem.



    The index.html page:

    Viewed through this URL:

    (All URLs are viewed through FifeFox 3)




    I think I am not understanding which file 'plugs into' which, like how the 'CSS file plugs into the HTML file' to make it look correct in the browser, so the content displays correctly..
     
    pictureboarduk, Jan 23, 2009 IP
  2. JenniP

    JenniP Peon

    Messages:
    250
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Its amazing how your eyes swim and just don't see the bloody obvious isn't it, took me ages to see it

    <?xml-stylesheet="text/css" href="menu.xsl"?>

    Is wrong

    It should be

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

    Although you say in your next bit your xsl is food_menu.xsl, so if it is that should be there instead of menu.xsl.

    Also in the last bit the <XML> tag I imagine wont work either as XML Data Islands only work in Internet Explorer as far as I know.

    From memory the XSLT looks ok although its been awhile since I've done it in anger, although as you say it will need to match the source XML to do anything useful.

    As for which file plugs into which

    The bottom one (the HTML) is the top level, then the XML file, the XML file sees the XML-Stylesheet tag then imports the XSL to style it. Although dont mistake xml-stylesheets for CSS they are a completely different technology.

    Also in your example you would have to sets of <HTML> tags if the XSLT did its job, as you have a set in the html file then the XSLT will generate a second set, this would of course confuse the browser a bit.

    Data Islands are a very old technology now though and its better to do a server side XSLT using PHP or ASP.NET, then output the result of that as your page.

    Jen
     
    JenniP, Jan 23, 2009 IP
    pictureboarduk likes this.