f



How do I color text with XML tags?

I am trying to display some XML-tagged text in a web page.  The
following example works well in Netscape 7.1, but only the H2 heading
is colored in MSIE.  It seems that MSIE only applies style attributes
to tags that it recognizes.

Is there a way in which this can be done?  Is it possible to format
the XML part (from <azTagger> to </azTagger>) with XLS? If so, how?

Thanks
xyz


======== START OF HTML FILE ===========
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>test</title>
<style type="text/css">
<!--
azsent {margin-left: 40px; margin-right: 40px;}
h2 {color: green }
azphr.n {color: green }
azphr.v { color: #ff0000 }
azphr.p {color: blue }
azpos.r {font-weight: bold }
-->
</style>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080"
alink="#ff0000">
<h2>Test of colored Text</h2>

<azTagger>
<azParag>
<azsent><azphr class="n"><azPOS p="N">Albert </azPOS><azPOS
p="N">Einstein </azPOS></azPhr><azPhr class="V"><azPOS p="X">was
 </azPOS></azPhr><azPhr class="N"><azPOS p="N#" o="JN#">one
</azPOS></azPhr><azphr class="p"><azPOS class="R">of
 </azPOS><azPOS p="T">the </azPOS><azPOS p="J" o="AJ">greatest
</azPOS><azPOS p="N">scientists
 </azPOS></azPhr><azPhr class="P"><azPOS class="R">of </azPOS><azPOS
p="D">all </azPOS><azPOS p="N" o="NV">time</azPOS></azPhr>.
</azSent><azsent> <azPhr class="N"><azPOS p="P">He
</azPOS></azPhr><azPhr class="V"><azPOS p="X">is
 </azPOS><azPOS p="A" o="AJNV">best </azPOS><azPOS p="V" o="NV">known
</azPOS></azPhr><azPhr class="P"><azPOS class="R">for
 </azPOS><azPOS p="P">his </azPOS><azPOS p="N">theory
</azPOS></azPhr><azPhr class="P"><azPOS class="R">of
 </azPOS><azPOS p="N">relativity</azPOS></azPhr>.</azSent>
</azParag>
</azTagger>
      
</body>
</html>
========  END OF HTML FILE ====
0
xyz
9/30/2003 7:06:25 PM
comp.authoring.stylesheets 8158 articles. 0 followers. mdmoura (161) is leader. Post Follow

2 Replies
517 Views

Similar Articles

[PageSpeed] 38

xyz wrote:

> I am trying to display some XML-tagged text in a web page.

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>

If you want to use an XML file, then don't give it an SGML Doctype (that it
doesn't conform to anyway), and send it with a content type of
application/xml, not text/html.

-- 
David Dorward                                       http://dorward.me.uk/
0
David
9/30/2003 7:25:31 PM
David Dorward <dorward@yahoo.com> wrote:

> If you want to use an XML file, then don't give it an SGML Doctype
> (that it doesn't conform to anyway), and send it with a content
> type of application/xml, not text/html.

And, of course, if you present something as XML, then, for example, h2 
is just another tag, with no defined meaning or implied default 
presentation. It's not bigger, it's not bold, it's not even a block.
That is, you need to style everything.

Moreover, you need to write at least "well-formed" XML, which means 
that start and end tags match exactly (in case, too), and you the exact 
tag names in CSS too. 

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/
0
Jukka
10/2/2003 11:14:22 AM
Reply: