Re: [whatwg] base versus xml:base
In mozilla we currently don't allow relative URIs in the href at all. If the uri is relative it is ignored. This is per HTML4, and I think it would be ok for HTML5 to say the same. Alternatively it could say that it should be relative to the URI used to retrieve the base element. In most cases the URI of the document. Note that the current text isn't implementable since it says that relative uris in base should be resolved against the base uri document, but the base element modifies that base uri so there is a circular dependency. / Jonas
Re: [whatwg] base versus xml:base
On Tue, 13 Mar 2007 19:15:12 +0100, Asbjørn Ulsberg [EMAIL PROTECTED] wrote: They don't conflict. They are both applied. base is the document's base URI, and xml:base is the base URI of the element it is applied on. What about: base href=http://www.example.org/; xml:base=/bar / I suppose xml:base= should affect href=. That would make it consistent with img src=... xml:base=.../ at least. Interesting sample. -- Anne van Kesteren http://annevankesteren.nl/ http://www.opera.com/
Re: [whatwg] base versus xml:base
2007/3/14, Anne van Kesteren: On Tue, 13 Mar 2007 19:15:12 +0100, Asbjørn Ulsberg [EMAIL PROTECTED] wrote: They don't conflict. They are both applied. base is the document's base URI, and xml:base is the base URI of the element it is applied on. What about: base href=http://www.example.org/; xml:base=/bar / I suppose xml:base= should affect href=. That would make it consistent with img src=... xml:base=.../ at least. Interesting sample. How about this variation: head xml:base=bar/ base href=foo/ / /head Is the [EMAIL PROTECTED] resolved to absolute using [EMAIL PROTECTED]:base or not? If it is, then when looking at links inside head, relative URIs are resolved using a base of bar/foo/bar/ (taking [EMAIL PROTECTED]:base into account twice: once to resolve [EMAIL PROTECTED], which sets the document's base URI, and then relative to that base URI to resolve [EMAIL PROTECTED]'s). If it is not, then base is in violation of the xml:base spec AFAICT. I'd personally only allow absolute URI references in [EMAIL PROTECTED] We still have to cope with legacy content which uses a relative URI, but then they're likely not XHTML, so xml:base is simply ignored. This could be solved by saying that if there is an xml:base in scope, then base is ignored for the whole document. A quick test with Firefox shows that xml:base is applied but base seems to be ignored in application/xhtml+xml documents. Just some thoughts… -- Thomas Broyer
Re: [whatwg] base versus xml:base
On Wed, 14 Mar 2007 10:17:48 +0100, Anne van Kesteren [EMAIL PROTECTED] wrote: They don't conflict. They are both applied. base is the document's base URI, and xml:base is the base URI of the element it is applied on. What about: base href=http://www.example.org/; xml:base=/bar / I suppose xml:base= should affect href=. That would make it consistent with img src=... xml:base=.../ at least. Interesting sample. Please ignore the comment above. It would lead to silly loops. base href=, if relative, should be resolved against the document location and not against (any) xml:base. -- Anne van Kesteren http://annevankesteren.nl/ http://www.opera.com/
Re: [whatwg] base versus xml:base
On Wed, 14 Mar 2007 10:17:48 +0100, Anne van Kesteren [EMAIL PROTECTED] wrote: base href=http://www.example.org/; xml:base=/bar / I suppose xml:base= should affect href=. The XML Base[1] specification says: The base URI for a URI reference appearing in any other attribute value, including default attribute values, is the base URI of the element bearing the attribute. Let's say the document from my example was located on 'http://users.example.org/bob/'. According to the XML Base specification, the initial base URI of the document (in this example) is «the URI used to retrieve the entity». Since 'xml:base' affects base, and not the other way around (I would presume), the base URI of the document, after processing the base element, should be: http://users.example.org/bar That is, if 'xml:base' is processed before the base element. And according to the XML Base specification, I'd say that is the case. If not, base is a special case element where 'xml:base' doesn't apply or is applied after the 'href' value has been resolved. That would make it consistent with img src=... xml:base=.../ at least. Interesting sample. Yep. [1] http://www.w3.org/TR/xmlbase/ -- Asbjørn Ulsberg -=|=-http://virtuelvis.com/quark/ «He's a loathsome offensive brute, yet I can't look away»
Re: [whatwg] base versus xml:base
On Wed, 14 Mar 2007 11:40:04 +0100, Thomas Broyer [EMAIL PROTECTED] wrote: How about this variation: head xml:base=bar/ base href=foo/ / /head Is the [EMAIL PROTECTED] resolved to absolute using [EMAIL PROTECTED]:base or not? I'd say it is. At least according to XML Base. The HTML specification can of course state otherwise, but the smartest thing to do would be to not break 'xml:base' processing rules in HTML, even if base is a special case element. If it is, then when looking at links inside head, relative URIs are resolved using a base of bar/foo/bar/ (taking [EMAIL PROTECTED]:base into account twice: once to resolve [EMAIL PROTECTED], which sets the document's base URI, and then relative to that base URI to resolve [EMAIL PROTECTED]'s). Hm, that sounds weird. I'd say once [EMAIL PROTECTED] is resolved (taking into account the parent xml:base URI), then that's final. Any xml:base's after base's presence will override the base, but I don't see a reason for applying xml:base twice. Since base is a special case element that magically affects all URI's in the document, I'd say it works like that even when combined with 'xml:base'. If it is not, then base is in violation of the xml:base spec AFAICT. It's even worse if 'xml:base' doesn't apply to base at all, but I'd say apply the parent base URI, then apply that URI to all elements in the document (until another 'xml:base' is encountered). I'd personally only allow absolute URI references in [EMAIL PROTECTED] +1. We still have to cope with legacy content which uses a relative URI, but then they're likely not XHTML, so xml:base is simply ignored. I'd actually vote for the exclusion of base from XHTML entirely. We have xml:base, so use that instead. This could be solved by saying that if there is an xml:base in scope, then base is ignored for the whole document. That's also a solution, yea. A quick test with Firefox shows that xml:base is applied but base seems to be ignored in application/xhtml+xml documents. Sounds like good behaviour. -- Asbjørn Ulsberg -=|=-http://virtuelvis.com/quark/ «He's a loathsome offensive brute, yet I can't look away»
Re: [whatwg] base versus xml:base
On Wed, 14 Mar 2007 11:40:04 +0100, Thomas Broyer [EMAIL PROTECTED] wrote: How about this variation: head xml:base=bar/ base href=foo/ / /head Is the [EMAIL PROTECTED] resolved to absolute using [EMAIL PROTECTED]:base or not? I'd say it is. At least according to XML Base. The HTML specification can of course state otherwise, but the smartest thing to do would be to not break 'xml:base' processing rules in HTML, even if base is a special case element. If it is, then when looking at links inside head, relative URIs are resolved using a base of bar/foo/bar/ (taking [EMAIL PROTECTED]:base into account twice: once to resolve [EMAIL PROTECTED], which sets the document's base URI, and then relative to that base URI to resolve [EMAIL PROTECTED]'s). Hm, that sounds weird. I'd say once [EMAIL PROTECTED] is resolved (taking into account the parent xml:base URI), then that's final. Any xml:base's after base's presence will override the base, but I don't see a reason for applying xml:base twice. Since base is a special case element that magically affects all URI's in the document, I'd say it works like that even when combined with 'xml:base'. If it is not, then base is in violation of the xml:base spec AFAICT. It's even worse if 'xml:base' doesn't apply to base at all, but I'd say apply the parent base URI, then apply that URI to all elements in the document (until another 'xml:base' is encountered). I'd personally only allow absolute URI references in [EMAIL PROTECTED] +1. We still have to cope with legacy content which uses a relative URI, but then they're likely not XHTML, so xml:base is simply ignored. I'd actually vote for the exclusion of base from XHTML entirely. We have xml:base, so use that instead. This could be solved by saying that if there is an xml:base in scope, then base is ignored for the whole document. That's also a solution, yea. A quick test with Firefox shows that xml:base is applied but base seems to be ignored in application/xhtml+xml documents. Sounds like good behaviour. -- Asbjørn Ulsberg -=|=-http://virtuelvis.com/quark/ «He's a loathsome offensive brute, yet I can't look away»
Re: [whatwg] base versus xml:base
* Asbjørn Ulsberg wrote: Let's say the document from my example was located on 'http://users.example.org/bob/'. According to the XML Base specification, the initial base URI of the document (in this example) is «the URI used to retrieve the entity». Since 'xml:base' affects base, and not the other way around (I would presume), the base URI of the document, after processing the base element, should be: http://users.example.org/bar That is, if 'xml:base' is processed before the base element. And according to the XML Base specification, I'd say that is the case. If not, base is a special case element where 'xml:base' doesn't apply or is applied after the 'href' value has been resolved. It is not very useful to make these assumptions. The problem here is that you have a cycle in the lookup algorithm. If you have a relative reference you do this under both xml:base and base processing: rel ref - base of element - base of parent - ... base or else ... document base If the relative reference is in the base href attribute, the algo- rithm would not terminate. The XML Base specification does not address this problem in any way. The minimal approach to break the cycle would be to define what happens if resolving base href depends on resolving base href. A simple solution would be to ignore the base element for the purposes of determining the base of any element. Note that some of the suggestions made in this thread would give quite surprising results e.g. when using XInclude. -- Björn Höhrmann · mailto:[EMAIL PROTECTED] · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Re: [whatwg] base versus xml:base
Asbjørn Ulsberg wrote: If it is, then when looking at links inside head, relative URIs are resolved using a base of bar/foo/bar/ (taking [EMAIL PROTECTED]:base into account twice: once to resolve [EMAIL PROTECTED], which sets the document's base URI, and then relative to that base URI to resolve [EMAIL PROTECTED]'s). Hm, that sounds weird. I'd say once [EMAIL PROTECTED] is resolved (taking into account the parent xml:base URI), then that's final. Any xml:base's after base's presence will override the base, but I don't see a reason for applying xml:base twice. Since base is a special case element that magically affects all URI's in the document, I'd say it works like that even when combined with 'xml:base'. This kinda-cyclic definition is caused by the fact that the base element is defined as actually setting a property of the document as a whole. So let's imagine that there's in illusionary element enclosing the whole document, so that we can write this in terms of xml:base... So if we imagine that we've retrieved a document from http://example.com/: (document) xml:base=http://example.com/; html head xml:base=foo/ link href=bar.html / /head ... /html /(document) So here, that link ends up being http://example.com/foo/bar.html, because the xml:base on head is relative to the xml:base on the document. Now if we throw in an HTML base element: (document) xml:base=??? html head xml:base=foo/ base href=wibble/ / link href=bar.html / /head ... /html /(document) What is the document's xml:base set to now? the base element overrides the original document URL, making it http://example.com/foo/wibble/, but since the xml:base on the document is now http://example.com/foo/wibble/, the base href is now http://example.com/foo/wibble/foo/wibble/ and so on ad infinitum. So it seems to me that base href has to be a special case of some sort. I'm not sure what the special case should be. I think in this case I'd expect the notional xml:base on the document to be http://www.example.com/wibble/ and the URL in my link element to end up as http://www.example.com/wibble/foo/bar.html ... in other words, the base href has ignored xml:base entirely... the base href attribute is in effect acting as if it were the xml:base attribute on my imaginary (document) element, regardless of its actual position in the DOM.
Re: [whatwg] base versus xml:base
On Tue, 06 Mar 2007 21:38:59 +0100, Simon Pieters [EMAIL PROTECTED] wrote: They don't conflict. They are both applied. base is the document's base URI, and xml:base is the base URI of the element it is applied on. What about: base href=http://www.example.org/; xml:base=/bar / ? -- Asbjørn Ulsberg -=|=-http://virtuelvis.com/quark/ «He's a loathsome offensive brute, yet I can't look away»
Re: [whatwg] base versus xml:base
On Tue, 13 Mar 2007 19:15:12 +0100, Asbjørn Ulsberg [EMAIL PROTECTED] wrote: On Tue, 06 Mar 2007 21:38:59 +0100, Simon Pieters [EMAIL PROTECTED] wrote: They don't conflict. They are both applied. base is the document's base URI, and xml:base is the base URI of the element it is applied on. What about: base href=http://www.example.org/; xml:base=/bar / ? Then the document's base URI is http://www.example.org/ and the base element's base URI is http://www.example.org/bar. -- Simon Pieters
Re: [whatwg] base versus xml:base
What about: base href=http://www.example.org/; xml:base=/bar / ? Then the document's base URI is http://www.example.org/ and the base element's base URI is http://www.example.org/bar. I'm not entirely sure this is legal but what about (say for a document on http://localhost/): base href=.. xml:base=bar / Regards, Adrian Sutton.
Re: [whatwg] base versus xml:base
Simon Pieters wrote: A conforming XHTML 1.0 document must conform to the DTD, which effectively disallows xml:base and a whole bunch of other things (including, say, namespace prefixes). http://www.w3.org/TR/xhtml1/#strict I am moving this discussion to the help list, as it is more about *my* understanding of xml:base than the actual spec. Lars Gunther
Re: [whatwg] base versus xml:base
Geoffrey Sneddon wrote: xml:lang and xml:base are the actual attribute names – the XML namespace exists so they work within namespace aware parsers (as XML-Names is a separate spec that extends XML) – therefore, it must be explicitly allowed within the DTD (like xml:lang is). When I read http://www.w3.org/TR/xmlbase/ it seems to me that if a parser understands XML it should be OK to use xml:base. The very last line of that document: XHTML [XHTML] uses URI references beyond those expressible in XLink. These URI references might be resolved by an application relative to the base URI defined by XML Base. The XHTML specification might want to describe their level of support for XML Base. Apart from faulty grammar in the last sentence I interpret this as It is a good idea to explicitly state how this attribute is supported. It *might* want to describe this. I think that it would be wise to answer questions such as if both base and xml:base are present, which one should win? (I've only tested in FFox and the attribute wins over the element.) What authority do you rely on when you say that the attribute must be explicitly allowed? Lars Gunther
Re: [whatwg] base versus xml:base
Anne van Kesteren wrote: On Mon, 05 Mar 2007 22:07:03 +0100, Keryx Web [EMAIL PROTECTED] wrote: It may be that I've implemented this in the wrong way - corrections are welcome - but it seems to me that even though xml:base is legal today, it is **not** supported by UAs. Which makes Anne's proposal, that base should be allowed in both serializations, even more important. There's nu such thing as an xml:base element. It's an attribute. And it is supported although there may be some bugs with dynamic changes etc. Oh man! I thought it was strange that it did not work in spite having been told that it would by several people on the help list... Well, now all the world knows that I've never before used xml:base in my coding or teaching. But maybe my error in itself illustrates the value of letting base be allowed in the XML serialization. The element is known. The attribute is not. No one has argued against allowing the element. Does that mean we have reached consensus? Lars Gunther
Re: [whatwg] base versus xml:base
On Mon, 05 Mar 2007 22:07:03 +0100, Keryx Web [EMAIL PROTECTED] wrote: It may be that I've implemented this in the wrong way - corrections are welcome - but it seems to me that even though xml:base is legal today, it is **not** supported by UAs. Which makes Anne's proposal, that base should be allowed in both serializations, even more important. There's nu such thing as an xml:base element. It's an attribute. And it is supported although there may be some bugs with dynamic changes etc. -- Anne van Kesteren http://annevankesteren.nl/ http://www.opera.com/
Re: [whatwg] base versus xml:base
On 5 Mar 2007, at 21:07, Keryx Web wrote: Geoffrey Sneddon wrote: XHTML 1.0/1.1 doesn't allow xml:base, though, so base is the only way to set a base URL within the document. In what way would the XHTML 1.0/1.1 spec **disallow** the use of this element from the xml namespace? It's not *part of* the spec, but that's a different matter, right? xml:lang and xml:base are the actual attribute names – the XML namespace exists so they work within namespace aware parsers (as XML- Names is a separate spec that extends XML) – therefore, it must be explicitly allowed within the DTD (like xml:lang is). - Geoffrey Sneddon
[whatwg] base versus xml:base
I think base should also be allowed in XML documents. It simplifies the language, it already needs to be supported and base is able to set Document.baseURI where xml:base can at most set Document.documentElement.baseURI. (Document.baseURI influences how XMLHttpRequest works for instance.) The base element section should probably also talk about what happens when you modify the .href attribute. -- Anne van Kesteren http://annevankesteren.nl/ http://www.opera.com/
Re: [whatwg] base versus xml:base
Anne van Kesteren skrev: I think base should also be allowed in XML documents. It simplifies the language, it already needs to be supported and base is able to set Document.baseURI where xml:base can at most set Document.documentElement.baseURI. (Document.baseURI influences how XMLHttpRequest works for instance.) The base element section should probably also talk about what happens when you modify the .href attribute. And today the base element already works in at least FFox and Opera also when content is sent as true XHTML 1.0, so this would not really change anything but the spec. Lars Gunther
Re: [whatwg] base versus xml:base
On 2 Mar 2007, at 19:25, Keryx Web wrote: Anne van Kesteren skrev: I think base should also be allowed in XML documents. It simplifies the language, it already needs to be supported and base is able to set Document.baseURI where xml:base can at most set Document.documentElement.baseURI. (Document.baseURI influences how XMLHttpRequest works for instance.) The base element section should probably also talk about what happens when you modify the .href attribute. And today the base element already works in at least FFox and Opera also when content is sent as true XHTML 1.0, so this would not really change anything but the spec. XHTML 1.0/1.1 doesn't allow xml:base, though, so base is the only way to set a base URL within the document. - Geoffrey Sneddon