RE: CSS discussion

Hi Abel

 

I think it makes sense to do what you suggest - the location of the CSS
and where it is referenced from needs to be noted I think - per the
earlier discussion on this list (and suddenly realizes that he didn't
update the example moki document, as he was having fun being on vacation
:-().

 

As to a full serialization - I think I support this idea, though like
Sean I am worried about "where it will all end" and do we really need
it?

 

I think that it probably is worth while if only because we need to
figure out at least two particular cases:

 

1. Valid CSS Level 2 selectors which are not valid CSS level 1 e.g.

body > h1#potter + p.hogwarts a:visited.broomstick 

 

2. Values that are inappropriate to the property in question

e.g. width: -1px

e.g. width: italic

 

 

It may be that we want to check and warn for other things too. E.g. we
might want to check that the selectors actually refer to valid HTML
elements. All of which says to me that it would be better if we got on
with a full serliazation.

 

As a very background activity I have been working on this. And am making
some progress. The example below is an elaboration of something I sent a
while ago. The main difference being a full treatment of selectors. I
have some very ropey code that runs this, but that I might be willing to
share :-) the main issue I face at the moment is that I haven't laid my
hands on a viable xmlwriter.

 

Cheers

Jo

 

 

 

<?xml version="1.0" encoding="UTF-8"?>

<!-- example css-in-xml format for mobileOK -->

<stylesheet xmlns="www.w3.org/2007/xcss">

      <charset name="ISO-8859-1"/>

      <import href="" media=""/>

      <import href="" media=""/>

      <ruleset>

            <!-- table[class |= time] -->

            <selector element="table">

                  <condition type="one-of-hyphen-attribute" name="class"
value="time"/>

            </selector>

            <declaration property="margin" important="true">

                  <value value="2" unit="px"/>

                  <value value="2" unit="px"/>

                  <value value="2" unit="px"/>

                  <value value="2" unit="px"/>

            </declaration>          

            <declaration property="background-color">

                  <value value="#ffccff"/>

            </declaration>          

      </ruleset>

      <ruleset>

            <!--  body > h1#potter + p.hogwarts a:visited.broomstick -->

            <selector element="a">

                  <condition type="pseudo" name="visited"/>

                  <condition type="class" name="broomstick"/>

                  <selector element="p" rel="ancestor">

                        <condition type="class" name="hogwarts"/>

                        <selector element="h1" rel="preceding-sibling">

                              <condition type="ID" name="potter"/>

                              <selector element="body" rel="parent"/>

                        </selector>

                  </selector>

            </selector>

            <declaration property="color">

                  <value value="rgb(120,120,120)"/>

            </declaration>

      </ruleset>

      

      <media type="all">

            <ruleset>

                  <selector ></selector>

                  

            </ruleset>

            <ruleset>

                  

            </ruleset>

      </media>

      <page name="" pseudo="">

            <declaration></declaration>

      </page>

      <font-face name="">

            <declaration></declaration>

      </font-face>

</stylesheet>

 

 

 

________________________________

From: public-mobileok-checker-request@w3.org
[mailto:public-mobileok-checker-request@w3.org] On Behalf Of Abel Rionda
Sent: 07 August 2007 13:21
To: public-mobileok-checker@w3.org
Subject: CSS discussion

 

Hi,

 

In the first part of this mail there is summary of current status of CSS
in XML

implementation and the second part there are some questions about
Regular

expressions approach in order to make a comparison between both
approaches.

 

Please, feel free to add any comments or other issues to make the
comparison more

accurate. 

 

Current Status of CSS: CSS in XML

 

This is the general stylesheet structure present in moki so far:

 

<stylesheets>

<stylesheet type="embedded">

<URI></URI>

<CSSValidity valid="false">

      /*CSS grammar errors*/

</CSSValidity>

            

<styles>

            /*CSS in XML */

      </styles>

 

            </stylesheet>

 

<stylesheet type="external">

<URI></URI>

<retrieval>...</retrieval>

<CSSValidity valid="true"/>

      

<styles>

/*CSS in XML */

      </styles>

 

            </stylesheet>

 

</stylesheets>

 

Current values of type attributte:

 

Embedded

This type is used for CSS stuff enclosed inside style tags elements in
primary document.

 

External

This type is used for linked CSS (through link tag or xml pre-processing
instruction) and imported CSS (with some recent changes made by Laura).

 

 

Moki styles Block tag

            

We are using SAC for making a writer of CSS and build a representation
of CSS in XML. So far we have not a full serialization of CSS but an
equivalent representation. 

For example:

So far we have <selector>a:visited</selector> instead of <selector
value="a" pseudo="visited"/> 

 

 

Possible changes or things pending to do:

 

TOBEDISCUSSED Full Serialization 

Jo had said that it would be desirable having a full serialization. We
think that is not very difficult to do, but do we really need this level
of serialization to fulfil our tests? 

 

TODO Serialization of Inline Style

This can be done adding a new stylesheet tag to moki (of type inline)
with all the style attributes present in main document.

 

TODO Line Number

Adding a line number property to each serialized CSS property (This can
be done during serialization).

 

TODO: Deal with short hand properties (eg font into font-size,
font-family....) 

 

TODO: Parsing out the values defined in properties into usable values 

 

Comparison between CSS in XML and Regular Expressions

 

It would be very desirable if you can complete these issues in order to
make a comparison.

 

*	Structure of moki

We are not sure how is the final moki structure in this way. Can you
include a sketch of stylesheets information moki?

 

*	Structure of Tests

Currently we have two CSS tests (Measures and StyleSheetSupport) running
made in a pure XSLT way based on CSS serialization 

How would be a skeleton of any of CSS test with Regular Expressions? 

 

*	Line number 

How is reported the line number with this approach?

 

 

 

Received on Tuesday, 7 August 2007 13:21:19 UTC