473,508 Members | 2,233 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any suggestions CSS/XML

I have an interesting implementation and I am trying to kill two birds with
one stone. In the wizard I am designing the user has the ability to choose
from one of n CSS style sheets to be applied to the end results of the
wizard. I am also thinking of supporting customization of the stylesheet
and this is where my question comes in. I have been commenting my
stylesheets using xml as a guide, for example

<data>
<name>Cool Blue</name>
<comment>yadda</comment>
<styleset name="common">
<styles>
<style name="gridTitle">This style is used to etc...</style>
<style name="gridBody">this style is....</style>
</styles>
<raw>
dummy{}
.gridTitle{font-size:10pt;color:red}
.gridBody{fonts-size:8pt;color:black}
</raw>
</styleset>
...more styleset nodes
</data>
You will notice that the actual styles are contained in the node raw. I have
found that if a create a dummy() empty style the following styles are
correctly picked up by the css parser on all modern browsers!!

So even though this xml/css crossbreed seems to work I wonder if there is a
set way of doing this that I am unaware of. I have done some research but
have not found anything so though I would ask all you smart people.

Cheers
Keith
Nov 12 '05 #1
4 1097


Keith Chadwick wrote:
I have an interesting implementation and I am trying to kill two birds with
one stone. In the wizard I am designing the user has the ability to choose
from one of n CSS style sheets to be applied to the end results of the
wizard. I am also thinking of supporting customization of the stylesheet
and this is where my question comes in. I have been commenting my
stylesheets using xml as a guide, for example

<data>
<name>Cool Blue</name>
<comment>yadda</comment>
<styleset name="common">
<styles>
<style name="gridTitle">This style is used to etc...</style>
<style name="gridBody">this style is....</style>
</styles>
<raw>
dummy{}
.gridTitle{font-size:10pt;color:red}
.gridBody{fonts-size:8pt;color:black}
</raw>
</styleset>
...more styleset nodes
</data>
You will notice that the actual styles are contained in the node raw. I have
found that if a create a dummy() empty style the following styles are
correctly picked up by the css parser on all modern browsers!!

So even though this xml/css crossbreed seems to work I wonder if there is a
set way of doing this that I am unaware of. I have done some research but
have not found anything so though I would ask all you smart people.


I am not sure what you gain with the XML commenting and containing CSS
style rules as CSS has a syntax for comments but if you want to serve
the style rules to a browser as a text/css stylesheet then I strongly
suggest to use XSLT to extract them and to send only them to the browser.
That allows you to store the meta data you want to store with a style
sheet but also lets browsers only deal with what their CSS parsers are
supposed to deal with.

BTW: fonts-size is not the correct CSS property name.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #2
As I stated I am trying to kill to birds with one stone. I have checked
across several several different browsers and down level browsers as well
and there appears to be no problem with any of the browsers picking up the
CSS.

It was just an idea to try out and was curious as to feedback.

Regards
Keith
I am not sure what you gain with the XML commenting and containing CSS
style rules as CSS has a syntax for comments but if you want to serve
the style rules to a browser as a text/css stylesheet then I strongly
suggest to use XSLT to extract them and to send only them to the browser.
That allows you to store the meta data you want to store with a style
sheet but also lets browsers only deal with what their CSS parsers are
supposed to deal with.

BTW: fonts-size is not the correct CSS property name.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #3


Keith Chadwick wrote:
As I stated I am trying to kill to birds with one stone. I have checked
across several several different browsers and down level browsers as well
and there appears to be no problem with any of the browsers picking up the
CSS.


The CSS validator at
http://jigsaw.w3.org/css-validator/validator-text.html
will tell you that most of that example is unrecognized.
Even if the browsers can cope with your CSS in XML I don't think you
should send more to a browser than is needed and force them to try to
parse the XML as CSS if there are techniques like XSLT which would allow
you to extract the CSS rules from the the XML and just send that to the
browser.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #4
Agreed and again was just trying to kill two birds with one stone.

I will most like duplicate the css file as a true xml file then use a
transformation to write out the customized css files to each user folder
space when they choose to customize.

Cheers
Keith

"Martin Honnen" <Ma***********@t-online.de> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...


Keith Chadwick wrote:
As I stated I am trying to kill to birds with one stone. I have checked
across several several different browsers and down level browsers as well and there appears to be no problem with any of the browsers picking up the CSS.


The CSS validator at
http://jigsaw.w3.org/css-validator/validator-text.html
will tell you that most of that example is unrecognized.
Even if the browsers can cope with your CSS in XML I don't think you
should send more to a browser than is needed and force them to try to
parse the XML as CSS if there are techniques like XSLT which would allow
you to extract the CSS rules from the the XML and just send that to the
browser.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1286
by: Matt W | last post by:
Hi all, I'm planning to use MySQL's full-text search for my forum system (possibly 5+ million posts). I've been playing with it a lot lately to see the performance and functionality and have...
10
1929
by: Ron Ruble | last post by:
I'd like to get suggestions from some of the folks here regarding tools and processes for a new, small development team. I'm starting a new job next week, and part of the fun is being able to...
1
1337
by: Brian Basquille | last post by:
Hello all. Have been working on the Air Hockey game on and off for a couple of weeks now.. but have had plenty of other assignments to keep me busy along with it. But i would like some...
62
2351
by: A.M. Kuchling | last post by:
Here are some thoughts on reorganizing Python's documentation, with one big suggestion. The tutorial seems to be in pretty good shape because Raymond Hettinger has been keeping it up to date. ...
6
1401
by: iclinux | last post by:
I have to build a GUI applicaiton that could run on different OS such as windows and *nix, which GUI toolkit is better? Best Regards.
45
3385
by: Gregory Petrosyan | last post by:
1) From 2.4.2 documentation: There are two new valid (semantic) forms for the raise statement: raise Class, instance raise instance 2) In python: >>> raise NameError Traceback (most recent...
26
1822
by: Frank Samuelson | last post by:
I love Python, and it is one of my 2 favorite languages. I would suggest that Python steal some aspects of the S language. ------------------------------------------------------- 1. Currently...
0
4469
rnd me
by: rnd me | last post by:
Purpose: Allows you to create "presets" for text form inputs. "Lightweight and simple to setup, it adds a lot of convenience for ~1kb of code." Only one function, two parameters: First...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7383
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3194
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1557
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.