very easy beginner question(s)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kowalsky
    New Member
    • Jul 2008
    • 1

    very easy beginner question(s)

    hi all,
    I just started to poke the xml and related concepts. What is not clear to me is the following:

    I have an xml file called person.xml and since it is so short and simple I just posted it below:

    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xml" href="C:\Docume nts and Settings\My Documents\XML\m inimal.xsl"?>
    <people>
    <person born="1912" died="1954">
    <name>
    <first_name>Ala n</first_name>
    <last_name>Turi ng</last_name>
    </name>
    <profession>com puter scientist</profession>
    <profession>mat hematician</profession>
    <profession>cry ptographer</profession>
    </person>

    <person born="1918" died="1988">
    <name>
    <first_name>Ric hard</first_name>
    <middle_initial >M</middle_initial>
    <last_name>Feyn man</last_name>
    </name>
    <profession>phy sicist</profession>
    <hobby>Playin g the bongos</hobby>
    </person>
    </people>

    At the same time, I have an empty stylesheet, the minimal.xsl posted below as well:

    <?xml version="1.0"?>
    <xsl:styleshe et version="1.0" xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
    </xsl:stylesheet>

    My question is: why do I get the xml file back whenever I open the person.xml with IE6 on an XP box with SP2.
    If I open the same person.xml with Firefox 2.0.0.14 I get the element values in a string with no paragraph breaks just as seen below:
    Alan Turing computer scientist mathematician cryptographer Richard M Feynman physicist Playing the bongos.

    Now, if I do a CTRL+a in the Firefox browser and do a Ctrl+V here below, this is what I get - which is the thing the author of the book where I got this sample said it will happen.



    Alan
    Turing

    computer scientist
    mathematician
    cryptographer




    Richard
    M
    Feynman

    physicist
    Playing the bongos

    Why is it not working with IE6 and why the exotic behavior of Firefox?

    Thanks a bunch,
    kowlasky
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    The XML parsers used by both the browsers are totally different and thats why the difference is...
    I am dobtful gerading the way you have gived the XSL path in the xml file...


    Raghu

    Comment

    • jkmyoung
      Recognized Expert Top Contributor
      • Mar 2006
      • 2057

      #3
      HTML processors automatically remove newlines; they treat them as just space. You would need a <br/> tag in order to have a newline.

      Since you copied and pasted, you copied the newlines as well, but they render differently as text, then as HTML.

      Comment

      Working...