Kees Hink wrote: > > On 11/17/2010 03:56 PM, Laurence Rowe wrote: >> >> >> Kees Hink wrote: >>> >>> Our xdv theme conditionally includes certain CSS files, like >>> ie7-fixes.css: >>> >>> <!--[if IE 7]><link rel="stylesheet" href="css/ie7-fixes.css" >>> type="text/css" >>> /><![endif]--> >>> >>> It turns out the location for this file isn't transformed, probably >>> because >>> it's in a comment. This leads to missing CSS files, and therefore to bad >>> rendering, in some browsers. It also causes a 404 each time this >>> non-existent >>> CSS file is requested. This is a problem. >>> >>> The most elegant solution seems to be to rewrite the location for >>> conditionally >>> included CSS. How could i do that? >>> >>> I've searched the web a bit, and found this: >>> http://www.xml.com/pub/a/2000/09/13/xslt/index.html >>> I tried selecting the comments from the theme by doing this: >>> <xsl:template match="comment()"> >>> <p><xsl:value-of select="."/></p> >>> </xsl:template> >>> I was hoping this would wrap comments in the xdv template in <p>'s, but >>> the >>> comments were still present as-is in the transformed page. >>> >>> If i understand the article above correctly, that means our xml parser >>> (lxml) >>> doesn't put the comments in the source tree, is that correct? lxml's >>> etree.parse() has an option to strip comments, so it should be able to >>> put >>> comments in the xml source tree, in fact it appears to be the default. >>> I've >>> looked in the code for both xdv and collective.xdv, but found no >>> reference >>> to >>> lxml's remove_comments option. >>> >>> There are alternative solutions to the problem: >>> >>> We could put the correct comments in the transformed output with >>> <xsl:comment>, >>> but we wouldn't be able to drop the original comments. This would keep >>> the >>> unwanted 404's, which are a major performance drain. (We could fix this >>> by >>> creating some page templates which quickly return an empty CSS file.) >>> We'd >>> also >>> have to manually change these when the designer adds conditional CSS, >>> but >>> that's not likely to happen. >>> >>> Another approach would be to just rewrite the conditional CSS includes >>> in >>> the >>> theme templates. Unfortunately, this would mean that when our designer >>> gives us >>> updated HTML (CSS/JS), we can't just drop it into our theme product >>> anymore - >>> we'll have to modify the includes in the HTML again. Admittedly, this >>> could be >>> done by a small shell script. >>> >>> (Some background on this: Currently we have separate theme files for >>> each >>> content type, which are exactly the same ones the designer gave us. This >>> way, >>> we can easily drop in changes that the designer made by just copying >>> over >>> the >>> files.) >>> >> >> XSL templates operate on the content, not the theme. >> >> I've fixed the absolute path handling on diazo trunk to work with >> conditional comments in >> http://dev.plone.org/plone/changeset/45850/diazo/trunk > > Is there a way yet to use diazo with collective.xdv (didn't see a > repository > for "collective.diazo" yet)? Or could the change be backported to xdv? >
The will be a plone.app.theming release at some point which will be Plone 4 specific. I expect we'll want to make a collective.xdv release that uses diazo instead of xdv. But this will wait until we actually get to the point of making a release - I need to at least add some code to handle namespace updates. Laurence -- View this message in context: http://plone.293351.n2.nabble.com/collective-xdv-modify-theme-HTML-comments-conditional-CSS-tp5743684p5758557.html Sent from the Product Developers mailing list archive at Nabble.com. _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
