Click to See Complete Forum and Search --> : Is it possible to refer to a stylesheet with XML ??


tayiper
10-06-2006, 11:09 PM
You see, as a majority of webcoders I am used to refer to an external stylesheet (a .css file) with a link tag's "rel" attribute in a "header" of a document: <link rel="stylesheet" type="text/css" href="file.css" title="stylesheet" />, but today I've seen on some site the following line: <?xml-stylesheet href="../style.css" type="text/css"?> (also in a header, right after the XML specification: "<?xml version="1.1" encoding="windows-1250"?>"), so does that mean that this is possible also in XML ??


thanks, tayiper

KDLA
10-07-2006, 09:45 AM
Yes -- take a look: http://www.w3.org/TR/xml-stylesheet/

tayiper
10-07-2006, 05:27 PM
OK, thanks much for the reply. And maybe just this additional question: what are the benefits of doing it like this, compare to a common "link tag"/"rel attribute" way (it's not mentioned in the linked W3C article), and also, what happens if one specifies it in the both ways ??


tayiper

Efferent
10-07-2006, 09:59 PM
CSS has an inherent nature. An element enclosed by another element will inherent the attribute from its parent element. But if the child element has its own properties set to a certain value it won't inherent the same property value from its parent. Sometimes, a same element may be given two different value to its same property. The last value will be used. Like example:

body {backgroundcolor="red"}
body {backgroundcolor="blue"}

The page will have a blue background.

Each elements also has its priority value. An "ID" will have a higher priority than an "Class".

tayiper
10-07-2006, 10:48 PM
CSS has an inherent nature. An element enclosed by another element will inherent the attribute from its parent element. But if the child element has its own properties set to a certain value it won't inherent the same property value from its parent. Sometimes, a same element may be given two different value to its same property. The last value will be used. Like example:

body {backgroundcolor="red"}
body {backgroundcolor="blue"}

The page will have a blue background.

Each elements also has its priority value. An "ID" will have a higher priority than an "Class".

Hmmm, I must confess that do not understand what you are trying to say here; I mean what has this to do with stylesheets and XML ??


tayiper

KDLA
10-08-2006, 04:59 PM
I've not heard anything specifying whether or not this technique is better than the standard link. I think this is just an option, available with XML technology.

(I read an article once that stated the difference between HTML and XHTML was the "cool" effect of having an "X" in the name. This might be along those lines -- I really don't know. ;) )

In researching your question (because I was curious), I found this article: http://developer.apple.com/internet/webcontent/xmltransformations.html
This will probably answer your questions, as to the merits of XML linking.

Good Luck -
KDLA