> -----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]