Forum Moderators: open

Message Too Old, No Replies

with css to display xml data

with css to display xml data

         

xbl01234

7:43 am on Oct 7, 2007 (gmt 0)

10+ Year Member



Hi;
Hi;
I am trying to use the css to display xml file, i works in my harddrive,
but it does not work when i upload to my hosting, and put them into public_html folder.
Could you tell me why? please.
My code as following:

index.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with XML Spy v2007 (http://www.altova.com) -->
<?xml-stylesheet type="text/css" href="/cd_catalog.css"?>
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>
<CD>
<TITLE>Greatest Hits</TITLE>
<ARTIST>Dolly Parton</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>RCA</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1982</YEAR>
</CD>
<CD>
<TITLE>Unchain my heart</TITLE>
<ARTIST>Joe Cocker</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>EMI</COMPANY>
<PRICE>8.20</PRICE>
<YEAR>1987</YEAR>
</CD>
</CATALOG>

cd_catalog.css


CATALOG
{
background-color: #ffffff;
width: 100%;
}
CD
{
display: block;
margin-bottom: 30pt;
margin-left: 0;
}
TITLE
{
color: #FF0000;
font-size: 20pt;
}
ARTIST
{
color: #0000FF;
font-size: 20pt;
}
COUNTRY,PRICE,YEAR,COMPANY
{
display: block;
color: #000000;
margin-left: 20pt;
}

Marshall

8:05 am on Oct 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



When you say it displays when viewing it on your hard drive, are you saying that elements display: block where indicated, as all I get is one long sentence, or are you saying it is not displaying anything?

You would be better off using an XSLT file [w3schools.com] to display your XML content then using straight CSS.

Marshall

xbl01234

8:27 am on Oct 7, 2007 (gmt 0)

10+ Year Member



The result is same as
cd_catalog_with_css.xml
[w3schools.com]

I will go with the xsl, but now i am just test how to use it.

httpwebwitch

3:29 am on Oct 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



see this example of applying client-side XSLT and CSS to XML

[webmasterworld.com...]

xbl01234

10:04 am on Oct 8, 2007 (gmt 0)

10+ Year Member



Thanks for your link.