xmlns in XHTML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Saqib Ali

    xmlns in XHTML

    Hello All,

    I am using Norman Walsh's XSLTs to transform some DocBook XML content
    to HTML.

    However I noticed that Norman Walsh's DocBook XSLT includes the
    following
    tag in the transformed document:
    <meta xmlns="http://www.w3.org/1999/xhtml" ......

    I think the XML Namespace can only be declared in <html/> tag for
    e.g.:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    is the correct way to declare the namespace.

    <meta xmlns="http://www.w3.org/1999/xhtml" ...... is what Norman
    Walsh's
    XSLT produced, which I think is incorrect. I might be wrong.

    Before I submit a bug-report to OASIS, I just to make sure that I m
    not missing something. Let me know if I am wrong about xmlns
    declaration.

    Here are some sample documents transformed from DocBook XML to HTML
    using Norman's XSLTs: http://www.xml-dev.com/blog/#88



    Thanks.
    Saqib Ali
    -------------
    http://validate.sf.net <---- (X)HTML / DocBook XML Validator and
    Transformer
  • Andy Dingley

    #2
    Re: xmlns in XHTML

    On 5 May 2004 10:39:31 -0700, saqib@stonebeat .org (Saqib Ali) wrote:
    [color=blue]
    >Before I submit a bug-report to OASIS, I just to make sure that I m
    >not missing something.[/color]

    Here's a clue - Norman Walsh _really_ knows what he's doing. Many,
    many people have also used those stylesheets over and over. I'm not
    saying there are no bugs left, but obvious ones get found quickly.
    [color=blue]
    >Let me know if I am wrong about xmlns
    >declaration.[/color]

    Yes.

    Comment

    • Saqib Ali

      #3
      Re: xmlns in XHTML

      > >Let me know if I am wrong about xmlns[color=blue][color=green]
      > >declaration.[/color]
      >
      > Yes.[/color]

      Can you please be more specific as to where in the XHTML DTD it allows
      the xmlns attribute to be in the <META /> TAG ???

      I was looking at the XHTML DTD @ http://www.w3.org/TR/xhtml1/#dtds it
      seems like xmlns attribute is only allowed in the <html /> TAG.

      Can you please point me to the exact location in the DTD, which allows
      xmlns attribute to be in the <meta /> tag.

      Thanks.
      In Peace,
      Saqib Ali

      Comment

      • Derek Harmon

        #4
        Re: xmlns in XHTML

        "Saqib Ali" <saqib@stonebea t.org> wrote in message news:d22b4f0d.0 405051756.4f627 ddd@posting.goo gle.com...[color=blue]
        > Can you please be more specific as to where in the XHTML DTD it allows
        > the xmlns attribute to be in the <META /> TAG ???
        > I was looking at the XHTML DTD @ http://www.w3.org/TR/xhtml1/#dtds it
        > seems like xmlns attribute is only allowed in the <html /> TAG.[/color]

        Observe that the xmlns attribute on the html tag is FIXED. The inference
        drawn from this is that all the child elements defined by the DTD must
        belong to the same namespace URI, and no others.

        The "XML with Namespaces" recommendation (on which XHTML
        is based) was created to address this limitation. Inherent in this
        recommendation is the freedom to declare namespaces anyplace.

        The relationship between XHTML and other namespaces is described
        in section 3.1.2 of the XHTML 1.0 recommendation,



        If you must validate against a DTD, since DTDs are incapable of
        supporting namespaces, then the XHTML produced by the Doc-
        Book XSLT is not strictly conforming. This is due to a known
        limitation of the DTD, rather than incongrueity with the XHTML
        recommendation.

        XHTML 1.1 includes informative XML Schemas, that accomodate
        the broader use of XML namespace declarations.


        Derek Harmon


        Comment

        • Andy Dingley

          #5
          Re: xmlns in XHTML

          saqib@stonebeat .org (Saqib Ali) wrote in message
          [color=blue]
          > Can you please point me to the exact location in the DTD, which allows
          > xmlns attribute to be in the <meta /> tag.[/color]

          It's not in the DTD - xmlns is "magic" (it's part of XML, not XHTML),
          so look at the XML TR instead


          or more specifically, at the TR for namespacing in XML

          Comment

          • Richard Tobin

            #6
            Re: xmlns in XHTML

            In article <d22b4f0d.04050 50939.244dca6e@ posting.google. com>,
            Saqib Ali <saqib@stonebea t.org> wrote:
            [color=blue]
            ><meta xmlns="http://www.w3.org/1999/xhtml" ...... is what Norman
            >Walsh's XSLT produced, which I think is incorrect. I might be wrong.[/color]

            DTDs and namespaces don't work very well together, so it may well be
            invalid according to the DTD, and you may just want to ignore that
            fact.

            Furthermore there may be some variation between XSLT processors as to
            what xmlns declarations they output, so it's very hard to guarantee
            output that matches a DTD.

            However, looking at one of your examples, I'm baffled. The top-level
            <html> element doesn't have an xmlns attribute. The #FIXED
            declaration in the DTD will give it one when it's read back in again,
            but the XSLT processor that generated it didn't know that. In fact,
            it looks as if none of the XSLT output except the meta element was in
            the XHTML namespace, and that's why it put the xmlns attribute on
            the meta element.

            The first thing I'd do is try using a different XSLT processor.
            Then ask Norm.

            -- Richard

            Comment

            • Saqib Ali

              #7
              Re: xmlns in XHTML

              > The "XML with Namespaces" recommendation (on which XHTML[color=blue]
              > is based) was created to address this limitation. Inherent in this
              > recommendation is the freedom to declare namespaces anyplace.
              >
              > The relationship between XHTML and other namespaces is described
              > in section 3.1.2 of the XHTML 1.0 recommendation,
              >
              > http://www.w3.org/TR/2000/REC-xhtml1...6/#well-formed[/color]

              Derek,
              Thank you very much. This is exactly what I was looking for. :)

              In Peace,
              Saqib Ali

              Comment

              • Nick Kew

                #8
                Re: xmlns in XHTML

                In article <c7cdef$2bav1$1 @id-185805.news.uni-berlin.de>,
                "Derek Harmon" <loresayer@emai l.msn.com> writes:[color=blue]
                > "Saqib Ali" <saqib@stonebea t.org> wrote in message news:d22b4f0d.0 405051756.4f627 ddd@posting.goo gle.com...[color=green]
                >> Can you please be more specific as to where in the XHTML DTD it allows
                >> the xmlns attribute to be in the <META /> TAG ???
                >> I was looking at the XHTML DTD @ http://www.w3.org/TR/xhtml1/#dtds it
                >> seems like xmlns attribute is only allowed in the <html /> TAG.[/color][/color]

                You may be talking at cross-purposes. XML namespace rules and DTD
                validation rules are different beasts. XHTML, and particularly XHTML1.0,
                applies the latter. So <meta xmlns... /> is fine by XML rules but
                invalid by XHTML rules.

                As for whether the stylesheets are in error - I'd have to spend more
                time than I have now to determine whether the error lies there or in
                the user. But in reply to Andy's point, Norman Walsh may know what
                he's doing, but Saqib in no ignorant newbie either.
                [color=blue]
                > Observe that the xmlns attribute on the html tag is FIXED. The inference
                > drawn from this is that all the child elements defined by the DTD must
                > belong to the same namespace URI, and no others.[/color]

                What FIXED means is that it's implied in the <html> element even when
                an author omits it. It doesn't prevent use of other default namespaces
                through an xmlns attribute on a child element.
                [color=blue]
                > The "XML with Namespaces" recommendation (on which XHTML
                > is based) was created to address this limitation. Inherent in this
                > recommendation is the freedom to declare namespaces anyplace.
                >
                > The relationship between XHTML and other namespaces is described
                > in section 3.1.2 of the XHTML 1.0 recommendation,
                >
                > http://www.w3.org/TR/2000/REC-xhtml1...6/#well-formed[/color]

                This is a case of design by committee pulling in different and
                mutually incompatible directions. The only way this actually works
                is by defining new DTDs (such as XHTML+MATHML+SV G). Or by dropping
                both validation and browser-compatibility.
                [color=blue]
                > If you must validate against a DTD, since DTDs are incapable of
                > supporting namespaces,[/color]

                Not strictly true, but we'll skip over that.
                [color=blue]
                > then the XHTML produced by the Doc-
                > Book XSLT is not strictly conforming.[/color]

                Neither is it valid if it generates xmlns declarations in the manner
                described here.
                [color=blue]
                > XHTML 1.1 includes informative XML Schemas, that accomodate
                > the broader use of XML namespace declarations.[/color]

                XHTML 1.1 is a true exercise in futility. It gratuitously breaks
                browser-compatibility, but offers nothing in return, beyond what
                ad-hoc-XML gives us for free in terms of availability of processing
                tools.

                Conclusion: XML and HTML each has advantages. But mixing them
                requires attention to detail that is often missing.

                --
                Nick Kew

                Nick's manifesto: http://www.htmlhelp.com/~nick/

                Comment

                • Richard Tobin

                  #9
                  Re: xmlns in XHTML

                  In article <65dpm1-6ol.ln1@webthin g.com>,
                  Nick Kew <nick@hugin.web thing.com> wrote:
                  [color=blue]
                  >What FIXED means is that it's implied in the <html> element even when
                  >an author omits it.[/color]

                  *And* that the author may not supply any other value, unlike a plain default.

                  -- Richard

                  Comment

                  • Patrick TJ McPhee

                    #10
                    Re: xmlns in XHTML

                    In article <28200a19.04050 60201.6637be84@ posting.google. com>,
                    Andy Dingley <dingbat@codesm iths.com> wrote:
                    % saqib@stonebeat .org (Saqib Ali) wrote in message
                    %
                    % > Can you please point me to the exact location in the DTD, which allows
                    % > xmlns attribute to be in the <meta /> tag.
                    %
                    % It's not in the DTD - xmlns is "magic" (it's part of XML, not XHTML),
                    % so look at the XML TR instead

                    It's magic, but if you want to validate against a DTD, you've got to
                    include the xmlns* attributes, as well as having the prefix consistent
                    between the instance and the DTD.
                    --

                    Patrick TJ McPhee
                    East York Canada
                    ptjm@interlog.c om

                    Comment

                    • Andy Dingley

                      #11
                      Re: xmlns in XHTML

                      ptjm@interlog.c om (Patrick TJ McPhee) wrote in message news:<c7etvd$i5 3$2@news.eusc.i nter.net>...
                      [color=blue]
                      > It's magic, but if you want to validate against a DTD, you've got to
                      > include the xmlns* attributes, as well as having the prefix consistent
                      > between the instance and the DTD.[/color]

                      Are there any well-known validators that work correctly for XHTML with
                      embedded elements from other namesapces ?

                      Is there even as yet an agreed notion of what "correct" means in this
                      case ? I know there's a certain lack of clarity(sic) in how close
                      XHTML is to being "vanilla" XML (for reasons of HTML legacyness). It's
                      easy to treat XHTML + (X-foo) as an XML document and validate it as
                      such, but a lot harder to take a "post HTML, App C aware" tool and
                      persuade it that your document is valid.

                      Comment

                      Working...