
: Xpath in the calibre editor Abstract In some search operations in calibre one can use an xpath expression to get the values for particular tags, i.e. the following expression: //h:div[re:test(@class,
Abstract
In some search operations in calibre one can use an xpath expression to get the values for particular tags, i.e. the following expression:
//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:
<div class="figbox">Volterra</div>
the preceding xpath expression returns the value "Volterra". This is useful to compile the ToC of a book and for other tasks.
Question
Now, with the following processing-instructions
<?bag value="2" content="Volterra"?>
<?bag value="3" content="Ferrara"?>
which xpath expression can I use to obtain the value "Ferrara" but not "Volterra"?
Fieldwork
With the calibre editor I've tried putting in a book the following line
<?bag value="3" content="Ferrara"?>
and testing the following expressions to add the word "Ferrara" in the ToC:
//processing-instruction("bag")[@value="3"]/@content
substring-before(substring-after(//processing-instruction('bag'), 'value="3" content="'), '"')
but in both cases I get only
"calibre, version 3.30.0
ERROR: No items found: No items were found that could be added to the Table of Contents.
Free books android app tbrJar TBR JAR Read Free books online gutenberg
More posts by @Mike

: What does the blue circle with the underlined check mark mean in GPB? What does the blue circle on the right of my book list indicate in Google Play Books? You see the first book in the