XML and CSS -> Blank Screen :(

C

charly

Greetings,

I'm trying my hand at xml and css (no, I don't want to use XSL yet).

So I got a test.xml :


<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="styles.css" type="text/css"?>

<Diaries>
<name>
testName
</name>
<name>
testName the second
</name>
</Diaries>


I got a styles.css defined as this :

<meta http-equiv="content-style-type" content="text/css">

diairies,name{
display: block;
padding: 0.75em;
}


now if open test.xml with IE6 or Firebird, nothing appears, my screen is
blank yet the source is correct....

I am definitively missing somehting obvious here :

can someone help me please ?

thx a bunch !!
 
M

Martin Honnen

charly wrote:

I'm trying my hand at xml and css (no, I don't want to use XSL yet).

So I got a test.xml :


<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="styles.css" type="text/css"?>

<Diaries>
<name>
testName
</name>
<name>
testName the second
</name>
</Diaries>


I got a styles.css defined as this :

<meta http-equiv="content-style-type" content="text/css">

That line above is HTML markup and doesn't belong in a CSS stylesheet.
diairies,name{

The element name above is Diaries and not diairies
 
C

charly

Ok, I admit, I did a bad cut & paste :

I did put DIARIES in both places and tried without the HTML markup but
had not better luck :( :

toto.xml follows :

<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="styles.css" type="text/css"?>

<DIAIRIES>
<TARGET NAME="myNameIs"/>

</DIAIRIES>


CSS file :

TARGET{
display: block;
color: #6A6A6A;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 8pt;
font-weight:bold;
}

DIAIRIES{
display: block;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 8pt;
font-weight: normal;
}



thx anyway
 
M

Martin Honnen

charly wrote:

I did put DIARIES in both places and tried without the HTML markup but
had not better luck :( :

toto.xml follows :

<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="styles.css" type="text/css"?>

<DIAIRIES>
<TARGET NAME="myNameIs"/>

</DIAIRIES>

Hmm, there is no content in that XML file so the browser will indeed
render a blank screen.
Maybe you have again not copied what you played with but I suggest you
try to make an example that you think doesn't work, upload it to a HTTP
server and post the URL here.
 
C

charly

Hmm, there is no content in that XML file so the browser will indeed
render a blank screen.
Maybe you have again not copied what you played with but I suggest you
try to make an example that you think doesn't work, upload it to a HTTP
server and post the URL here.

First of all, Thank you very for your time and attention :)

I did put exactly what I played with.
But I seem to forget something very important in my xml file but I do
not see what it is :(
The point is that if i remove the css part, the borwser prints the
structure of the document :(

could you provide me with a wholly formed xml file please ?

thx again !
 
C

charly

Hmm, there is no content in that XML file so the browser will indeed
render a blank screen.
Maybe you have again not copied what you played with but I suggest you
try to make an example that you think doesn't work, upload it to a HTTP
server and post the URL here.

At last I understand my error :

in xml, <ELEMENT name="tot"></ELEMENT> won't print anything
I thought it would at last print "tot" but of course, not :(.

I have to provide <ELEMENT name="tot">here</ELEMENT> to print "here"

That's annoying ...

My problem is that I have a huge xml file with a lot of elements where
infos are held in attributes to make the document more human readable
but the parser doesn't care : if element is empty, then he won't print it :(

Would XSL help me there ?
 
M

Martin Honnen

charly said:
At last I understand my error :

in xml, <ELEMENT name="tot"></ELEMENT> won't print anything
I thought it would at last print "tot" but of course, not :(.

I have to provide <ELEMENT name="tot">here</ELEMENT> to print "here"

That's annoying ...

My problem is that I have a huge xml file with a lot of elements where
infos are held in attributes to make the document more human readable
but the parser doesn't care : if element is empty, then he won't print
it :(

Would XSL help me there ?

Yes, XSLT can transform you XML to HTML and put any information inside
XML attributes into some HTML element so that the information is rendered.
Or you could use XSLT to transform your XML with attributes to some XML
with elements containing content.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top