Hello -
I am not 100% sure on your question. What I will tell you is that the usual manner in which you would render an XML document for display would be with an XSLT stylesheet.
XSLT is another open source standard that is based on XML. I have used this combination quite a few times now and appreciate the flexibility that you get. The downside is that currently you need to send the XML to either a JSP or servlet that will translate and then output the transformed text.
If you have more questions let me know.
-Mike
hello,
Thank you for your reply!
I know that XSLT can translate a XML file and a XSL file into other format,including HTML.But comparing with CSS,it's is difficult to manipulate XSL.For example,you dispaly a XML file in a JTextPane and allow users to edit it's content and appearance.If use css,when the appearance is changed,you can log it easily by writing the information into CSS file.If use XSL,logging the information would be difficult.In addition,many people are good at CSS,but they don't know XSL.I want my program to support both XSL and CSS. so I want to Know how to display XML file with CSS.
Thank you again!
Hi,
XML documents don't have the link or style elements that are used in HTML to connect style information to particular documents. Instead, the W3C has defined a processing instruction that provides that information, based on the model of the HTML link element. To connect a CSS style sheet to your XML document so that the browser can find it, use a processing instruction like
<?xml-stylesheet type="text/css" href="URI"?>
where URI is the address of the style sheet. We'll use a style sheet called display1.css for our first test document. The processing instruction can go right after the XML declaration.
<?xml version="1.0" ?>
<?xml-stylesheet type="text/css" href="display1.css"?>
<test>
Hope this may help you.
Regards,
Anil.
Technical Support Engineer.