5 replies [Last post]
blackwind
Offline
newbie
Last seen: 17 years 13 weeks ago
Joined: 2005-04-01
Posts: 4
Points: 0

I want XML content to be imported into an XHTML page (which is styled by CSS)

Would it be better to just make an XML page styled with CSS (if so How do you do that)?

______________________________________________________
Printer cartridges on sale! Huge discounts. Buy them only at ****
http:// Advertising removed (Hugo)

Tags:
roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 8 years 49 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

XML + XHTML + CSS

Life's a b*tch and then you die!

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 12 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

XML + XHTML + CSS

Had a quick look at the thread referred to by Roy (so I may have missed the vitals, but not sure if they're covered)...

Just to add a bit further, you can use XSLT to covert your XML document to XHTML. Within the XSLT doc, you basically map the XML elements from the XML doc, to the required XHTML elements.

The basics of XSLT are very very simple. There are more programmatic features to it and some mighty good ones, but the basic can be picked up in an hour of studying.

However, whilst browsers such as Safari and Firefox will render an XML doc (with an linked XSLT stylesheet), Explorer will not (and fair enough, Firefox also will not render all CSS styles in an XML doc either). You will then have to parse the file (as discussed in Roy's link).

Check out the XSLT tutorial over at http://www.w3schools.com

The next sentence is true. The previous sentence is false. Discuss...

drhowarddrfine
Offline
Leader
Last seen: 12 years 31 weeks ago
Timezone: GMT-6
Joined: 2005-05-21
Posts: 764
Points: 0

XML + XHTML + CSS

Quote:
Firefox also will not render all CSS styles in an XML doc either
How so?

IE7 is 10 years behind the standards or wrong.
But it works in IE!
IE is a cancer on the web -- Paul Thurott

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 12 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

XML + XHTML + CSS

I'm talking non-parsed XSLT-styled XML documents. We've found that Firefox will not render background colours or images (but Safari will do so on the same doc).

Parsing the file to XHTML obviously solves this.

The next sentence is true. The previous sentence is false. Discuss...

roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 8 years 49 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

XML + XHTML + CSS

I looked into XSLT some time ago but decided that as the parsing was done by the UA, which might be running on a slow PC, it was better to handle the parsing at speed on the server. I also seem to remember that building the mapping file was quite complex for all that it achieved, and only really suitable for rendering documents full of repetitive data. That said, I only spent a few hours researching the subject before deciding on the server-level option, and that was a year or two ago so things might have moved on a bit since then.

Life's a b*tch and then you die!