W3C home > Mailing lists > Public > www-style@w3.org > August 1999

Re: How can I see a XML file so.

From: Chris Lilley <chris@w3.org>
Date: Fri, 27 Aug 1999 18:10:45 +0200
Message-ID: <37C6B885.496E7126@w3.org>
To: Marta Cárdenes Baez <mbaez@bintercanarias.es>
CC: Lista Style <www-style@w3.org>
Marta Cárdenes Baez <mbaez@bintercanarias.es> wrote:

> I have the XML file following :

> <?xml version='1.0'?>
> <!DOCTYPE circular SYSTEM "circular.dtd">
> <?XML-stylesheet type="text/css" href="circular.css"?>
> <circular>
> <numerocircular>1_99</numerocircular>
> [etc]

> When I open it with Explorer 5 I saw it as this:

> 1_99 1Enero1999 pepe marta jefe prueba Esto es el texo No anula ninguna circular anterior Adiós

What is the contents of your CSS file?

It looks as if it has no content, so the initial values will be used for
all properties, so in particular they will all be inline elements. This
would give you all the text in one line, as you observed.

Try this for circular.css:

circular, numerocircular, fechaemision, destinatario, remitente, 
nombre_remitente, cargo_remitente, asunto, contenido, anular, saludo
 { display: block; font-weight: bold }

dia, mes, ano, nombre_destinatario, nombre_remitente, cargo_remitente
  { display: inline }

That will give you at least the basic block structuring you require, and
you can add color, margins, borders, etc and this will work in IE5 or
indeed any CSS1 browser that can use CSS with XML.

To get the generated text, you need a CSS2 implementation. Add the
following lines to your circular.css as given above:

numerocircular:before {content: "Numero de circular : "}
fechaemision:before {content: "Fecha de emisión : "}
destinatario:before {content: "Destinatario : "}
remitente:before {content: "Remitente : "}
cargo_remitente:before {content: "Cargo del remitente : "}
asunto:before {content: "Asunto : "}
contenido:before {content: "Contenido : "}
saludo:before {content: "Saludo : "}

A little extra trimming in terms of margins and so on makes the whole
thing more legible:

circular { margin: 10%; font-weight: bold }
dia:after, mes:after { content: " "}

Lastly, make sure that your XML declaration matches your content: either

<?xml version='1.0' encoding="ISO-8859-1"?>

or convert your content to UTF-8, or save it as UTF-8, or use a UTF-*
editor. I assume this is why <saludo>Adiós</saludo> was replaced by
<saludo>vvvv</saludo> in your example ;-)

I attach a screen shot of this being rendered (in Mozilla M8). There are
two bugs: firstly the Latin-1 letter ó is incorrectly rendered, since
the browser (correctly) assumes that this is UTF-8, although the Latin-1
text in the generated content makes it through (this is a bug in the
document, rather than in the browser); secondly, for some bizarre
reason, cargo_remitente is not being displayed as a block even though it
is displayed as one.

I thought this was a nice example of using CSS2 with XML, which was why
I demonstrated that it worked. Discussion on the details, and on missing
features which could be in CSS3, is invited. Notice the hack where I
used spaces as generated content to separate the day, month and year.

Of course, it would be nice to have a user stylesheet that said things

fechaemision:before {content: "Date of issue : "}

for the non-Spanish-locutors among us.


(image/png attachment: circular-M8.png)

Received on Friday, 27 August 1999 12:11:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:51 UTC