0

I try to extract some text for creating a lemma in the back of a book and don't know how to grab the nodes:

Consider the following:

<anchor type='commentary' xml:id='A1'/>Romeo and Juliet<note type='commentary' xml:id='N1'>Some blabla</note> is a tragedy written by William Shakespeare 

So with my XSLT i want to be able to access the text between anchor and note to write a lemma in the back of the book:

p. 1 Romeo and Juliet) Some blabla

The problem is that basically all other possible elements can occur between anchor and note so I can't just use text(). E.g. sometimes I have the element in between anchor and note:

<anchor type='commentary' xml:id='A1'/>Romeo <c rendition="ampersand"/> Juliet<note type='commentary' xml:id='N1'>Some blabla</note>

with the undesired result of 'Romeo Juliet' instead of 'Romeo & Juliet'

How can i copy the nodes between anchor and note to access it a second time?

martinanton
  • 217
  • 1
  • 7
  • 1
    Is any `anchor type="commentary"` followed by a `note type="commentary"`? Then you could use a template matching the anchor and use e.g. `` and then set up templates for `mode="lemma"` which output the contents as needed (e.g. transform `c rendition="ampersand"` to an ampersand). – Martin Honnen Apr 04 '18 at 15:23
  • Yes, anchor[commentary] and note[commentary] come in two, and the xml:id is basically the same except for a vs. n as first letter. – martinanton Apr 04 '18 at 15:25
  • 1
    As an alternative to the `for-each-group` you could also use `following-sibling::node() << id(translate(@xml:id, 'A', 'N'))` to select the nodes following the `anchor` (assumed as the context node) and preceding the corresponding `note`. – Martin Honnen Apr 04 '18 at 15:39

0 Answers0