XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] CSS as XML

Hi Fraser,

If I understand you correctly, your mapping from css selectors to
xpath is isomorphic and the set of nodes selected by either is
identical. But if you don't use the xpath as such, then why do you
transform the css selectors to xpath in the first place?

Manfred

On 06/09/2007, Fraser Hore <fraserhore@hotmail.com> wrote:
> Hi Manfred,
>
> I'm not sure I completely understand question right.  I would express your
> example as follows:
>
> <style nodeset="//div[@id='namindex']//div">
>         <padding>
>                 <left unit="px">8</left>
>         </padding>
>         <text>
>                 <color unit="name">black</color>
>         </text>
>         <background>
>                 <color unit="hex">ccddff</color>
>         </background>
> </style>
>
> <style nodeset="//div[@id='namindex']//div//div">
>         <padding>
>                 <left unit="px">0</left>
>         </padding>
> </style>
>
> The second xpath expression looks a little funny but in a quick test in a
> sandbox it seemed to be fine.  The xslt would then convert the xpath back to
> css selectors as in your example (replace the // with space and the [@id='
> with . and remove the ']).
>
> The browser's css processor would then just process the css as normal.  Of
> course I don't know how to get it to do that, but that's the idea.  With
> regard to the specificity, you can see from the xpath expressions that the
> second style defines more specifically the divs that are descendents of divs
> that are descendents of divs with id 'namindex'.  So, according to the
> specificity rules it should override the first style element.
>
> Regarding your question b, I suppose if the styles are dynamically generated
> then you're right, they can't be cached.  Perhaps the xml and xslt files can
> be cached and the processing would be done at run time.
>
> Cheers,
>
> Fraser
>
> -----Original Message-----
> From: Manfred Staudinger [mailto:manfred.staudinger@gmail.com]
> Sent: September 6, 2007 5:50 AM
> To: Fraser Hore
> Cc: xml-dev@lists.xml.org
> Subject: Re: [xml-dev] CSS as XML
>
> Hi Fraser,
>
> Very interesting, indeed. Here are my questions:
> a) Consider the following rules:
> div.namindex div {
>        padding-left: 8px;
>        color: black; background: #ccddff;
> }
> div.namindex div div {
>        padding-left: 0px;
> }
> This is only a simple example for the usage of the "specificity rule".
> To calculate it seems not too difficult, but how would you map it to
> your XML representation of the CSS?
> b) If you use the <style> element, the browser cannot cache the
> stylesheet anymore, to be reused for other documents from the
> same site. Any solution for that?
>
> Manfred


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS