Derby
  1. Derby
  2. DERBY-5359

Missing xmlns attribute for html element in docs

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.9.1.0
    • Fix Version/s: 10.10.1.1
    • Component/s: Documentation
    • Labels:
      None
    1. derby5359.diff
      1 kB
      Jayaram Subramanian
    2. html.zip
      5 kB
      Jayaram Subramanian
    3. derby5359-ref.diff
      5 kB
      Jayaram Subramanian
    4. derby5359-ref-stat.txt
      0.3 kB
      Jayaram Subramanian
    5. files-derby5359.zip
      52 kB
      Jayaram Subramanian
    6. xmlns.diff
      1 kB
      Knut Anders Hatlen

      Issue Links

        Activity

        Hide
        Jayaram Subramanian added a comment -

        Hi Knut
        I am interested in taking up this task.. Is that fine and kindly direct me on where to start off here.

        Show
        Jayaram Subramanian added a comment - Hi Knut I am interested in taking up this task.. Is that fine and kindly direct me on where to start off here.
        Hide
        Knut Anders Hatlen added a comment -

        Hi Jayaram. Thanks for volunteering.

        You may want to take a look at the changes Kim made in DERBY-4408, as similar changes will be needed for this issue. Here's what I think we have to do:

        1) For the index.html files, the xmlns attribute could be added directly to the template file lib/index.html in the docs repository.

        2) lib/map2htmtoc.xsl needs code to add the missing attribute to toc.html.

        3) lib/dita2htmlImpl.xsl needs code to add the missing attribute to the various topics.

        Show
        Knut Anders Hatlen added a comment - Hi Jayaram. Thanks for volunteering. You may want to take a look at the changes Kim made in DERBY-4408 , as similar changes will be needed for this issue. Here's what I think we have to do: 1) For the index.html files, the xmlns attribute could be added directly to the template file lib/index.html in the docs repository. 2) lib/map2htmtoc.xsl needs code to add the missing attribute to toc.html. 3) lib/dita2htmlImpl.xsl needs code to add the missing attribute to the various topics.
        Hide
        Jayaram Subramanian added a comment -

        Hi,
        Made changes as mentioned above. But when building with ant html.ref encountered the following issue.... Curiously i didnt modify these files

        dita.topics.xhtml:
        [xslt] Transforming into C:\derby-documentation\trunk\out\reftemp
        [xslt] Processing C:\derby-documentation\trunk\temp\crefjavbclobnot.dita to
        C:\derby-documentation\trunk\out\reftemp\crefjavbclobnot.html
        [xslt] Loading stylesheet C:\derby-documentation\trunk\DITA-OT1.1.2.1\xsl\d
        ita2xhtml.xsl
        [xslt] com.sun.org.apache.bcel.internal.generic.ClassGenException: Branch t
        arget offset too large for short

        Show
        Jayaram Subramanian added a comment - Hi, Made changes as mentioned above. But when building with ant html.ref encountered the following issue.... Curiously i didnt modify these files dita.topics.xhtml: [xslt] Transforming into C:\derby-documentation\trunk\out\reftemp [xslt] Processing C:\derby-documentation\trunk\temp\crefjavbclobnot.dita to C:\derby-documentation\trunk\out\reftemp\crefjavbclobnot.html [xslt] Loading stylesheet C:\derby-documentation\trunk\DITA-OT1.1.2.1\xsl\d ita2xhtml.xsl [xslt] com.sun.org.apache.bcel.internal.generic.ClassGenException: Branch t arget offset too large for short
        Hide
        Jayaram Subramanian added a comment -

        Attaching patch and output

        Show
        Jayaram Subramanian added a comment - Attaching patch and output
        Hide
        Knut Anders Hatlen added a comment -

        Thanks for the patch, Jayaram!

        I applied the patch and built the reference manual. It looks like the xmlns attribute is correctly inserted into the html element. However, there's also an xmlns attribute inserted into some elements where it doesn't belong. For example, in the toc.html file you attached, we have this:

        <body>
        <ul>
        <li><a xmlns="" href="rrefcopyright.html"/></li>
        <li><a xmlns="" href="rreflicense.html"/></li>
        <li><a xmlns="" href="crefmpref1002477.html"/>
        <ul>

        The html validator now complains that there shouldn't be an xmlns attribute in the "a" element. I don't see exactly this when I build it in my environment, but I do see xmlns attributes inserted into meta and ul elements:

        <meta xmlns="" content="text/html; charset=utf-8" http-equiv="Content-Type" />
        ...
        <body>
        <ul xmlns="">
        ...

        Similar things seem to happen in the html files for the topics. For example in rrefclob.html:

        <html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us">
        <head xmlns="">
        ...
        <body xmlns="" id="rrefclob"><a name="rrefclob"><!-- --></a>
        ...

        When I read the comments on DERBY-4408 again, I see that Kim experienced similar problem. See https://issues.apache.org/jira/browse/DERBY-4408?focusedCommentId=13069007&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13069007. I'm not sure what we'll have to do to get around that problem.

        Show
        Knut Anders Hatlen added a comment - Thanks for the patch, Jayaram! I applied the patch and built the reference manual. It looks like the xmlns attribute is correctly inserted into the html element. However, there's also an xmlns attribute inserted into some elements where it doesn't belong. For example, in the toc.html file you attached, we have this: <body> <ul> <li><a xmlns="" href="rrefcopyright.html"/></li> <li><a xmlns="" href="rreflicense.html"/></li> <li><a xmlns="" href="crefmpref1002477.html"/> <ul> The html validator now complains that there shouldn't be an xmlns attribute in the "a" element. I don't see exactly this when I build it in my environment, but I do see xmlns attributes inserted into meta and ul elements: <meta xmlns="" content="text/html; charset=utf-8" http-equiv="Content-Type" /> ... <body> <ul xmlns=""> ... Similar things seem to happen in the html files for the topics. For example in rrefclob.html: <html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> <head xmlns=""> ... <body xmlns="" id="rrefclob"><a name="rrefclob"><!-- --></a> ... When I read the comments on DERBY-4408 again, I see that Kim experienced similar problem. See https://issues.apache.org/jira/browse/DERBY-4408?focusedCommentId=13069007&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13069007 . I'm not sure what we'll have to do to get around that problem.
        Hide
        Knut Anders Hatlen added a comment -

        The changes in lib/index.html look fine, so I committed that part of the patch (revision 1163601, backported to 10.8 with revison 1163602).

        Show
        Knut Anders Hatlen added a comment - The changes in lib/index.html look fine, so I committed that part of the patch (revision 1163601, backported to 10.8 with revison 1163602).
        Hide
        Knut Anders Hatlen added a comment -

        I found a good explanation here: http://www.xmlplease.com/xhtmlxhtml

        Following those steps and adding both an xmlns and an xmlns:xhtml attribute to the xsl:stylesheet element made the xmlns attribute appear at the right place (and only there) in the generated documents. However, I had to do that both in the xsl files in the lib directory and in all the xsl files under DITA-OT1.1.2.1/xsl/xslhtml. So it looks like we'd either need to check in modified versions of more xsl files, or add a rewrite rule in the build script to modify the toolkit at build-time. Unless someone knows a better way to do the html generation, of course.

        Show
        Knut Anders Hatlen added a comment - I found a good explanation here: http://www.xmlplease.com/xhtmlxhtml Following those steps and adding both an xmlns and an xmlns:xhtml attribute to the xsl:stylesheet element made the xmlns attribute appear at the right place (and only there) in the generated documents. However, I had to do that both in the xsl files in the lib directory and in all the xsl files under DITA-OT1.1.2.1/xsl/xslhtml. So it looks like we'd either need to check in modified versions of more xsl files, or add a rewrite rule in the build script to modify the toolkit at build-time. Unless someone knows a better way to do the html generation, of course.
        Hide
        Jayaram Subramanian added a comment -

        I also agree that we need to change the lib as well as xslhtml.. But 1 more thing i was curious was the only file under the xslhtml folder having the html attribute was ditat2htmlimpl.xsl.

        Also regarding second option to rewrite rule buildscript, does that mean elimination of xmlns="" from html files post html file generation ?

        Show
        Jayaram Subramanian added a comment - I also agree that we need to change the lib as well as xslhtml.. But 1 more thing i was curious was the only file under the xslhtml folder having the html attribute was ditat2htmlimpl.xsl. Also regarding second option to rewrite rule buildscript, does that mean elimination of xmlns="" from html files post html file generation ?
        Hide
        Knut Anders Hatlen added a comment -

        If we rewrite the xsl files in the buildscript (and also if we check in modified xsl files), the xmlns="" attributes won't be inserted, so there shouldn't be any need for post-processing to remove them, I think.

        It is true that only one of the files inserts an html element, and modifiying that file is enough to get xmlns added to the html element. The problem seems to be that other xsl files insert other elements into the same html file, and since there is no default namespace defined in the other xsl files, they will add xmlns="" to those elements to reset the namespace value.

        Show
        Knut Anders Hatlen added a comment - If we rewrite the xsl files in the buildscript (and also if we check in modified xsl files), the xmlns="" attributes won't be inserted, so there shouldn't be any need for post-processing to remove them, I think. It is true that only one of the files inserts an html element, and modifiying that file is enough to get xmlns added to the html element. The problem seems to be that other xsl files insert other elements into the same html file, and since there is no default namespace defined in the other xsl files, they will add xmlns="" to those elements to reset the namespace value.
        Hide
        Jayaram Subramanian added a comment -

        Atttaching with modified xsl files in build.xml with html xmlns attributes

        Show
        Jayaram Subramanian added a comment - Atttaching with modified xsl files in build.xml with html xmlns attributes
        Hide
        Kim Haase added a comment -

        There should be no need to modify the XSL files with "2fo" in their names. These files are used only for generation of the PDF and the one-page HTML file (ref-single.html, etc.). The one-page HTML file has a DOCTYPE of HTML only, not XHTML, so it should not have the xmlns:html="http://www.w3.org/1999/xhtml" attribute.

        Also, any zip file you attach to a documentation patch should contain sample documentation output from the patch, not the patched files themselves.

        Show
        Kim Haase added a comment - There should be no need to modify the XSL files with "2fo" in their names. These files are used only for generation of the PDF and the one-page HTML file (ref-single.html, etc.). The one-page HTML file has a DOCTYPE of HTML only, not XHTML, so it should not have the xmlns:html="http://www.w3.org/1999/xhtml" attribute. Also, any zip file you attach to a documentation patch should contain sample documentation output from the patch, not the patched files themselves.
        Hide
        Jayaram Subramanian added a comment -

        Thanks Knut and Kim. As indicated i added the xmlns declarations in xsl files of build script as well as xsl files in xsl\xhtml folders. But still when i run the ant html.ref i keep getting the <a xmlns="" in the toc.html output... wondering what i am missing here

        Show
        Jayaram Subramanian added a comment - Thanks Knut and Kim. As indicated i added the xmlns declarations in xsl files of build script as well as xsl files in xsl\xhtml folders. But still when i run the ant html.ref i keep getting the <a xmlns="" in the toc.html output... wondering what i am missing here
        Hide
        Jayaram Subramanian added a comment -

        When trying to do ant html.ref seeing this error

        [xslt] Loading stylesheet C:\derby-documentation\trunk\DITA-OT1.1.2.1\xsl\d
        ita2xhtml.xsl
        [xslt] com.sun.org.apache.bcel.internal.generic.ClassGenException: Branch t
        arget offset too large for short

        Show
        Jayaram Subramanian added a comment - When trying to do ant html.ref seeing this error [xslt] Loading stylesheet C:\derby-documentation\trunk\DITA-OT1.1.2.1\xsl\d ita2xhtml.xsl [xslt] com.sun.org.apache.bcel.internal.generic.ClassGenException: Branch t arget offset too large for short
        Hide
        Knut Anders Hatlen added a comment -

        I think you'll avoid that problem if you invoke ant with "-lib lib/fop.jar" (which makes it use a different version of Xalan than the one that comes with the JDK). For example:

        ant -lib lib/fop.jar html.ref

        Show
        Knut Anders Hatlen added a comment - I think you'll avoid that problem if you invoke ant with "-lib lib/fop.jar" (which makes it use a different version of Xalan than the one that comes with the JDK). For example: ant -lib lib/fop.jar html.ref
        Hide
        Knut Anders Hatlen added a comment -

        I thought I'd pick up the remaining tasks in this issue (that is, the table of contents and the topics) since there hasn't been any activity for some time.

        I first tried to add an xmlns attribute to the <xsl:stylesheet> tag in lib/map2htmtoc.xsl and lib/dita2htmlImpl.xsl. This did make the resulting xhtml files include an xmlns attribute in the <html> tag, and the fix was sufficient for the table of contents. However, with the topics, I ran into the same problem that Kim observed in DERBY-4408, with some other tags being output with xmlns="".

        That problem is caused by dita2htmlImpl.xsl including some other XSL files, which also lack the xmlns attribute and need a similar fix. We haven't yet copied those files from DITA-OT to the lib directory. Instead of checking in modified copies of those files in the subversion repository, I made the Ant script make the changes before the docs are built using the ReplaceRegExp task. See the attached patch xmlns.diff.

        I built the reference manual using the patch and diffed the resulting html files against html files built from a clean trunk, and verified that adding an xmlns attribute to the <html> tag was the only change. I also ran a random selection of html files through http://validator.w3.org and they all passed as valid XHTML now. Finally, I browsed the new version of the reference manual using Firefox, Chrome and Internet Explorer without finding any problems.

        Show
        Knut Anders Hatlen added a comment - I thought I'd pick up the remaining tasks in this issue (that is, the table of contents and the topics) since there hasn't been any activity for some time. I first tried to add an xmlns attribute to the <xsl:stylesheet> tag in lib/map2htmtoc.xsl and lib/dita2htmlImpl.xsl. This did make the resulting xhtml files include an xmlns attribute in the <html> tag, and the fix was sufficient for the table of contents. However, with the topics, I ran into the same problem that Kim observed in DERBY-4408 , with some other tags being output with xmlns="". That problem is caused by dita2htmlImpl.xsl including some other XSL files, which also lack the xmlns attribute and need a similar fix. We haven't yet copied those files from DITA-OT to the lib directory. Instead of checking in modified copies of those files in the subversion repository, I made the Ant script make the changes before the docs are built using the ReplaceRegExp task. See the attached patch xmlns.diff. I built the reference manual using the patch and diffed the resulting html files against html files built from a clean trunk, and verified that adding an xmlns attribute to the <html> tag was the only change. I also ran a random selection of html files through http://validator.w3.org and they all passed as valid XHTML now. Finally, I browsed the new version of the reference manual using Firefox, Chrome and Internet Explorer without finding any problems.
        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 1375441. Marking the issue as resolved.

        Show
        Knut Anders Hatlen added a comment - Committed revision 1375441. Marking the issue as resolved.

          People

          • Assignee:
            Jayaram Subramanian
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development