Comments (10)
It's "stepsToXpath", not "stepToXpath". Steps here means the parsed CFI steps, an array of objects in the form { type, index, id }
, where type
is either "element"
or "text"
(see he parseStep
method).
from epub.js.
Can anyone help me on this ?
from epub.js.
Can anyone help me on this ?
from epub.js.
I need a help on this , Please anyone guide me on this ?
from epub.js.
Step 1. Use Document.evaluate()
to get the nodes (you can get the Document
object from contents.document
, either in the content
hook or by calling rendition.getContents()
).
Step 2. Construct a Range
and use cfiFromRange()
(or use cfiFromElement()
if your target node is an Element
) to get a CFI.
Step 3. Use rendition.display()
to display the CFI.
from epub.js.
Is there any method to generate xpath ?
from epub.js.
Short answer: Don't. Use CFI instead.
Long answer: Firstly, generating XPaths has nothing to do with Epub.js. Second, XPath isn't designed to be used as an identifier. If you want identifiers, you should use CFI. Finally, if you still want to use XPath for whatever reason, there are virtually an infinite number of ways to get XPaths of any given node, depending on what you want to do. The most common approach is:
- Get the name of the element node. This is what goes after
/
. - Enumerate all previous sibling elements and count the number of elements with the same name (including the element itself). This is what you'd put between
[
and]
. - Repeat from step 1 with the parent element until you reach the document element, and concatenate the results.
from epub.js.
Can you tell me stepToXpath(steps) , what does step means here and how to generate it ?
from epub.js.
I don't know anything about "stepToXpath(steps)". Where does this function even come from?
In general, a step in XPath just means an expression that moves you towards the desired result. In practice you can just think of it as everything that comes after a /
.
from epub.js.
![IMG20230922112134.jpg](https://github.com/futurepress/epub.js/assets/115630669/60c07ecf-5859-45ab-b264-06dc452af9c3
In epubjs there is a method named as stepToXpath(steps) , it is taking steps as parameter
from epub.js.
Related Issues (20)
- epubjs cfirange HOT 1
- page-break-after: always not honored HOT 2
- Add function script before render HOT 2
- Shift right when selection text HOT 3
- Bug: When package manifest and toc are in different folders, navigation does not work.
- Unable to read renderless.html file when i change the url to my book HOT 2
- Is `ignoreClass` value within the examples outdated? HOT 1
- What happened to the official website? The content is very strange. HOT 2
- Continuous Manager inside an element that is scrolling that is not the viewport?
- Scripted Content SandBoxing issue, And CFI pages position
- Extracting the text per rendered section / block using epub js? HOT 32
- How do I add a paginated swipe animation?
- highlight not working post integrating with hammer.js for swiping HOT 1
- how to call images in css file? HOT 1
- about rendition.next(), rendition.prev()
- about InlineView
- Minified XML causes 'container.xml not found' HOT 4
- renderTo CSS selector instead of ID HOT 1
- [Bug] Blank page when resize happen during loading
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epub.js.