Body: <p>To separate an EPUB file to multiple file, I need to <a href="https://ebooks.stackexchange.com/q/7625/10251">find all <code>&lt;h2</code> and replace them with <code>&lt;hr class="sigil_split_marker" /&gt;&lt;h2</code></a>. However, each element of a chapter is consisted in its own html file, which means I can only replace once at a time. And when splitting it, it gives the error:</p>
  
  <p><img src="https://i.sstatic.net/k4M06.png" alt=""></p>
  
  <blockquote>
    <p>Cannot split since at least one file may not be an HTML file.</p>
  </blockquote>
  
  <p><strong>Q</strong>: How to split the file into multiple files, each consists the opening image, chapter name and its contain?</p>
  
  <p>Below is the structure of the file:</p>
  
  <hr>
  
  <h1>Head</h1>
  
  <p>Every page has the same head.
      
      </p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;title&gt;Packing for Mars&lt;/title&gt;
      &lt;meta content="http://www.w3.org/1999/xhtml; charset=utf-8" http-equiv="Content-Type"/&gt;
  &lt;link href="../Styles/stylesheet.css" type="text/css" rel="stylesheet"/&gt;
  &lt;style type="text/css"&gt;
          @page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; }&lt;/style&gt;
  &lt;/head&gt;
  </code></pre>
  
  <h1>Image</h1>
  
  <pre><code>  &lt;body class="calibre"&gt;
  &lt;div id="filepos129415" class="calibre1"&gt;
  &lt;div class="calibre30"&gt;
  &lt;p class="calibre31"&gt;&lt;img alt="image" src="../Images/00006.jpg" class="calibre16"/&gt;&lt;/p&gt;
  &lt;div class="calibre32"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <h1>Chapter name</h1>
  
  <pre><code>  &lt;body class="calibre"&gt;
  &lt;h2 class="calibre13" id="calibre_pb_30"&gt;&lt;span class="calibre10"&gt;&lt;span class="bold"&gt;&lt;span&gt;&lt;span class="bold"&gt;YOU GO FIRST&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
  &lt;div class="calibre32"&gt;&lt;/div&gt;
  &lt;p class="calibre8"&gt;&lt;span class="calibre12"&gt;&lt;span class="bold"&gt;&lt;span&gt;&lt;span class="italic"&gt;CHAPTER NAME&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;div class="calibre28"&gt;&lt;/div&gt;
  &lt;div class="calibre1"&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <h1>Content</h1>
  
  <pre><code>  &lt;body class="calibre"&gt;
  &lt;div class="mbppagebreak" id="calibre_pb_31"&gt;&lt;/div&gt;
  &lt;p class="calibre33"&gt;&amp;#160;&lt;/p&gt;
  &lt;p&gt;Loren Ipsum&lt;/p&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-11T03:33:06.367Z
Comments.Text: perhaps the files are in xhtml, not html, so Sigil can't process it
Comments.UserDisplayName: Ooker
Tags: <epub><html><sigil>
Title: How to split an EPUB into multiple files of one chapter if each chapter consists multiple html pages?
UserDisplayName: Ooker
ThreadText: # How to split an EPUB into multiple files of one chapter if each chapter consists multiple html pages?
  
  (Asked by: username_0 on 2018-01-10)
  
  To separate an EPUB file to multiple file, I need to find all  and replace them with . However, each element of a chapter is consisted in its own html file, which means I can only replace once at a time. And when splitting it, it gives the error:
  
  
  Cannot split since at least one file may not be an HTML file.
  
  Q: How to split the file into multiple files, each consists the opening image, chapter name and its contain?
  Below is the structure of the file:
  
  Head
  Every page has the same head.
      
      
  
  
      Packing for Mars
      
  
  
  
  
  Image
    
  
  
  
  
  
  
  
  
  
  Chapter name
    
  YOU GO FIRST
  
  CHAPTER NAME
  
  
  
  
  
  
  Content
    
  
   
  Loren Ipsum
  
  **Tags:** epub, html, sigil
  
  > **Comments:**
  > **username_0**: perhaps the files are in xhtml, not html, so Sigil can't process it  
  
  ---
  
  ## 0 answers
  
  