On 28/07/12 01:18, C. M. Sperberg-McQueen wrote:
> On Jul 26, 2012, at 9:19 PM, Conal Tuohy wrote:
>
>> It's convenient, if you have to author CSS documents in a well-formed XML 
>> file, to be able to retain CSS validity.
> My thoughts exactly.
>
>> In order to hide CSS from HTML 3 user agents, the CSS grammar allows SGML 
>> comment delimiters, which it ignores. So with a bit of finagling you can 
>> write polyglot xml/css using just a tricky prolog and epilog, e.g.
>>
>> <!--/*--><css><![CDATA[*/
>>
>> /* Plain old css goes in here, & and < are all good */
>>
>> h1 {
>>      color: green;
>> }
>>
>> /*]]></css><!--*/-->
> That is one of the most ingenious, twisted, sick and brilliant hacks I've
> seen in a while.  Thank you for that!

Thanks Michael! :-)

Here's a slightly improved version where an XML parser which evaluates 
the text content of the css element will also get valid CSS (the 
previous version had unmatched CSS comment markers):

<!--/*--><css><![CDATA[/**/

/* Plain old css goes in here, & and < are all good */

h1 {
     color: green;
}

/*]]>*/<!--/*--></css><!--*/-->


-- 
Conal Tuohy
eResearch Business Analyst
Victorian eResearch Strategic Initiative
+61-466324297


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to