Displaying XML File to CSS

Questions about XML that are not covered by the other forums should go here.
jace9
Posts: 2
Joined: Fri May 03, 2013 12:36 pm
Location: United Kingdom
Contact:

Displaying XML File to CSS

Post by jace9 »

Hi! I'm a learner in XML. So, I would like to know if XML file can also be display in CSS and how?
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Displaying XML File to CSS

Post by adrian »

Hello and welcome,

I'm not quite certain of what you're asking.
Do you want to style an XML with the help of a CSS?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
jace9
Posts: 2
Joined: Fri May 03, 2013 12:36 pm
Location: United Kingdom
Contact:

Re: Displaying XML File to CSS

Post by jace9 »

adrian wrote:Hello and welcome,

I'm not quite certain of what you're asking.
Do you want to style an XML with the help of a CSS?

Regards,
Adrian
Yes. How can I do that?
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Displaying XML File to CSS

Post by adrian »

Hi,

The same CSS rules apply for XML as for HTML, but obviously adapted to the specific elements, attributes and content of your XML file. If you want to learn CSS I suggest starting with: http://www.w3schools.com/css/

To associate a CSS to an XML document you need to specify in the XML a processing instruction like this before the root element:

Code: Select all

<?xml-stylesheet type="text/css" href="mycssfile.css"?>
If you are using Oxygen you can check out some of its XML+CSS samples.
e.g. Oxygen/samples/personal.xml and Oxygen/samples/personal.css
personal.css has some custom CSS extensions specific to Oxygen, but these can be easily identified due to their different namespace prefix (oxy).

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply