140 likes | 240 Views
Pointers in the TEI. Current issues 3 octobre 2004. Pointing and linking in the TEI. Two applications of ponting in the TEI Linking (cross-references) User-selectable hypertext link Requires at least one address in the same or another document E.g. (old notation):
E N D
Pointers in the TEI Current issues 3 octobre 2004
Pointing and linking in the TEI • Two applications of ponting in the TEI • Linking (cross-references) • User-selectable hypertext link • Requires at least one address in the same or another document • E.g. (old notation): <ref target="chap2">See chapter two</ref> • prev/next mechanism for splitted objects
Pointer notations in P5 • Changes from P4 • Move from ID/IDREF notation to pointers • e.g. <sp xml:id="king1" next="#king2" who="#King">Speak, knave or</sp> <sp who="#Fool">What would you have me say?</sp> <sp xml:id="king2" prev="#king1" who="#King">— or lose your tongue, but if it be not civil it will be forfeit in any case</sp>
Background • URI referencing • URI specification (RFC2396) • Single document • http://www.foo.fr/myDoc.xml • Fragment thereof (fragment-ID): • http://www.foo.fr/myDoc.xml#… • Note: The details of the interpretation of the Fragment-ID depend on the Internet MIME-type of the resource identified by the URI • Mime type for TEI documents • application/xml+tei
Background (cont.) • Xpointer framework (W3C) • Fragment-ID identified by a scheme name • E.g.: element(), xmlns(), xpointer() • Additional W3C constructs • xml:base • interpretation of relative URIs • xml:id • schema-language independent marking of XML ID attributes in the document instance
Consequences on TEI attributes • Main attribute changes for <ptr> and <ref> • xml:base added to tei.global.attributes • Global id attribute replaced by xml:id • Creation of two new data-types: • tei.pointer (xsd:anyURI) • tei.pointers (sort-of list { xsd:anyURI+ }) • IDREF attributes in P4 become tei.pointer • IDREFS attributes in P4 become tei.pointers • New cref attribute (mutually exclusive with target: canonical reference (see http://www.tei-c.org/Activities/SO/sow08.html)
Consequences on TEI attributes (cont.) • resp, crdate, targType, and targOrder attributes: removed from the a.pointer class • resp and crdate: approximate metadata handling • targType: too simple validation mechanism
Examples of use • simplest Xpointer: points to an element labeled with an ID attribute • Note: a Fragment-ID without an explicit pointer scheme is interpreted as an IDREF • E.g.: mydoc.xml#s23 • E.g.: use of relative URI • <p>In section <ptr target="../CO/co.odd#COXR"/> we introduced the simplest pointer elements, <gi>ptr</gi> and <gi>ref</gi> • IDREFS attributes expressed as whitespace separated list of URIs
Additions to the W3C pointing scheme • W3C pointing schemes • Bare names: #foo • element(): abbreviated pointing by means of child numbers • xmlns(): to declare namespaces for user-extended pointer schemes • TEI: six new Xpointer schemes • xpath(), xpath2(), range(), string-range(), left(), and right()
New TEI schemes • xpath(path) • locates a node within an XML Information Set. • The single argument path is an XPath path as defined in the W3C XPath 1 Recommendation. • The node resulting from evaluating the XPath is the reference of an address using the xpath() scheme. • xpath2(path) • locates a node within an XML Information Set. • The single argument path is an XPath 2.0 path as defined in the W3C XPath 2 Recommendation. • The node resulting from evaluating the XPath, is the reference of an address using the xpath2() scheme.
New TEI schemes (cont.) • left(pointer) and right(pointer) • locates the point immediately preceding (following) its argument. • The pointer argument to left() or right() are bare names or XPointer pointer schemes themselves, and are resolved according to their normal rules. • range(pointer1, pointer2) • The range() scheme locates a range between two locations in an XML information set. • The two pointer arguments to range() locate the boundaries of the range by two points. The parameters pointer1 and pointer2 are XPointers themselves, and are resolved according to the rules specified in the definition of the pointer scheme they use.
New TEI schemes (cont.) • string-range(pointer, offset, [length]) • The string-range() scheme locates a range based on character positions. • Pointer: node or range within which a string is to be located • Origin= 0 • Offset: start of the range (relatively to origin) • Length: defaulted to 1
New TEI schemes (cont.) • match(pointer, string[, index]) • designates the result of a literal match of the argument string within the string-value of the pointer argument. • The result is a range from the first matching character to the last. • Index (≥ 1): match to be chosen (when more then 1)
Example • Selection of the 20th character of the fourth paragraph of the second div of the XML document found at http://foo.org/foo.xml: http://foo.org/foo.xml#string-range(xpath(//div[2]/p[4]),20)