[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: CSS as XML

  • From: "Manfred Staudinger" <manfred.staudinger@g...>
  • To: "Fraser Hore" <fraserhore@h...>
  • Date: Fri, 7 Sep 2007 13:13:03 +0200

Re:  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@h...> 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@g...]
> Sent: September 6, 2007 5:50 AM
> To: Fraser Hore
> Cc: xml-dev@l...
> Subject: Re:  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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.