Forum Bugs

<img/> in file that is xi:include'd is ignored

mrose
in the main file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
      xmlns:xi="http://www.w3.org/2003/XInclude">


and later on:

<xi:include href="2008/07.html" />


in the file 2008/07.html there is a bunch of text that gets rendered and a

<img src='foo.jpg' />


which is ignored. no error messages, nothing.
mikeday
Does the image load correctly when it is placed in the main document? Is foo.jpg located in the 2008 directory, the same as the 07.html file?
mrose
yes, the image renders properly when in the main document.

basically, i just deleted the "xi:include" line and inserted the contents of that file at that point and it worked as expected.

also, for clarification if i include "2008/x.html" if there are includes/images inside that file are they relative to the main file or relative to the "2008/" directory?

thanks!

/mtr
mikeday
Relative image URLs in the included file should be resolved relative to that file, as XInclude implies a virtual xml:base attribute on the included file to specify its original URL so that relative URLs don't break when it gets included somewhere else.
mrose
that's what i figured. i tried it with both

<img>


and

<img>


and neither yielded an error. that's what made me suspect the img element was being ignored altogether.

/mtr
mikeday
Perhaps it could be a namespace issue; the parent document root element is in the XHTML namespace, but what about the included document?
mrose
mikeday wrote:
Perhaps it could be a namespace issue; the parent document root element is in the XHTML namespace, but what about the included document?


probably that's the issue. here is what is in the main document:

<DOCTYPE>
<html>


what should the wrapper in the included file look like?

/mtr
mrose
sorry, that message got mangled. the prefix is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
      xmlns:xi="http://www.w3.org/2003/XInclude">
mikeday
My main concern in this case is whether the included document also has a xmlns="http://www.w3.org/1999/xhtml" on the root element, so that its contents are all in the XHTML namespace.

Also, what is the root element of the included document? Please note that if the root element is also <html>, that <style> elements in the included document will not be processed.
mrose
mikeday wrote:
My main concern in this case is whether the included document also has a xmlns="http://www.w3.org/1999/xhtml" on the root element, so that its contents are all in the XHTML namespace.

Also, what is the root element of the included document? Please note that if the root element is also <html>, that <style> elements in the included document will not be processed.


mike - help me out here. what do i want to be using as the root element for the included document? i just need to be able to use the usual xhtml elements, e.g., div, img, etc.

/mtr
mikeday
A <div> should be fine, then you can include it somewhere in the body of your main document. If you add the XHTML namespace to the root of the included document does the image work? (Or at least give an error message).
mrose
mikeday wrote:
A <div> should be fine, then you can include it somewhere in the body of your main document. If you add the XHTML namespace to the root of the included document does the image work? (Or at least give an error message).


yeah, that's what i'm using. could you send an email to mrose17@gmail.com and i'll email you a zip that shows the problem.
mrose
it was pilot error, mike found the problem ... the included file needed this namespace:

<!DOCTYPE div PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<div xmlns="http://www.w3.org/1999/xhtml"> ... </div>


/mtr

ps: i have to confess that princexml is an excellent technology. i've now done four different projects using it and i'm super-impressed with the resulting work product. great work, guys!