Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 08-31-2018, 02:35 PM   #1
Sam Sahara
Connoisseur
Sam Sahara doesn't litterSam Sahara doesn't litterSam Sahara doesn't litter
 
Posts: 79
Karma: 228
Join Date: Aug 2014
Device: lambda k21
Help about xpath expression

In some search operations in calibre one can use an xpath expression to get the values for particular tags, i.e. the following expression:

Code:
//h:div[re:test(@class, "figbox", "i")]
selects the content of a "div" tag whose "class" attribute is set to "figbox", so in the following html line:

Code:
<div class="figbox">Volterra</div>
the preceding xpath expression get the value "Volterra".

Now, with the following processing-instructions

Code:
<?bag value="2" content="Volterra"?>
<?bag value="3" content="Ferrara"?>
which xpath expression can I use to obtain the value "Ferrara" and not "Volterra"?

EDIT ===============================

I've tried putting in a book the following line

Code:
<?bag value="3" content="Ferrara"?>
and trying the following expression to add the word "Ferrara" in the ToC:

Code:
//processing-instruction("bag")[@value="3"]/@content
but I get only
Code:
"calibre, version 3.30.0
ERROR: No items found: No items were found that could be added to the Table of Contents.



ss

Last edited by Sam Sahara; 08-31-2018 at 04:24 PM.
Sam Sahara is offline   Reply With Quote
Old 08-31-2018, 06:20 PM   #2
Sam Sahara
Connoisseur
Sam Sahara doesn't litterSam Sahara doesn't litterSam Sahara doesn't litter
 
Posts: 79
Karma: 228
Join Date: Aug 2014
Device: lambda k21
Quote:
Originally Posted by Sam Sahara View Post
EDIT ===============================

I've tried putting in a book the following line

Code:
<?bag value="3" content="Ferrara"?>
and trying the following expression to add the word "Ferrara" in the ToC:

Code:
//processing-instruction("bag")[@value="3"]/@content
but I get only
Code:
"calibre, version 3.30.0
ERROR: No items found: No items were found that could be added to the Table of Contents.
Same result with the following expression:
Code:
substring-before(substring-after(//processing-instruction('bag'), 'value="3" content="'), '"')
Sam Sahara is offline   Reply With Quote
Reply

Tags
xpath


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with XPath Expression a.o.advena Conversion 6 02-20-2017 06:28 AM
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


All times are GMT -4. The time now is 02:59 AM.


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