By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,677 Members | 1,798 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,677 IT Pros & Developers. It's quick & easy.

Generating CSS from XML: how to?

P: n/a
Hi,

After a quick Google turned up very little of use, I've turned to
here. The question: has anyone tried to (or more usefully, succeeded
in) generating CSS files from an XML document transformed using XSL?
Is there an existing schema for CSS in XML? Would there be any
benefit in such a thing?

The reason I ask is because I'm about to embark on an overhaul of a
large site which divides into similar sections with thematic design
variations. The structure of the sections will be similar, but each
section will have its own colour scheme. I would like to be able to
have an XML document for each theme that would create a CSS file for
that theme -- easier for content people to edit XML documents than
CSS files, as they are already editing the content XML.

Any help (or definite answers saying why it's a non-starter) would be
useful.

Thanks,

Rob Kerr
--
"It's impossible for an Englishman to open his mouth without making
some other Englishman despise him."
-- G.B.S., "Pygmalion"
Apr 13 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a

Follow-ups to comp.text.xml.

On Apr 13, 1:29 pm, Rob Kerr <robert.k...@bbc.co.ukwrote:
The question: has anyone tried to (or more usefully,
succeeded in) generating CSS files from an XML document
transformed using XSL?
I haven't but I see no reason why this wouldn't work,
assuming you transform server-side and supply correct
Content-Type when serving the result.

Just use:

<xsl:output method="text"/>
Is there an existing schema for CSS in XML?
Not to my knowledge.

--
Pavel Lepin

Apr 13 '07 #2

P: n/a
Rob Kerr escribió:
Hi,

After a quick Google turned up very little of use, I've turned to
here. The question: has anyone tried to (or more usefully, succeeded
in) generating CSS files from an XML document transformed using XSL?
I've been interested in such thing. It seems relatively simple, but
found not enough spare time to try it. After reading your post, I've
spent some time in searching the net, with partial success.
Is there an existing schema for CSS in XML? Would there be any
benefit in such a thing?
There is JXCSS: a CSS to XCSS (XML markup) converter.

Home: https://jxcss.dev.java.net/
Download: from the "Documents & files" left menu entry.
Some reference:
http://www.opensubscriber.com/messag...g/3083290.html

Regretably, the mentioned CSS in XML DTD (xcss.dtd) cannot be found in
the distribution files, nor in the website (there is a broken page
reference: https://jxcss.dev.java.net/css-dtd.html)

The missing DTD can probably by inferred by processing css samples with
JXCSS, or from the provided XSLT stylesheet (compact-xcss.xsl) to
convert xcss to plain css.

If you ever produce a XML DTD or schema for CSS, I'll be interested on
it. Perhaps I could offer some collaboration, at least by discussing
issues or testing the draft stuff.
...
Any help (or definite answers saying why it's a non-starter) would be
useful.
Hope this helps.
--
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado
Apr 13 '07 #3

P: n/a
Manuel Collado escribió:
Rob Kerr escribió:
>...
Is there an existing schema for CSS in XML? Would there be any
benefit in such a thing?

There is JXCSS: a CSS to XCSS (XML markup) converter.
A further search finds:

CSSML, at: http://www.outer-court.com/tech/index.htm

Perhaps too simple, but provides a DTD and ready-to-use tools.

Regards.
--
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado
Apr 13 '07 #4

P: n/a
On 13 Apr, 11:29, Rob Kerr <robert.k...@bbc.co.ukwrote:

The question: has anyone tried to (or more usefully, succeeded
in) generating CSS files from an XML document transformed using XSL?
Trivial, easy and just a bad idea, so don't do it.

CSS is plain text. Use the right XSL output method and you can make
some - anything you want, whatever content you like.

However you shouldn't _need_ dynamic CSS. An apparent need for such a
thing usually indicates that the HTML itself is broken and has
inadequate specificity of usable selectors (i.e., get some better
classes in there). If the selectors are adequate, then a _static_ CSS
document can deliver all you need.

This technique is often seen in conjunction with absolute CSS
positioning, and indicating that the design positioning is inflexible.

Apr 17 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.