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.) Kees _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
