Adding a CSS stylesheet to xml

Here should go questions about transforming XML with XSLT and FOP.
Posts: 10

Adding a CSS stylesheet to xml

Sun Jun 04, 2017 3:25 am

I am very confused about using a css stylesheet to alter the formatting of xml in a browser. I have an xslt stylesheet, and that works fine, but the css doesn't appear to make any difference.

At the top I have <?xml-stylesheet href="text.css" type="text/css"?>. Is this wrong? The css file is called "text.css".

I know there have been posts on this before, but I've read them and can't make sense of them.
Posts: 5816

Re: Adding a CSS stylesheet to xml

Mon Jun 05, 2017 8:02 am


If you open an XML document with an associated CSS in a web browser, the CSS selectors must match those particular XML elements and style them. So you cannot have the CSS match HTML element names, they need to match the XML element names as you have not converted the XML to HTML.

Radu Coravu
<oXygen/> XML Editor

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 2 guests