How to make the TEI P5 to DOCX scenario handle <transpose> elements?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Dotno
Posts: 5
Joined: Thu Apr 14, 2022 1:05 am

How to make the TEI P5 to DOCX scenario handle <transpose> elements?

Post by Dotno »

Can the TEI P5 DOCX scenario native to the Oxygen Editor handle the <listTranspose> element? Mine is completely ignoring what I've put into it when transforming to DOCX...

Code: Select all

<listTranspose>
            <transpose source="#Q2">
                <ptr target="#Q2_2"/>
                <ptr target="#Q2_1"/>
            </transpose>
            <transpose source="#Q2 #Q3">
                <ptr target="#Q2and3_1_begin"/>
                <ptr target="#Q2and3_1_1"/>
                <ptr target="#Q2and3_1_2"/>
                <ptr target="#Q2and3_1_3"/>
                <ptr target="#Q2and3_1_4"/>
                <ptr target="#Q2and3_1_end"/>
            </transpose>
...
</listTranspose>
Later in the <text> element at the top of which this sits, I have <lg> elements with these @xml:id's that the <ptr> are pointing to. I need to have the transformation process these specific <lg>'s in this order for the @source specified in the <transpose> element. These I am specifying as a global variable in the XSLT and manually changing them (there aren't that many). If the native transformation in Oxygen does not handle this, what are my options?
https://stackoverflow.com/questions/374 ... ment-order
This here for example has a list of all element names stored in a variable in the desired order. I do not know how the order I desire, which is not global, can be applied like this.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to make the TEI P5 to DOCX scenario handle <transpose> elements?

Post by Radu »

Hi,

Oxygen XML Editor is bundled with the latest TEI 7.52.0 XSLTs provided by the TEI organization. I'm afraid I do not know specifics about the TEI to DOCX implementation.
I asked for help on the TEI users list, maybe the developers of that conversion can help further:
https://listserv.brown.edu/cgi-bin/wa?A ... -L&P=12670

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Syd
Posts: 3
Joined: Fri Dec 24, 2010 5:45 pm

Re: How to make the TEI P5 to DOCX scenario handle <transpose> elements?

Post by Syd »

Sorry to say, I don’t believe the TEI Stylesheets bundled with oXygen that Radu mentions handle the <transpose> element at all. (Version 7.53.0 is due out next week, but no change has been made that would support <transpose>.) Furthermore, to my knowledge no one has ever written code to process a <tei:transpose>.

It is way past my bedtime at the moment, but I will try to give this some thought over the weekend. No promises that I can do this, but my first instinct is that an XSLT pre-processing step is the way to go. Not sure how it might work. Probably takes two stages. First step through all of the <transpose> elements, and for each create a data structure to hold the nodes to be transposed (as a key, an array, a map, an XML snippet, whatever works), recording along with it its position() within the <transpose> (which might well just be its position in the data structure). Then walk the input document tree copying to output, but for each node before it is copied ask the question “am I in that data structure”? If the answer is yes, ask the question “how many nodes before me are also in the data structure?” — call that number N. Then, instead of me, copy over the Nth+1 entry from the data structure into the output.

That may be mostly blather, but it may be enough to jog my memory on how to do this. If you don’t hear from me in a week, feel free to ping me, Donto. But keep in mind I am only committing to work on it for a bit; no promises that I will be successful.
Dotno
Posts: 5
Joined: Thu Apr 14, 2022 1:05 am

Re: How to make the TEI P5 to DOCX scenario handle <transpose> elements?

Post by Dotno »

Thank you Radu and Syd!
I hope inspiration strikes you over the weekend Syd! I might also try something, though my coding skills are pretty rudimentary, and being self-taught, I'm in the dark about a lot of things...
Best,
Dotno
Post Reply