View Single Post
Old 07-10-2011, 09:08 AM   #22
Skeezix
Enthusiast
Skeezix began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Jun 2011
Device: Kindle
Quote:
Originally Posted by Algiedi View Post
Very simply, what I'm trying to do, converting from html to mobi is:

When the actual chapter title in the book is "1", I want the corresponding TOC line to say "Chapter 1".

Can I do this with the Calibre XPath TOC generator thingy?
This conversation kinda got complicated in a hurry, but if anyone still cares, there's an easier way to do this that doesn't involve an epub/Sigil intermediate step. Just add custom span tags:

Code:
<h2>1</h2>
<span class="chaptitle" title="Chapter 1" />
Then, just set your xpath to:
Code:
//h:span[re:test(@class, "chaptitle", "i")]
Since the span is empty, it grabs the value from the title attribute.
Skeezix is offline   Reply With Quote