tricky XHTML 1.0 namespace question

Simon St.Laurent simonstl at simonstl.com
Mon Jan 17 18:04:49 GMT 2000


The XHTML 1.0 PR shows (in 3.12) an example of XHTML being included in another
XML document type: (I've changed all the angle brackets so this doesn't get et
by the mail programs)

              [?xml version="1.0" encoding="UTF-8"?]
              [!-- initially, the default namespace is "books" --]
              [book xmlns='urn:loc.gov:books'
                  xmlns:isbn='urn:ISBN:0-395-36341-6' xml:lang="en" lang="en"]
                [title]Cheaper by the Dozen[/title]
                [isbn:number]1568491379[/isbn:number]
                [notes]
                  [!-- make HTML the default namespace for a hypertext
commentary --]
                  [p xmlns='http://www.w3.org/1999/xhtml']
                      This is also available [a
href="http://www.w3.org/"]online[/a].
                  [/p]
                [/notes]
              [/book]

This uses the default namespace for its work.  Would it be possible (I
think it
should be) to use a prefix?

              [?xml version="1.0" encoding="UTF-8"?]
              [!-- initially, the default namespace is "books" --]
              [book xmlns='urn:loc.gov:books'
                  xmlns:isbn='urn:ISBN:0-395-36341-6' xml:lang="en" lang="en"]
                [title]Cheaper by the Dozen[/title]
                [isbn:number]1568491379[/isbn:number]
                [notes]
                  [!-- make HTML the default namespace for a hypertext
commentary --]
                  [xhtml:p xmlns:xhtml='http://www.w3.org/1999/xhtml']
                      This is also available [xhtml:a
xhtml:href="http://www.w3.org/"]online[/xhtml:a].
                  [/xhtml:p]
                [/notes]
              [/book]

If so, is:

                      This is also available [xhtml:a
xhtml:href="http://www.w3.org/"]online[/xhtml:a].

equivalent to:

                      This is also available [xhtml:a
href="http://www.w3.org/"]online[/xhtml:a].

While XHTML seems to assume that attributes with no prefix fall into the
namespace of their containing element throughout, I can't find this stated
explicitly.  (Perhaps they weren't aware that this has been a contentious
issue?)

Simon St.Laurent
XML Elements of Style / XML: A Primer, 2nd Ed.
Building XML Applications
Inside XML DTDs: Scientific and Technical
Cookies / Sharing Bandwidth
http://www.simonstl.com

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN 981-02-3594-1
Please note: New list subscriptions now closed in preparation for transfer to OASIS.





More information about the Xml-dev mailing list