This demonstration comprises three tiny input files representing chapters, and a driver file that represents the entire book, but it does not actually contain the chapters, it just refers to them via XInclude.
If the live demonstration doesn't work, here is the pre-baked version: