csplit alone will not output correct HTML files, as they will be missing the header and final closing tags. But I use csplit for all my books, this is what I do:
1. Put the whole book (at least the main part, title page, notes, etc. can be done separately) in a single XHTML file. Format as desired.
2. Add the head stuff before each chapter, i.e. something like:
Code:
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<title>Chapter IV</title>
<link href="css/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
3. Now use csplit:
Code:
csplit /encoding/ {*}
This splits at every ({*}) appearence of the string "encoding", which is uncommon enough to usually give no problem. Then rename and move the resulting files (xx00, xx01, ...) to their final location. This part can be done with a script.