Open
Description
Basic knowledge of XPath is essential for TEI Publisher customisation.
This short introduction is intended to help understand expressions used through the TEI Publisher on-line course.
XML as a tree
<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://my.fantasy.namespace">
<!-- This whole document is in a made-up namespace -->
<p>The story begins as two ducks (<name type="org" key="mallards">Mr. and Mrs. Mallard</name>)
fly over various potential locations in <name type="place" key="new-england">New
England</name> to start a family.</p>
</div>
Node types in XML document
- element
- attribute
- text
- namespace
- processing-instruction
- comment
- document node
Family relationships between nodes
- parent
- child
- ancestor
- descendant
- sibling
- self
child
parent
descendant
ancestor
XPath
XPath is a language for selecting sets of nodes
Main thing an XPath expression does is to describe, in a formal way that a computer can process easily, certain sets of nodes, e.g.:
- title of the document
- all first paragraphs in a section
- all references to a name of a person
- all sections that are not of type appendix
Metadata
Metadata
Assignees
Labels
No labels