gfourny at inf.ethz.ch
Wed Jul 20 09:19:20 PDT 2011
In the current state of HTML5 as I understand it, there are two syntaxes: HTML and XHTML. Using the xmlns="http://www.w3.org/1999/xhtml" attribute in the HTML syntax is allowed but has no effect (more here: http://www.w3.org/TR/html5/elements.html#global-attributes).
An HTML parser will not expand & in script tags. As Michael suggests, using the HTML output method is the cleanest way to provide an HTML parser with the right syntax. That way, the XQuery engine will not escape & to & in script tags (quoting from the serialization specification: "The HTML output method MUST NOT perform escaping for the content of the script and style elements.").
I hope this helps.
On Jul 20, 2011, at 6:01 PM, David Lee wrote:
> Thanks, I will try this.
> I am using html tag but in the xhtml namespace ...
> <html xmlns="http://www.w3.org/1999/xhtml">
> But in the script tag its obviously not expanding the &
> I will try the CDATA trick.
> David A. Lee
> dlee at calldei.com
> -----Original Message-----
> From: Ghislain Fourny [mailto:gfourny at inf.ethz.ch]
> Sent: Wednesday, July 20, 2011 11:58 AM
> To: David Lee
> Cc: <talk at x-query.com>
> Hi David,
> I am assuming you are using HTML, not XHTML, since if I am correct, XHTML
> would recognize the & entity reference. In HTML, entity references in
> the script tag are not parsed. In XHTML they are.
> I guess a possibility could be to use a CDATA section that is ignored by
> // <cdata-section><![CDATA[
> (: code generation here :)
> // ]]></cdata-section>
> and to tell the XQuery engine to serialize the contents of the element
> <cdata-section/> using a CDATA section, using the cdata-section-elements XML
> output method:
> will be extra CDATA tags that the browser will not understand.
> Does this help?
> Kind regards,
More information about the talk