Text Encoding Initiative reccomends using various pointer schemes. Are there already any XSLT (<= 2.0) implementations which can deal with resolving them? For instance, resolving of @corresp="#range(#id1, #id5)"

- 320
- 2
- 13
-
You have a binary tree. – jdweng Jun 30 '23 at 08:26
-
1Can you ellaborate on this, please? – o-sapov Jun 30 '23 at 09:02
-
XSLT/XPath 2.0 has a function `id` https://www.w3.org/TR/xquery-operators/#func-id that could help for that particular example as I think `id(('id1', 'id5'))` gives you the two elements. – Martin Honnen Jun 30 '23 at 11:20
-
Yes, I confident about `id()`, but `#range(#id1, #id5)` should be somehow parsed to get the list of IDs. Most likely regex can be used here, but I just thougt if there is any robust implementation of this. – o-sapov Jun 30 '23 at 12:36
-
There might be, I am not familiar with details of TEI processing, so wait if someone else shows up that knows more. – Martin Honnen Jun 30 '23 at 16:58
-
Could you do this in XPath with preceding and following operators? – Tom Hillman Jun 30 '23 at 22:09
-
(shame about <= 2.0 - I can imagine a neat solution with accumulators in XSLT 3) – Tom Hillman Jun 30 '23 at 22:10
2 Answers
There isn't anything more than a bare-bones implementation I wrote years ago, around the time of the Balisage paper. The problem is that anything beyond basic id resolution doesn't play very well in XSLT. You could do it in EXSLT, or using the paid tier of Saxon, but developing a straightforwardly distributable version seemed impossible at the time, so I only ever did it in JavaScript (for browser-based visualizations—see https://github.com/hcayless/tei-xpointer.js—rather out of date now). You can do XPath eval in more modern XSLT, but I haven't revisited it lately. I probably should. The TEI Guidelines try to be pretty specific about what gets returned in cases of overlap. Basically text and any elements entirely contained within a range—no partial elements or anything like that.

- 1,036
- 6
- 7
TEI pointers actually predate XPath, and were one of the inspirations. SoftQuad Panorama supported them.
You have to decide what you want the implementation to do if it's asked for a range, as its not just a case of returning all elements between. For example, you can have a range from the middle of one paragraph to the middle of the next. https://journals.openedition.org/jtei/907 has an example.
Hugh Cayless has been active in this area, and https://www.balisage.net/Proceedings/vol5/html/Cayless01/BalisageVol5-Cayless01.html may be a good starting-point.

- 619
- 3
- 7