![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 322
Karma: 1231044
Join Date: Feb 2009
Location: London, UK
Device: Kindle Oasis 3, Kindle app on the iPhone
|
XPath query
I was hoping the group might be able to help me with some trouble I have been having at the very end of my first eBook conversion.
I have a file in Word which has Heading 1, 2 and 3s in it, where Heading 3 is the chapter headings, and I would like a TOC built from them. The Word file looks perfect, I am using the latest Mac Office suite. I save as rtf, load the rtf file into TextEdit and save as HTML. Everything renders nicely in Safari, so I view the Heading 2 and Heading 3 lines in Text Wrangler to see they are wrapped with: Code:
<p class="p4"> Code:
<p class="p5"> I don't do HTML natively, but there are some CSS looking lines at the top, which define something akin to these classes, so I go with it. The XPath help file has great examples if you are in the <h1> type world, but I try and adapt, and feed the following line in to the right box in the chapter detection dialogue... Code:
//*[name()='<p class="p4">' or name()='<p class="p5">'] ![]() How stupid am I being, and does anyone have any suggestions as to where I go? To say I am new to this would be an understatement! Thanks! amjb |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,169
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
//*[@class="p4" or @class="p5"]
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 322
Karma: 1231044
Join Date: Feb 2009
Location: London, UK
Device: Kindle Oasis 3, Kindle app on the iPhone
|
Magic!
Thanks so much ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need help with XPath | NASCARaddicted | ePub | 13 | 02-20-2015 06:04 AM |
Xpath TOC Expression | Agama | Calibre | 2 | 07-12-2010 02:24 AM |
XPath question | krischik | Calibre | 0 | 01-16-2010 08:22 AM |
XPath Help and Pagebreak | emellaich | Calibre | 3 | 07-28-2009 02:17 PM |
Xpath hierarchical structure | mtravellerh | Calibre | 4 | 01-03-2009 02:40 PM |