Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

very easy beginner question(s)

Question posted by: kowalsky (Newbie) on July 3rd, 2008 02:55 AM
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:\Documents and Settings\My Documents\XML\minimal.xsl"?>
<people>
<person born="1912" died="1954">
<name>
<first_name>Alan</first_name>
<last_name>Turing</last_name>
</name>
<profession>computer scientist</profession>
<profession>mathematician</profession>
<profession>cryptographer</profession>
</person>

<person born="1918" died="1988">
<name>
<first_name>Richard</first_name>
<middle_initial>M</middle_initial>
<last_name>Feynman</last_name>
</name>
<profession>physicist</profession>
<hobby>Playing 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:stylesheet 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's Avatar
gpraghuram
Expert
1,120 Posts
July 4th, 2008
04:43 AM
#2

Re: very easy beginner question(s)
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

Reply
jkmyoung's Avatar
jkmyoung
Moderator
797 Posts
July 4th, 2008
03:17 PM
#3

Re: very easy beginner question(s)
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.

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,873 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top XML Forum Contributors