XalanJ2
  1. XalanJ2
  2. XALANJ-1906

[xhtml output] Empty element form for non EMPTY declared elements

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.2.0
    • Fix Version/s: None
    • Component/s: Serialization
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All

      Description

      • The stylesheet:

      > <?xml version="1.0" encoding="UTF-8"?>
      >
      > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      >
      > <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"
      > omit-xml-declaration="no" 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>
      > <title>bug test</title>
      > </head>
      > <body>
      > <div></div>
      > </body>
      > </html>
      > </xsl:template>
      >
      > </xsl:stylesheet>

      • The output:

      > <?xml version="1.0" encoding="iso-8859-1"?>
      > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      > <html>
      > <head>
      > <title>bug test</title>
      > </head>
      > <body>
      > <div />
      > </body>
      > </html>

      • The standards:

      > Empty-element tags MAY be used for any element which has no content,
      > whether or not it is declared using the keyword EMPTY.
      > For interoperability, the empty-element tag SHOULD be used, and
      > SHOULD only be used, for elements which are declared EMPTY.
      (http://www.w3.org/TR/REC-xml/#sec-starttags)

      > C.3. Element Minimization and Empty Element Content
      > Given an empty instance of an element whose content model
      > is not EMPTY (for example, an empty title or paragraph) do
      > not use the minimized form (e.g. use <p> </p> and not <p />).
      (http://www.w3.org/TR/xhtml1/#guidelines)

      • The patch:
        Elements like <p> or <div> aren't declared as EMPTY in the XHTML DTD.
        According to XML and XHTML standards, the <div></div> form should be used
        instead of <div/>. Both are XML (and XHTML) valid, but the second leads to
        strange problems with some browsers (guess who — IE).

      Hope this helps,
      Marco

        Activity

        Marco created issue -
        Serge Knystautas made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 30007 26815
        Brian Minchau made changes -
        Environment Operating System: All
        Platform: All
        Operating System: All
        Platform: All
        Component/s Serialization [ 11325 ]
        Assignee Xalan Developers Mailing List [ xalan-dev@xml.apache.org ]
        Component/s Xalan [ 11321 ]
        Description - The stylesheet:

        > <?xml version="1.0" encoding="UTF-8"?>
        >
        > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        >
        > <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"
        > omit-xml-declaration="no" 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>
        > <title>bug test</title>
        > </head>
        > <body>
        > <div></div>
        > </body>
        > </html>
        > </xsl:template>
        >
        > </xsl:stylesheet>


        - The output:

        > <?xml version="1.0" encoding="iso-8859-1"?>
        > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        > <html>
        > <head>
        > <title>bug test</title>
        > </head>
        > <body>
        > <div />
        > </body>
        > </html>


        - The standards:

        > Empty-element tags MAY be used for any element which has no content,
        > whether or not it is declared using the keyword EMPTY.
        > For interoperability, the empty-element tag SHOULD be used, and
        > SHOULD only be used, for elements which are declared EMPTY.
        (http://www.w3.org/TR/REC-xml/#sec-starttags)

        > C.3. Element Minimization and Empty Element Content
        > Given an empty instance of an element whose content model
        > is not EMPTY (for example, an empty title or paragraph) do
        > not use the minimized form (e.g. use <p> </p> and not <p />).
        (http://www.w3.org/TR/xhtml1/#guidelines)

        - The patch:
        Elements like <p> or <div> aren't declared as EMPTY in the XHTML DTD.
        According to XML and XHTML standards, the <div></div> form should be used
        instead of <div/>. Both are XML (and XHTML) valid, but the second leads to
        strange problems with some browsers (guess who --- IE).

        Hope this helps,
        Marco
        - The stylesheet:

        > <?xml version="1.0" encoding="UTF-8"?>
        >
        > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        >
        > <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"
        > omit-xml-declaration="no" 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>
        > <title>bug test</title>
        > </head>
        > <body>
        > <div></div>
        > </body>
        > </html>
        > </xsl:template>
        >
        > </xsl:stylesheet>


        - The output:

        > <?xml version="1.0" encoding="iso-8859-1"?>
        > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        > <html>
        > <head>
        > <title>bug test</title>
        > </head>
        > <body>
        > <div />
        > </body>
        > </html>


        - The standards:

        > Empty-element tags MAY be used for any element which has no content,
        > whether or not it is declared using the keyword EMPTY.
        > For interoperability, the empty-element tag SHOULD be used, and
        > SHOULD only be used, for elements which are declared EMPTY.
        (http://www.w3.org/TR/REC-xml/#sec-starttags)

        > C.3. Element Minimization and Empty Element Content
        > Given an empty instance of an element whose content model
        > is not EMPTY (for example, an empty title or paragraph) do
        > not use the minimized form (e.g. use <p> </p> and not <p />).
        (http://www.w3.org/TR/xhtml1/#guidelines)

        - The patch:
        Elements like <p> or <div> aren't declared as EMPTY in the XHTML DTD.
        According to XML and XHTML standards, the <div></div> form should be used
        instead of <div/>. Both are XML (and XHTML) valid, but the second leads to
        strange problems with some browsers (guess who --- IE).

        Hope this helps,
        Marco
        Priority Blocker [ 1 ]
        Henry Zongaro made changes -
        Priority Blocker [ 1 ] Minor [ 4 ]
        Bugzilla Id 30007
        Brian Minchau made changes -
        Affects Version/s 2.0.0 [ 10856 ]
        Affects Version/s Latest Development Code [ 10863 ]
        Brian Minchau made changes -
        Affects Version/s Latest Development Code [ 10863 ]
        Affects Version/s 2.2.0 [ 10864 ]
        Sébastien Launay made changes -
        Mark Thomas made changes -
        Workflow jira [ 36810 ] Default workflow, editable Closed status [ 12571002 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12571002 ] jira [ 12593937 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Marco
          • Votes:
            7 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:

              Development