01-29-2017, 03:53 AM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2017
Device: none
|
Help with XPath Expression
I'm trying to convert a book from ODT to EPUB, but I'm having problems with the XPath expression for chapter breaks. My document has specific custom formatting at each break, which (using the suggestion from the "Chapter Detection/Table of Contents Tutorial" sticky) I determined to be:
Code:
<p class="P-Section_20_Number"> Code:
<p class="P-Chapter_20_Number c_odt2"> Would appreciate any help. |
01-29-2017, 07:48 AM | #2 |
creator of calibre
Posts: 43,916
Karma: 22669818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Code:
//h:p[@class="P-Section_20_Number]|//h:p[@class="P-Chapter_20_Number c_odt2"] |
Advert | |
|
02-05-2017, 07:54 AM | #3 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2017
Device: none
|
Thanks for your response. I just tried to use this (pasted the line above into "Detect chapters as (XPath expression):" but Calibre says that the expression is invalid.
In case I wasn't clear above, I want it to break at either one of the above classes. Last edited by a.o.advena; 02-05-2017 at 07:57 AM. |
02-05-2017, 08:05 AM | #4 | |
Grand Sorcerer
Posts: 24,906
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Code:
//h:p[@class="P-Section_20_Number"]|//h:p[@class="P-Chapter_20_Number c_odt2"] |
|
02-05-2017, 11:15 PM | #5 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2017
Device: none
|
Thanks for catching the error. I tried this new expression, but no luck. I still get all the section & chapters in one big xml file.
For kicks, I did a little more experimentation and tried some other combos based on the manual and wizard Code:
//h:p[@class="P-Chapter-Number c_odt0"] Code:
//*[@class="P-Chapter-Number c_odt0"] Code:
//*[re:test(@class, "P-Chapter-Number c_odt0", "i")] |
Advert | |
|
02-06-2017, 12:54 AM | #6 |
Grand Sorcerer
Posts: 24,906
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Is it the same class for all the paragraphs you want to split on? Or does the number in "P-Chapter_20_Number" change? Is that "20" actually the chapter number? If that is the case, the your last test is getting close. I think the following should do it:
Code:
//*[re:test(@class, "P-Chapter", "i")] Code:
//*[re:test(@class, "P-Chapter|P-Section", "i")] |
02-20-2017, 06:28 AM | #7 | ||
Junior Member
Posts: 4
Karma: 10
Join Date: Jan 2017
Device: none
|
Quote:
Quote:
Thanks for your help. |
||
Tags |
chapter detection, odt to epub, xpath |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
XPath Expression Coding | doylejohn | Calibre | 5 | 03-02-2015 07:33 PM |
Xpath Expression list | JimLL | Conversion | 4 | 04-08-2012 02:29 PM |
Xpath TOC Expression | Agama | Calibre | 2 | 07-12-2010 02:24 AM |
XPath Expression wizard?? | tonyx3 | Calibre | 1 | 01-26-2010 04:49 AM |
XPath Expression Wizard Error | Crusader | Calibre | 4 | 12-27-2009 12:09 PM |