Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 12-10-2014, 10:27 AM   #1
~Gretchen~
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

Code:
//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:
Code:
//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
Member
dmonasse began at the beginning.
 
Posts: 23
Karma: 10
Join Date: Apr 2014
Location: Paris
Device: ipad 2, Ubuntu
Hello Gretchen,

Try

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

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

Denis

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

Tags
calibre, conversion, formatting, xpath


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 01:25 PM.


MobileRead.com is a privately owned, operated and funded community.