View Single Post
Old 02-27-2015, 02:08 PM   #7
chaot
Head of lunatic asylum
chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.chaot will give the Devil his due.
 
chaot's Avatar
 
Posts: 349
Karma: 77620
Join Date: Jun 2012
Location: UTC +1
Device: Tolino Vision 3HD
The original to start with, see A very short ebook.

Quote:
Originally Posted by PeterT View Post
You don't use the XPATH settings in the regular search area.

Try clicking on Tools | Table of Contents | Edit Table of Contents and then there is a button Generate ToC from XPath
Or just use the button ToC (see Button-Edit the Table of Contents). But this button (from general calibre window) is more for to see the ToC than to edit, even so possible.

So you are quite right to mention the 'path': without Edit book window we wouldn't know the correct 'key phrases' to use (see Edit the ToC in ... (Start) after Fix HTML + Beautify current file)

In a (very) small ebook creating the ToC its enough to fill the libprs500 window only HTML tags with tag names (like a, br, div, h1, h2 etc.) and ignore the attribute and value inputs. That's probably in bigger ebooks not to ignore in order to obtain a really sophisticated ToC (at moment I don't know).

Here results the same if using only //h:h1 or (full expression) //h:h1[re:test(@class, "bookTitle", "i")] - tested.

See Create ToC from XPath and the result Edit the ToC in ...(vers A).
Note: The HTML tags div and h2 get id-numbers (both h2 different ones), but the HTML tag h1 gets none. Can you say something about?

It's possible to customize the ToC, see Edit the ToC in ...(vers B)

Quote:
Originally Posted by phossler View Post
and then comes Python. Probably more questions in future.

Quote:
... why you were looking to use XPath. Sorry, but maybe you could provide a little more about what you were looking to do?
I like to edit a fair amount of books. Success often has to do with proper, well-known tools (calibre and around).
As a sailor I like to navigate, preferably in new territories.

Quote:
Originally Posted by eschwartz View Post
... the regex did not work because you were in normal mode, not regex mode. The S&R can take regexes, like the translation I supplied, if treated correctly. xpath is totally different.
As we are already a bit further! I would also like to know something about regex mode. Beside of what is described in regular expressions - a practical aspect maybe. S&R??? Please!

Correct treatment, very important.

There are some between us you'll explain dozen times the theory or even better once the practice.

XPath Tutorial is great (as far as I can tell). Only a small but not unimportant hint is missing: where you can do something with it. ToC or 'Table of content' isn't mentioned even once.

My pictures show details, always different ones.
Attached Thumbnails
Click image for larger version

Name:	A very short ebook.png
Views:	188
Size:	96.9 KB
ID:	135407   Click image for larger version

Name:	Button-Edit the Table of Contents.png
Views:	193
Size:	85.6 KB
ID:	135408   Click image for larger version

Name:	Edit the ToC in ...(Start).png
Views:	188
Size:	202.6 KB
ID:	135409   Click image for larger version

Name:	Create ToC from XPath.png
Views:	178
Size:	47.3 KB
ID:	135410   Click image for larger version

Name:	Edit the ToC in ...(vers A).png
Views:	187
Size:	143.0 KB
ID:	135411   Click image for larger version

Name:	Edit the ToC in ...(vers B).png
Views:	172
Size:	155.8 KB
ID:	135412  

Last edited by chaot; 03-02-2015 at 04:57 AM. Reason: corrected language
chaot is offline   Reply With Quote