GNOME Bugzilla – Bug 127877
escaped quotes in element content
Last modified: 2009-08-15 18:40:50 UTC
Hi $ xsltproc --version Using libxml 20602, libxslt 10100 and libexslt 800 xsltproc was compiled against libxml 20602, libxslt 10100 and libexslt 800 libxslt 10100 was compiled against libxml 20602 libexslt 800 was compiled against libxml 20602 In my XSLT there is <style type="text/css" media="all">@import "pretty_xhtml.css";</style> When I transform my source doc with XSLTProc the output contains <style type="text/css" media="all">@import "pretty_xhtml.css";</style> (no matter if I set UTF-8 or US-ASCII as output encoding) My browser's CSS engine does not handle the import statement when the quotes are escaped. (IIRC Saxon gave me unescaped quotes) <style type="text/css" media="all">@import 'pretty_xhtml.css';</style> results in <style type="text/css" media="all">@import 'pretty_xhtml.css';</style> which works in browsers. Even if the actual issue is with the browser: XSLTProc's behaviour doesn't seem consistent (" is escaped while ' is not). Since I see no need to escape quotes in element content I suggest to not escape them. (I think quotes only need to be escaped inside attribute values which are delimited by quotes (not apostrophes)) Tobi
Well <style> is *very* specific. I can't even tell from your report how you do the serialization (HTML, XML, XML + XHTML1 DOCTYPE ?) Please conform to the request at http://xmlsoft.org/XSLT/bugs.html and provide full examples to reproduce the problem. Daniel
Pressed the wrong button, state is needinfo ! Daniel
I can imagine no scenario where quotes in element content should be escaped. What would be wrong about changing XSLTProc to never escape them, no matter what serialization options are set? I don't see how the style element should be an exception, and I don't see how I would want to get " in the output for a simple " in the input or in the XSLT. But to fulfill your request: quot.xslt: <?xml version="1.0" encoding="UTF-8"?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml"> <xsl:output method="xml" version="1.0" indent="yes" encoding="US-ASCII" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" /> <xsl:template match="/"> <html> <head> <style type="text/css" media="all">@import "pretty_xhtml.css";</style> </head> <body> <h1>foo</h1> </body> </html> </xsl:template> </xsl:transform> quot.xml: <?xml version="1.0" encoding="UTF-8"?> <foo/> $ xsltproc -o quot.xhtml quot.xslt quot.xml $ cat quot.xhtml <?xml version="1.0" encoding="US-ASCII"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" /> <style type="text/css" media="all">@import "pretty_xhtml.css";</style> </head> <body> <h1>foo</h1> </body> </html> $
<style> and <script> MUST be handled differently in HTML, look at the spec, they are not defined like other elements, and for XHTML http://www.w3.org/TR/xhtml1/#C_4 indicates why the serialization code path is different for this element. So maybe you don't see why I need those informations, I do see why I need them, that's why I ask, and not a reason to be so agressive (again !). Daniel
> <style> and <script> MUST be handled differently in HTML, > look at the spec, they are not defined like other elements, > and for XHTML http://www.w3.org/TR/xhtml1/#C_4 indicates > why the serialization code path is different for this element. The escaped quote made the browser ignore the stylesheet which seems to go against the "HTML compatibility" described in that Appendix. What's the reason for escaping the quotes? > So maybe you don't see why I need those informations, I do > see why I need them, that's why I ask, and not a reason to > be so agressive I wasn't agressive. I asked clear technical questions: "What would be wrong about changing XSLTProc to never escape them, no matter what serialization options are set?" and less directly: Under which cicumstances would want to get " in the output for a simple '"' in the input or in the XSLT? There is no personal criticism, no aggression, no attack. In case you misunderstood my words: Rest assured that my intention was to discuss technical details, not to offend you in any way or express anything to you personally. > (again !) I'm not sure why you would want to re-open a resolved issue. In case you forgot, we found out that the problem was just as much on your side, see http://mail.gnome.org/archives/xml/2003-November/msg00137.html
> What's the reason for escaping the quotes? There aren't any. So I must reproduce the problem. Which is why I asked for a complete set, that's all ! You seems to consider it is there on purpose. I don't think it's the case. Libxml2 does not escape " by default in element content paphio:~/XML -> cat tst.xml <bar> "test" </bar> paphio:~/XML -> xmllint tst.xml <?xml version="1.0"?> <bar> "test" </bar> paphio:~/XML -> I knew that, so I said it was probably related to script because it is handled differently. >In my XSLT there is > ><style type="text/css" media="all">@import "pretty_xhtml.css";</style> can lead to 3 different code paths depending on the xsl:output used. I can't see why all 3 would have the problem, or the same bug exists in all 3 code paths. Daniel
Okay the bug is fixed in CVS now, Daniel
This should be closed by release of libxslt-1.1.5, thanks, Daniel