View Single Post
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