Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre


Thread Tools Search this Thread
Old 12-10-2014, 10:27 AM   #1
Junior Member
~Gretchen~ began at the beginning.
Posts: 1
Karma: 10
Join Date: Dec 2014
Device: none
Question Help with XPath picking up two classes for chapter and chapter name?

My html code has two "class=" tags. One called "chapter" and one called "chaptername"

In a previous ebook I converted - I was able to successfully use

//h:p[re:test(@class, "chapter", "i")]
But that only picks up whatever is under the one class=chapter tag. I'm unfamiliar with XPath and I want to have both chapter and chaptername on Level one.

I want Calibre to list the chapters in the TOC like:

Chapter 1 - Blah Blah Name of Chapter
Chapter 2 - Blah blah another name

I tried just adding the second "chaptername" tag after the first like this:
//h:p[re:test(@class, "chapter","chaptername", "i")]
But it still only picked up what was under the chapter tag.

Sorry if I'm not explaining this correctly! Can anyone help??? Thanks!
~Gretchen~ is offline   Reply With Quote
Old 12-10-2014, 10:52 AM   #2
dmonasse began at the beginning.
Posts: 23
Karma: 10
Join Date: Apr 2014
Location: Paris
Device: ipad 2, Ubuntu
Hello Gretchen,


//h:p[re:test(@class, "chapter(name)?", "i")]

//h:p[re:test(@class, "chapter|chaptername", "i")]
Hope this helps.


Last edited by dmonasse; 12-10-2014 at 10:56 AM.
dmonasse is offline   Reply With Quote

calibre, conversion, formatting, xpath

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
xpath to insert chapter breaks - but chapter name cut off ? Rob557 Conversion 2 03-06-2014 07:59 AM
xpath exp for just roman unumerals as Chapter headings p3aul Conversion 8 04-08-2012 05:30 PM
Ebook chapter titles: with or without chapter number? amoroso Writers' Corner 16 06-14-2011 07:35 AM
Xpath expression for detecting chapter marks p3aul Calibre 5 11-15-2010 12:14 AM
xpath for chapter detection romnempire Calibre 7 07-26-2010 06:34 PM

All times are GMT -4. The time now is 08:21 AM. is a privately owned, operated and funded community.