Cocoon
  1. Cocoon
  2. COCOON-1839

exception2html.xslt <script /> causes IE display problem

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.9
    • Fix Version/s: 2.1.10, 2.2
    • Component/s: * Cocoon Core
    • Labels:
      None
    • Other Info:
      Patch available

      Description

      The IE rendering engine will show a blank page if the document contains a minimal (self-closing) <script /> tag.
      By putting in an nbsp (&#160;) or a new line, the XSLT produces <script> </script>, which then allows IE to properly display the page.
      The attached page (license granted to asf) adds a non-breaking space to keep the tag from being collapsed.

              <script src="{$contextPath}/scripts/main.js" type="text/javascript">
               &#160;
              </script>

        Issue Links

          Activity

          Hide
          Eric Meyer added a comment -
          Actually, a new-line isn't sufficient. &#160; does work, though.
          Show
          Eric Meyer added a comment - Actually, a new-line isn't sufficient. &#160; does work, though.
          Hide
          Jean-Baptiste Quenot added a comment -
          A JavaScript line terminator ";" would be actually more accurate. But the real problem is in the serializer. As we are using the "html" serializer, it should take care of properly serializing the <script></script> tag. If we fix the problem in exception2html.xslt, we will likely have to fix it in a lot more files as well.
          Show
          Jean-Baptiste Quenot added a comment - A JavaScript line terminator ";" would be actually more accurate. But the real problem is in the serializer. As we are using the "html" serializer, it should take care of properly serializing the <script></script> tag. If we fix the problem in exception2html.xslt, we will likely have to fix it in a lot more files as well.
          Hide
          Antonio Gallardo added a comment -
          FYI, <script></script> is a a properly serialized tag. The problem is the well know bug in the IE rendering engine as Eric pointed out. I prefer Eric fix, because a "blank" character is better than an empty instruction.
          Show
          Antonio Gallardo added a comment - FYI, <script></script> is a a properly serialized tag. The problem is the well know bug in the IE rendering engine as Eric pointed out. I prefer Eric fix, because a "blank" character is better than an empty instruction.
          Hide
          Antonio Gallardo added a comment -
          Eric, would you try to move <script> right after the title? IMHO, it should work. Something like:

                <head>
                  <title>....</title>
                  <script src="{$contextPath}/scripts/main.js" type="text/javascript"/>
                 ......
                </head>
              
          Just let me know if this woks and I will commit the fix. Many thanks in advance.
          Show
          Antonio Gallardo added a comment - Eric, would you try to move <script> right after the title? IMHO, it should work. Something like:       <head>         <title>....</title>         <script src="{$contextPath}/scripts/main.js" type="text/javascript"/>        ......       </head>      Just let me know if this woks and I will commit the fix. Many thanks in advance.
          Hide
          Eric Meyer added a comment -
          You are correct. I am using the xml serializer. However, it does not appear possible to use the xhtml serializer with the xhtml1.1 doctype (though it does look like I could subclass it, and override the configure method).

                <map:serializer name="oacs-xhtml11"
                  src="org.apache.cocoon.serialization.XMLSerializer"
                  logger="sitemap.serializer.xhtml"
                  mime-type="text/html; charset=utf-8" pool-grow="4"
                  pool-max="200" pool-min="4">
                  <doctype-public>-//W3C//DTD XHTML 1.1//EN</doctype-public>
                  <doctype-system>
                    http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
                  </doctype-system>
                  <encoding>UTF-8</encoding>
                  <omit-xml-declaration>yes</omit-xml-declaration>
                </map:serializer>
          Show
          Eric Meyer added a comment - You are correct. I am using the xml serializer. However, it does not appear possible to use the xhtml serializer with the xhtml1.1 doctype (though it does look like I could subclass it, and override the configure method).       <map:serializer name="oacs-xhtml11"         src="org.apache.cocoon.serialization.XMLSerializer"         logger="sitemap.serializer.xhtml"         mime-type="text/html; charset=utf-8" pool-grow="4"         pool-max="200" pool-min="4">         <doctype-public>-//W3C//DTD XHTML 1.1//EN</doctype-public>         <doctype-system>            http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd         </doctype-system>         <encoding>UTF-8</encoding>         <omit-xml-declaration>yes</omit-xml-declaration>       </map:serializer>
          Hide
          Eric Meyer added a comment -
          This problem goes away when I use the right serializer (or at least what I think is the right one - see below)

                <map:serializer name="oacs-xhtml11"
                  src="org.apache.cocoon.serialization.HTMLSerializer"
                  logger="sitemap.serializer.xhtml"
                  mime-type="text/html; charset=utf-8" pool-grow="4"
                  pool-max="200" pool-min="4">
                  <doctype-public>-//W3C//DTD XHTML 1.1//EN</doctype-public>
                  <doctype-system>
                    http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
                  </doctype-system>
                  <encoding>UTF-8</encoding>
                  <omit-xml-declaration>yes</omit-xml-declaration>
                </map:serializer>

          Note that it is confusing that there are so many different html/xhtml serialization options, some named the same but in different packages with different behaviors.

          org.apache.cocoon.components.serializers.HTMLSerialzer
          org.apache.cocoon.serialization.HTMLSerializer
          org.apache.cocoon.components.serializers.XHTMLSerialzer
          org.apache.cocoon..components.serializers.XMLSerializer
          org.apache.cocoon..components.sax.XMLSerializer
          org.apache.cocoon.serialization.XMLSerializer

          For example, I tried the org.apache.cocoon.components.serializers.XHTMLSerialzer, but that escapes quotes inside attributes and script elements - breaking the javascript in IE.

          Regards,
          Eric Meyer
          Show
          Eric Meyer added a comment - This problem goes away when I use the right serializer (or at least what I think is the right one - see below)       <map:serializer name="oacs-xhtml11"         src="org.apache.cocoon.serialization.HTMLSerializer"         logger="sitemap.serializer.xhtml"         mime-type="text/html; charset=utf-8" pool-grow="4"         pool-max="200" pool-min="4">         <doctype-public>-//W3C//DTD XHTML 1.1//EN</doctype-public>         <doctype-system>            http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd         </doctype-system>         <encoding>UTF-8</encoding>         <omit-xml-declaration>yes</omit-xml-declaration>       </map:serializer> Note that it is confusing that there are so many different html/xhtml serialization options, some named the same but in different packages with different behaviors. org.apache.cocoon.components.serializers.HTMLSerialzer org.apache.cocoon.serialization.HTMLSerializer org.apache.cocoon.components.serializers.XHTMLSerialzer org.apache.cocoon..components.serializers.XMLSerializer org.apache.cocoon..components.sax.XMLSerializer org.apache.cocoon.serialization.XMLSerializer For example, I tried the org.apache.cocoon.components.serializers.XHTMLSerialzer, but that escapes quotes inside attributes and script elements - breaking the javascript in IE. Regards, Eric Meyer
          Hide
          Vadim Gritsenko added a comment -
          Eric,

          Above serializer declaration (oacs-xhtml11) is not valid, even if it works. It is not either HTML nor XHTML. For XHTML, you have to use XMLSerializer, since XHTML is an XML, and you have to use correct XHTML mime type [1]. For HTML, you have to use HTML's document type, not XHTML's.

          Vadim

          [1] http://www.w3.org/TR/xhtml-media-types/
          Show
          Vadim Gritsenko added a comment - Eric, Above serializer declaration (oacs-xhtml11) is not valid, even if it works. It is not either HTML nor XHTML. For XHTML, you have to use XMLSerializer, since XHTML is an XML, and you have to use correct XHTML mime type [1]. For HTML, you have to use HTML's document type, not XHTML's. Vadim [1] http://www.w3.org/TR/xhtml-media-types/
          Hide
          Vadim Gritsenko added a comment -
          PS Serializers from org.apache.cocoon.serialization package are "standard",
          core" Cocoon serializers. Those from org.apache.cocoon..components.serializers package are part of the optional serialization block, and are "optional", "advanced" serializers.
          Show
          Vadim Gritsenko added a comment - PS Serializers from org.apache.cocoon.serialization package are "standard", core" Cocoon serializers. Those from org.apache.cocoon..components.serializers package are part of the optional serialization block, and are "optional", "advanced" serializers.
          Hide
          Eric Meyer added a comment -
          Hi Vadim,

          Good point. So - back to the original issue in this thread: exception2html.xslt does not work properly when used to produce xhtml using the xml serializer.

          Regards,
          Eric
          Show
          Eric Meyer added a comment - Hi Vadim, Good point. So - back to the original issue in this thread: exception2html.xslt does not work properly when used to produce xhtml using the xml serializer. Regards, Eric
          Hide
          Antonio Gallardo added a comment -
          Due IE bug this is the same issue.
          Show
          Antonio Gallardo added a comment - Due IE bug this is the same issue.
          Hide
          Antonio Gallardo added a comment -
          Thanks for the patch. Patch applied in 2.1.10-dev and 2.2-dev. Feel free to reopen if needed.
          Show
          Antonio Gallardo added a comment - Thanks for the patch. Patch applied in 2.1.10-dev and 2.2-dev. Feel free to reopen if needed.

            People

            • Assignee:
              Antonio Gallardo
              Reporter:
              Eric Meyer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development