XalanJ2
  1. XalanJ2
  2. XALANJ-1640

xmlns bug using docbook->xhtml xslt on ulink template

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.7
    • Component/s: Xalan
    • Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
    • Labels:
      None
    • Environment:
      Operating System: Linux
      Platform: PC
    • Xalan info:
      PatchAvailable

      Description

      The following sample document is my test case:

      <?xml version="1.0" encoding="UTF-8"?>

      <article>

      <section>

      <para>Sample links
      <orderedlist>
      <listitem><para><ulink url="http://xml.apache.org/xalan"/></para></listitem>
      <listitem><para><ulink
      url="http://xml.apache.org/xalan"></ulink></para></listitem>
      <listitem><para><ulink
      url="http://xml.apache.org/xalan">Xalan</ulink></para></listitem>
      </orderedlist>
      </para>
      </section>
      </article>

      Using Xalan-J 2.5.1 docbook 1.61.3 (the latest version) stylesheets I get
      variants of the following:

      <a ="" target="_top">http://xml.apache.org/xalan</a>

      Basically the href attribute name and value, don't exist. If I make the
      following change (remove xmlns declaration) to docbook/xhtml/xref.xsl:

      748c748
      < <a xmlns="http://www.w3.org/1999/xhtml">

      > <a>

      then I get a valid, with the exception of the empty xmlns attribute, 'a' element:

      <a xmlns="" href="http://xml.apache.org/xalan"
      target="_top">http://xml.apache.org/xalan</a>

      Unfortunately the empty xmlns craps out Mozilla, but that's another bug for
      another project.

      Corey

      1. d22564.out
        0.1 kB
        Henry Zongaro
      2. d22564.patch.txt
        1 kB
        Henry Zongaro
      3. d22564.xml
        0.0 kB
        Henry Zongaro
      4. d22564.xsl
        0.4 kB
        Henry Zongaro

        Issue Links

          Activity

          Hide
          Marius Scurtescu added a comment -

          I am using the DocBook stylesheets version 1.62.4 and the problem is still
          there. This version of the sylesheet does not have an xmlns attribute on the a
          tag, but the generated a tag is still broken. The first attribute (it happens
          to be href, but you can swap them) will have the name missing and an empty value
          (="").

          I could find no workaround at all, basically this is a show stopper for me. For
          now I dropped the XHTML support and went back to HTML.

          Running the same transformation using Saxon will produce proper output.

          Show
          Marius Scurtescu added a comment - I am using the DocBook stylesheets version 1.62.4 and the problem is still there. This version of the sylesheet does not have an xmlns attribute on the a tag, but the generated a tag is still broken. The first attribute (it happens to be href, but you can swap them) will have the name missing and an empty value (=""). I could find no workaround at all, basically this is a show stopper for me. For now I dropped the XHTML support and went back to HTML. Running the same transformation using Saxon will produce proper output.
          Hide
          Henry Zongaro added a comment -

          The problem of missing attribute names and values was fixed under bug 25442.
          We don't have a fix for the namespace undeclaration yet.

          Show
          Henry Zongaro added a comment - The problem of missing attribute names and values was fixed under bug 25442. We don't have a fix for the namespace undeclaration yet.
          Hide
          Daniel Neades added a comment -

          I'm experiencing the namespace undeclaration bug too (but with different
          stylesheets, not the DocBook ones). It's a showstopper for me too.

          Show
          Daniel Neades added a comment - I'm experiencing the namespace undeclaration bug too (but with different stylesheets, not the DocBook ones). It's a showstopper for me too.
          Hide
          Henry Zongaro added a comment -

          Attaching reduced stylesheet (d22564.xsl) and input document (d22564.xml) that demonstrate the problem, along with expected output (d22564.out).

          Show
          Henry Zongaro added a comment - Attaching reduced stylesheet (d22564.xsl) and input document (d22564.xml) that demonstrate the problem, along with expected output (d22564.out).
          Hide
          Henry Zongaro added a comment -

          Attaching proposed patch - d22564.patch.txt

          Show
          Henry Zongaro added a comment - Attaching proposed patch - d22564.patch.txt
          Hide
          Brian Minchau added a comment -

          I have reviewed Henry's patch, and it looks good to me.

          I just wanted to add a comment about Henry's mimimized testcase (thanks so much form making is small!!).

          What was happening in the copy-of :
          <e1><xsl:copy-of select="$v"/></e1><e2/>
          The text node "abc" was copied, it had no namespace so
          a startPrefixMapping("", ""); call was made. But this SAX call applies to the next element whose startElement() call is not yet seen, so the <e2 /> gets an extra attribute, xmlns="".

          Henry's fix makes sure that this setting of the default namespace to null only happens if the node being processed is an element node (not a text node). In this case such a setting of the default namespace to null happens just before the element node is processed, which is correct, the startPrefixMapping calls happen before the startElement call.

          Show
          Brian Minchau added a comment - I have reviewed Henry's patch, and it looks good to me. I just wanted to add a comment about Henry's mimimized testcase (thanks so much form making is small!!). What was happening in the copy-of : <e1><xsl:copy-of select="$v"/></e1><e2/> The text node "abc" was copied, it had no namespace so a startPrefixMapping("", ""); call was made. But this SAX call applies to the next element whose startElement() call is not yet seen, so the <e2 /> gets an extra attribute, xmlns="". Henry's fix makes sure that this setting of the default namespace to null only happens if the node being processed is an element node (not a text node). In this case such a setting of the default namespace to null happens just before the element node is processed, which is correct, the startPrefixMapping calls happen before the startElement call.
          Hide
          Henry Zongaro added a comment -

          Patch applied in CVS.

          Show
          Henry Zongaro added a comment - Patch applied in CVS.
          Hide
          Brian Minchau added a comment -

          Filling in the reviewer field.

          Show
          Brian Minchau added a comment - Filling in the reviewer field.
          Hide
          Brian Minchau added a comment -

          Corey, as the issue reporter please confirm that this is fixed to your satisfaction in the 2.7 release, then we can close this issue.

          Show
          Brian Minchau added a comment - Corey, as the issue reporter please confirm that this is fixed to your satisfaction in the 2.7 release, then we can close this issue.
          Hide
          Brian Minchau added a comment -

          Closing this issue.

          Show
          Brian Minchau added a comment - Closing this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              Corey Jewett
              Reviewer:
              Brian Minchau
            • Votes:
              2 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development