![]() |
#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. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,268
Karma: 27111060
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 | |
|
![]() |
#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. |
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
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"] |
|
![]() |
![]() |
![]() |
#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 | |
|
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
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")] |
![]() |
![]() |
![]() |
#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 |
|
![]() |
||||
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 |