Re: XCSS?
On 12.01.2006 19:37, Stephen Winnall wrote: Does anyone know of a way of writing something that could be called XCSS, i.e. CSS written in an XML syntax, which can be transformed/serialised into proper CSS? Don't know what it is worth, but there is something in the Cocoon bug tracker: http://issues.apache.org/jira/browse/COCOON-1200. Jörg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XCSS?
Hi, I havent seen the JXCSS library before, i'll have a look at that when I get time. I can't remember where I got this format of XML from, I think it was a W3C mailing list, but nothing ever came of it. Assuming an XCSS file like: ?xml version=1.0 encoding=UTF-8? style type=text/xcss rule selectors selector element= class=theme-href pseudo=/ /selectors properties property name=color#fff/property property name=background-color#fff/property property name=margin-left1px/property property name=margin-right2px/property /properties /rule rule selectors selector element= class=theme-href pseudo= selector element=a class= pseudo=link/ /selector /selectors properties property name=background-color#fff/property property name=color#fff/property /properties /rule rule selectors selector element= class=theme-href pseudo= selector element=a class= pseudo=visited/ /selector /selectors properties property name=background-color#fff/property property name=color#fff/property /properties /rule rule selectors selector element= class=theme-para pseudo=/ /selectors properties property name=background-color#fff/property property name=color#fff/property /properties /rule /style XSLT: xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xsl:output omit-xml-declaration=yes method=text/ xsl:template match=[EMAIL PROTECTED] = 'text/xcss'] xsl:apply-templates / /xsl:template xsl:template match=rulexsl:if test=count( properties/property[text() != ''] ) xsl:apply-templates select=selectors/selector/{ xsl:apply-templates select=properties/property/ } /xsl:if/xsl:template xsl:template match=selector xsl:value-of select=@element/ xsl:if test=@class != ''.xsl:value-of select=@class//xsl:if xsl:if test=@pseudo != '':xsl:value-of select=@pseudo//xsl:if xsl:text /xsl:text xsl:apply-templates select=selector/ xsl:if test=position() != last(), /xsl:if /xsl:template xsl:template match=property xsl:if test=. != ''xsl:value-of select=@name/: xsl:value-of select=./; /xsl:if/xsl:template /xsl:stylesheet I have some perl scripts that will do a one-off conversion from CSS to XCSS (if thats what the above is) if you want a look. Steve Metcalfe On 12/01/06, Stephen Winnall [EMAIL PROTECTED] wrote: Thanks, Chris. I find your solution rather clever. It avoids the necessity of an XCSS altogether, doesn't it? I like that. Steve On 12 Jan 2006, at 22:21, Chris Marasti-Georg wrote: source.css: css whatever { css: source; in: here; } and { an: i18n:tag here=/ } /css ie.xslt: xsl:transform... xsl:template match=/css css xsl:copy-of select=* some { ie: specific; css: here; } with { an: i18n:tag here=/ } /css /xsl:template /xsl:transform css.xslt: xsl:transform xsl:template match=/css xsl:value-of select=./ /xsl:template /xsl:transform Sitemap (pseudo): map:match *.css map:generate source.css/ if browser is standards- and security-challenged { map:transform ie.xslt/ } map:transform I18N/ map:transform css.xslt/ map:serialise text/ /map:match -Original Message- From: Stephen Winnall [mailto:[EMAIL PROTECTED] Sent: Thursday, January 12, 2006 3:49 PM To: users@cocoon.apache.org Cc: Bob Harner; Chris Marasti-Georg Subject: Re: XCSS? Thanks to Bob and Chris for their feedback. However, my question is not how to serve up different CSS files depending on the target browser. What I would like to do is create those different CSS files from a single source (e.g. a transformer creates different CSS files from a common source depending on what the target browser is). It seems to me that it would be trivial if CSS had an XML syntax: my questions are: 1) is there a suitable XML DTD or schema for something (let's call it XCSS) which is 1-to-1 mappable to CSS? 2) does an appropriate transformation (or serialisation) from XCSS to CSS exist? One answer to 1) is yes, see JXCSS. An answer to 2) is what I am looking for. The pipeline should look something like the following (if you'll excuse the meta-syntax): match *.css generate XCSS from a single source if browser is standards- and security-challenged { transform the XCSS stream to suit } transform for I18N transform from XCSS to CSS
Re: XCSS?
Thanks for this, Steve. It's what I originally asked for, but at the moment I tend towards the solution which Chris came up with (stick css and /css round a straight CSS file and treat everything inbetween as mixed) because it seems simpler (for some subjective value of simple...). Steve On 13 Jan 2006, at 10:17, Steve Metcalfe wrote: Hi, I havent seen the JXCSS library before, i'll have a look at that when I get time. I can't remember where I got this format of XML from, I think it was a W3C mailing list, but nothing ever came of it. Assuming an XCSS file like: ?xml version=1.0 encoding=UTF-8? style type=text/xcss rule selectors selector element= class=theme-href pseudo=/ /selectors properties property name=color#fff/property property name=background-color#fff/property property name=margin-left1px/property property name=margin-right2px/property /properties /rule rule selectors selector element= class=theme-href pseudo= selector element=a class= pseudo=link/ /selector /selectors properties property name=background-color#fff/property property name=color#fff/property /properties /rule rule selectors selector element= class=theme-href pseudo= selector element=a class= pseudo=visited/ /selector /selectors properties property name=background-color#fff/property property name=color#fff/property /properties /rule rule selectors selector element= class=theme-para pseudo=/ /selectors properties property name=background-color#fff/property property name=color#fff/property /properties /rule /style XSLT: xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/ Transform xsl:output omit-xml-declaration=yes method=text/ xsl:template match=[EMAIL PROTECTED] = 'text/xcss'] xsl:apply-templates / /xsl:template xsl:template match=rulexsl:if test=count( properties/property[text() != ''] ) xsl:apply-templates select=selectors/selector/{ xsl:apply-templates select=properties/property/ } /xsl:if/xsl:template xsl:template match=selector xsl:value-of select=@element/ xsl:if test=@class != ''.xsl:value-of select=@class//xsl:if xsl:if test=@pseudo != '':xsl:value-of select=@pseudo//xsl:if xsl:text /xsl:text xsl:apply-templates select=selector/ xsl:if test=position() != last(), /xsl:if /xsl:template xsl:template match=property xsl:if test=. != ''xsl:value-of select=@name/: xsl:value-of select=./; /xsl:if/xsl:template /xsl:stylesheet I have some perl scripts that will do a one-off conversion from CSS to XCSS (if thats what the above is) if you want a look. Steve Metcalfe On 12/01/06, Stephen Winnall [EMAIL PROTECTED] wrote: Thanks, Chris. I find your solution rather clever. It avoids the necessity of an XCSS altogether, doesn't it? I like that. Steve On 12 Jan 2006, at 22:21, Chris Marasti-Georg wrote: source.css: css whatever { css: source; in: here; } and { an: i18n:tag here=/ } /css ie.xslt: xsl:transform... xsl:template match=/css css xsl:copy-of select=* some { ie: specific; css: here; } with { an: i18n:tag here=/ } /css /xsl:template /xsl:transform css.xslt: xsl:transform xsl:template match=/css xsl:value-of select=./ /xsl:template /xsl:transform Sitemap (pseudo): map:match *.css map:generate source.css/ if browser is standards- and security-challenged { map:transform ie.xslt/ } map:transform I18N/ map:transform css.xslt/ map:serialise text/ /map:match -Original Message- From: Stephen Winnall [mailto:[EMAIL PROTECTED] Sent: Thursday, January 12, 2006 3:49 PM To: users@cocoon.apache.org Cc: Bob Harner; Chris Marasti-Georg Subject: Re: XCSS? Thanks to Bob and Chris for their feedback. However, my question is not how to serve up different CSS files depending on the target browser. What I would like to do is create those different CSS files from a single source (e.g. a transformer creates different CSS files from a common source depending on what the target browser is). It seems to me that it would be trivial if CSS had an XML syntax: my questions are: 1) is there a suitable XML DTD or schema for something (let's call it XCSS) which is 1-to-1 mappable to CSS? 2) does an appropriate transformation (or serialisation) from XCSS to CSS exist? One answer to 1) is yes, see JXCSS. An answer to 2) is what I am looking for. The pipeline should look something like the following (if you'll excuse the meta-syntax): match *.css generate
Re: XCSS?
On Thu, 2006-01-12 at 18:37, Stephen Winnall wrote: I am setting up a website using Cocoon and want to generate XHTML and use CSS to handle the presentation. Like everyone else I am being bitten by the fact that 90% of all browsers conform to the CSS standard, but the browser that 90% of the users use does not :-( grin http://explorerdestroyer.com/ /grin Does anyone know of a way of writing something that could be called XCSS, i.e. CSS written in an XML syntax, which can be transformed/serialised into proper CSS? This would be a useful project: to codify all known differences in CSS support and behaviour between the browsers. DocBook already has the structure needed to support effectivities and it would be fairly easy to add or modify (eg making the vendor attribute IDREFS so you can make robust references to the browser versions funcsynopsis id=attr conformance=css2 vendor=ff1.5 ff1.4 funcprototype funcdefattr/funcdef paramdefattribute name/paramdef /funcprototype funcsynopsisinfoReturns the value of the named attribute for the currently-selected element type./funcsynopsisinfo /funcsynopsis ///Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: XCSS?
-Original Message- From: Stephen Winnall [mailto:[EMAIL PROTECTED] Sent: Thursday, January 12, 2006 1:37 PM To: Cocoon Users Subject: XCSS? I am setting up a website using Cocoon and want to generate XHTML and use CSS to handle the presentation. Like everyone else I am being bitten by the fact that 90% of all browsers conform to the CSS standard, but the browser that 90% of the users use does not :-( (I think) I have managed to banish all the browser dependencies (for my site, at least) into the CSS file and I have a clean SoC-like separation of content and presentation. So what I would now like to do is use Cocoon to generate different CSS files to accommodate MSIE. I would also like to handle some I18N issues I have in the CSS files. snip 2 options: The good way: Separate css files sit in a directory, and you use a user-agent selector in your sitemap to handle *.css requests E.G. map:match *.css map:select type=browser map:when test=ie map:read src={1}-ie.css/ /map:when map:otherwise map:read src={1}.css/ /map:otherwise /map:select /map:match Another thing you could do to avoid code duplication is have 2 css files per page, main.css and browser.css. Main.css would have common styles, and be served universally, while browser.css would go through the selector above. Second way, which I don't like so much, and is probably not a best practice, would be something along the following lines. You could probably use some other combination of generator inputs (maybe request generator, and look at the useragent from that?) and so on: map:generate src=blank.xml/ (where blank.xml is just something like blank/) map:transform src=css-gen.xsl mnap:parameter name=ua select=some-way-to-get-the-browser-in-here/ /map:transform map:serialize type=text/ Css-gen.xsl along these lines: xsl:match select=/ body { some: style; } div { some: style; } #specialThing{ border: 3px; map:choose map:when test=ua = 'ie' width: 194px; /map:when map:otherwise width: 200px; /map:otherwise /map:choose } /xsl:match - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XCSS?
On 1/12/06, Stephen Winnall [EMAIL PROTECTED] wrote: I am setting up a website using Cocoon and want to generate XHTML and use CSS to handle the presentation. Like everyone else I am being bitten by the fact that 90% of all browsers conform to the CSS standard, but the browser that 90% of the users use does not :-( (I think) I have managed to banish all the browser dependencies (for my site, at least) into the CSS file and I have a clean SoC-like separation of content and presentation. So what I would now like to do is use Cocoon to generate different CSS files to accommodate MSIE. I would also like to handle some I18N issues I have in the CSS files. Does anyone know of a way of writing something that could be called XCSS, i.e. CSS written in an XML syntax, which can be transformed/serialised into proper CSS? Apart from passing remarks (including one from the maestro at http://mail-archives.apache.org/mod_mbox/cocoon-dev/23.mbox/% [EMAIL PROTECTED] ) I have been unable to find any references to much like this. I have spent about some time trawling Google, but XSL and CSS are not good search terms (they throw up too many results), and XCSS doesn't throw up anything conclusive, although the results do confirm that I am not the first person who wants to do this. The project JXCSS does the other thing, i.e. convert CSS into XCSS, but the documentation says that there is no transformation available to produce CSS from XCSS: Stylesheets need to be written to generate and pretty-print CSS source code I will admit to being reluctant to write such a stylesheet myself because I am already severely sidetracked doing this website, and I need to get back to my other tasks. I would be grateful for any hints on where to look. And if there is a Better Way, please let me know. Steve Well, in cocoon it's pretty easy to serve up different CSS files based on the browser. Per http://cocoon.apache.org/2.1/userdocs/browser-selector.html just use a BrowerSelector component, and within each branch call a reader with the src attribute for each pointing to either the ie or non-ie CSS file. Will this work for you? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XCSS?
Thanks to Bob and Chris for their feedback. However, my question is not how to serve up different CSS files depending on the target browser. What I would like to do is create those different CSS files from a single source (e.g. a transformer creates different CSS files from a common source depending on what the target browser is). It seems to me that it would be trivial if CSS had an XML syntax: my questions are: 1) is there a suitable XML DTD or schema for something (let's call it XCSS) which is 1-to-1 mappable to CSS? 2) does an appropriate transformation (or serialisation) from XCSS to CSS exist? One answer to 1) is yes, see JXCSS. An answer to 2) is what I am looking for. The pipeline should look something like the following (if you'll excuse the meta-syntax): match *.css generate XCSS from a single source if browser is standards- and security-challenged { transform the XCSS stream to suit } transform for I18N transform from XCSS to CSS serialise using TextSerializer or perhaps the serialisation could go direct from XCSS rather like FO or POI. The XHTML should contain no style tags to preserve SoC. In my XHTML, all I want to have is link href=my.css ... Steve On 12 Jan 2006, at 19:37, Stephen Winnall wrote: I am setting up a website using Cocoon and want to generate XHTML and use CSS to handle the presentation. Like everyone else I am being bitten by the fact that 90% of all browsers conform to the CSS standard, but the browser that 90% of the users use does not :-( (I think) I have managed to banish all the browser dependencies (for my site, at least) into the CSS file and I have a clean SoC-like separation of content and presentation. So what I would now like to do is use Cocoon to generate different CSS files to accommodate MSIE. I would also like to handle some I18N issues I have in the CSS files. Does anyone know of a way of writing something that could be called XCSS, i.e. CSS written in an XML syntax, which can be transformed/serialised into proper CSS? Apart from passing remarks (including one from the maestro at http://mail-archives.apache.org/mod_mbox/cocoon-dev/23.mbox/% [EMAIL PROTECTED] ) I have been unable to find any references to much like this. I have spent about some time trawling Google, but XSL and CSS are not good search terms (they throw up too many results), and XCSS doesn't throw up anything conclusive, although the results do confirm that I am not the first person who wants to do this. The project JXCSS does the other thing, i.e. convert CSS into XCSS, but the documentation says that there is no transformation available to produce CSS from XCSS: Stylesheets need to be written to generate and pretty-print CSS source code I will admit to being reluctant to write such a stylesheet myself because I am already severely sidetracked doing this website, and I need to get back to my other tasks. I would be grateful for any hints on where to look. And if there is a Better Way, please let me know. Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: XCSS?
source.css: css whatever { css: source; in: here; } and { an: i18n:tag here=/ } /css ie.xslt: xsl:transform... xsl:template match=/css css xsl:copy-of select=* some { ie: specific; css: here; } with { an: i18n:tag here=/ } /css /xsl:template /xsl:transform css.xslt: xsl:transform xsl:template match=/css xsl:value-of select=./ /xsl:template /xsl:transform Sitemap (pseudo): map:match *.css map:generate source.css/ if browser is standards- and security-challenged { map:transform ie.xslt/ } map:transform I18N/ map:transform css.xslt/ map:serialise text/ /map:match -Original Message- From: Stephen Winnall [mailto:[EMAIL PROTECTED] Sent: Thursday, January 12, 2006 3:49 PM To: users@cocoon.apache.org Cc: Bob Harner; Chris Marasti-Georg Subject: Re: XCSS? Thanks to Bob and Chris for their feedback. However, my question is not how to serve up different CSS files depending on the target browser. What I would like to do is create those different CSS files from a single source (e.g. a transformer creates different CSS files from a common source depending on what the target browser is). It seems to me that it would be trivial if CSS had an XML syntax: my questions are: 1) is there a suitable XML DTD or schema for something (let's call it XCSS) which is 1-to-1 mappable to CSS? 2) does an appropriate transformation (or serialisation) from XCSS to CSS exist? One answer to 1) is yes, see JXCSS. An answer to 2) is what I am looking for. The pipeline should look something like the following (if you'll excuse the meta-syntax): match *.css generate XCSS from a single source if browser is standards- and security-challenged { transform the XCSS stream to suit } transform for I18N transform from XCSS to CSS serialise using TextSerializer or perhaps the serialisation could go direct from XCSS rather like FO or POI. The XHTML should contain no style tags to preserve SoC. In my XHTML, all I want to have is link href=my.css ... Steve On 12 Jan 2006, at 19:37, Stephen Winnall wrote: I am setting up a website using Cocoon and want to generate XHTML and use CSS to handle the presentation. Like everyone else I am being bitten by the fact that 90% of all browsers conform to the CSS standard, but the browser that 90% of the users use does not :-( (I think) I have managed to banish all the browser dependencies (for my site, at least) into the CSS file and I have a clean SoC-like separation of content and presentation. So what I would now like to do is use Cocoon to generate different CSS files to accommodate MSIE. I would also like to handle some I18N issues I have in the CSS files. Does anyone know of a way of writing something that could be called XCSS, i.e. CSS written in an XML syntax, which can be transformed/serialised into proper CSS? Apart from passing remarks (including one from the maestro at http://mail-archives.apache.org/mod_mbox/cocoon-dev/23.mbox/% [EMAIL PROTECTED] ) I have been unable to find any references to much like this. I have spent about some time trawling Google, but XSL and CSS are not good search terms (they throw up too many results), and XCSS doesn't throw up anything conclusive, although the results do confirm that I am not the first person who wants to do this. The project JXCSS does the other thing, i.e. convert CSS into XCSS, but the documentation says that there is no transformation available to produce CSS from XCSS: Stylesheets need to be written to generate and pretty-print CSS source code I will admit to being reluctant to write such a stylesheet myself because I am already severely sidetracked doing this website, and I need to get back to my other tasks. I would be grateful for any hints on where to look. And if there is a Better Way, please let me know. Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XCSS?
Thanks, Chris. I find your solution rather clever. It avoids the necessity of an XCSS altogether, doesn't it? I like that. Steve On 12 Jan 2006, at 22:21, Chris Marasti-Georg wrote: source.css: css whatever { css: source; in: here; } and { an: i18n:tag here=/ } /css ie.xslt: xsl:transform... xsl:template match=/css css xsl:copy-of select=* some { ie: specific; css: here; } with { an: i18n:tag here=/ } /css /xsl:template /xsl:transform css.xslt: xsl:transform xsl:template match=/css xsl:value-of select=./ /xsl:template /xsl:transform Sitemap (pseudo): map:match *.css map:generate source.css/ if browser is standards- and security-challenged { map:transform ie.xslt/ } map:transform I18N/ map:transform css.xslt/ map:serialise text/ /map:match -Original Message- From: Stephen Winnall [mailto:[EMAIL PROTECTED] Sent: Thursday, January 12, 2006 3:49 PM To: users@cocoon.apache.org Cc: Bob Harner; Chris Marasti-Georg Subject: Re: XCSS? Thanks to Bob and Chris for their feedback. However, my question is not how to serve up different CSS files depending on the target browser. What I would like to do is create those different CSS files from a single source (e.g. a transformer creates different CSS files from a common source depending on what the target browser is). It seems to me that it would be trivial if CSS had an XML syntax: my questions are: 1) is there a suitable XML DTD or schema for something (let's call it XCSS) which is 1-to-1 mappable to CSS? 2) does an appropriate transformation (or serialisation) from XCSS to CSS exist? One answer to 1) is yes, see JXCSS. An answer to 2) is what I am looking for. The pipeline should look something like the following (if you'll excuse the meta-syntax): match *.css generate XCSS from a single source if browser is standards- and security-challenged { transform the XCSS stream to suit } transform for I18N transform from XCSS to CSS serialise using TextSerializer or perhaps the serialisation could go direct from XCSS rather like FO or POI. The XHTML should contain no style tags to preserve SoC. In my XHTML, all I want to have is link href=my.css ... Steve On 12 Jan 2006, at 19:37, Stephen Winnall wrote: I am setting up a website using Cocoon and want to generate XHTML and use CSS to handle the presentation. Like everyone else I am being bitten by the fact that 90% of all browsers conform to the CSS standard, but the browser that 90% of the users use does not :-( (I think) I have managed to banish all the browser dependencies (for my site, at least) into the CSS file and I have a clean SoC-like separation of content and presentation. So what I would now like to do is use Cocoon to generate different CSS files to accommodate MSIE. I would also like to handle some I18N issues I have in the CSS files. Does anyone know of a way of writing something that could be called XCSS, i.e. CSS written in an XML syntax, which can be transformed/serialised into proper CSS? Apart from passing remarks (including one from the maestro at http://mail-archives.apache.org/mod_mbox/cocoon-dev/23.mbox/% [EMAIL PROTECTED] ) I have been unable to find any references to much like this. I have spent about some time trawling Google, but XSL and CSS are not good search terms (they throw up too many results), and XCSS doesn't throw up anything conclusive, although the results do confirm that I am not the first person who wants to do this. The project JXCSS does the other thing, i.e. convert CSS into XCSS, but the documentation says that there is no transformation available to produce CSS from XCSS: Stylesheets need to be written to generate and pretty-print CSS source code I will admit to being reluctant to write such a stylesheet myself because I am already severely sidetracked doing this website, and I need to get back to my other tasks. I would be grateful for any hints on where to look. And if there is a Better Way, please let me know. Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]