Forum How do I...?

use xinclude to import multiple html files

Timmay
Hi,

I have read the documentation about xinclude, and it appears just the thing I need, but I have troubles getting it to work.

This is what I have:

main.html
<!DOCTYPE html>
<html xmlns:xi="http://www.w3.org/2001/XInclude">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  </head>
  <body>
    <xi:include href="file01.html">
	    <xi:fallback>
		<p>No report is available</p>
	    </xi:fallback>
    </xi:include>
</body>
</html>


file01.html
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Title</title>
  </head>
  <body>
    <h2>Heading</h2>
    <p>&nbsp;</p>
  </body>
</html>


Then I run:
prince --server  main.html


This results in an main.pdf with No report is available
It appears the xi:include tags are ignored.

When I add
<?xml version="1.0" encoding="UTF-8"?>

to my main.html, it does load the file01.html file, but get msg|err|test.html:9|Entity 'nbsp' not defined error.

What am I doing wrong?
dauwhe
If you're going to use named entities, you need a DTD reference in file01.html so that the XML processing knows what that entity means:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


You also need to tell prince to use xinclude, and to parse the original file as XML rather than HTML

prince --xinclude --input=xml main.html
csant
You were checking documentation for a very old Prince version. See here for the most recent one.

Even if you are using an old Prince versions, please always check also the latest documentation - of course it includes all features supported only in more recent versions, but it also contains many additions and improvements in the documentation, clarifying some possibly vague wordings. We don't update documentation for old versions.
Timmay
Thanks dauwhe, you made my day!