#517 teitodocx: tei:label treatment loses context


== Summary ==

teitodocx: tei:label treatment loses context

== Versions ==

OS: Ubuntu 12.10

TEI package version:

$ apt-cache policy tei-p5-xsl2
Installed: 6.26
Candidate: 6.26
Version table:
*** 6.26 0
500 http://tei.oucs.ox.ac.uk/teideb/binary/ ./ Packages
100 /var/lib/dpkg/status
[... etc ...]

== How to Reproduce ==

1. Download the attached zip file.

2. Unzip. Cd into new directory.

3. Edit stock.mk so that APPHOME points to whatever stylesheet directory you use when you want to use the "stock" TEI files.

4. Execute:

$ make CONFIG=stock.mk

This will produce test1.docx from test1.xml. The output will be in the "stock" subdirectory.

5. Execute:

$ make CONFIG=local.mk

The output will be in the "local" subdirectory this time. This make uses of the "stock" tree but with the patch in stylesheet.diff applied. The modified tree is saved locally in the stylesheet directory.

== Actual Results ==

The "stock" subirectory contains what someone would get when running teitodocx without further customization:

label on one line
gloss on the next line.

== Expected Results ==

The "local" subdirectory contains what someone would get if the default profile for processing docx did not contain special code for handling tei:label:

label at the beginning of the line, tab, and gloss.

== Observations ==

1. The difference between the stock TEI tree and the local tree is that two templates dealing with tei:label were removed from stylesheet/profiles/default/docx/to.xsl. Effectively, this means that in the local tree stylesheet/docx/to/lists.xsl handles tei:label.

2. From a purely visual standpoint it is not clear whether the way the stock stylesheet/profiles/default/docx/to.xsl handles tei:label or the way stylesheet/docx/to/lists.xsl does it is better. That is, I think this is dependent on what the person calling teitodocx is trying to do. I see that stylesheet/profiles/default/docx/to.xsl handles long labels better but I happen to be working on a project where I do not have long labels (abbreviation lists). It so happens that the way stylesheet/docx/to/lists.xsl does it is *much* better for me, visually, than the way stylesheet/profiles/default/docx/to.xsl does it.

3. The way stylesheet/profiles/default/docx/to.xsl does it actually has a serious drawback from an XSLT standpoint: it completely obliterates context information. Before I figured out that stylesheet/profiles/default/docx/to.xsl was doing some special treatment of tei:label I had some code that would mysteriously fail because it depended on detecting that an element was inside tei:front rather than elsewhere. But stylesheet/profiles/default/docx/to.xsl creates a tree that has tei:list for root and processes it. The processing done by stylesheet/docx/to/lists.xsl does not suffer from this issue because it preserves context information.

(I've asked myself whether this is a feature request or a bug report. Point 3 is the one which makes it go into bug report territory.)

=== Possible solutions ===

1. Change stylesheet/profiles/default/docx/to.xsl so that it does not try to process tei:label. Easy but this would break things for anyone who depended on the way stylesheet/profiles/default/docx/to.xsl does it.

2. Change stylesheet/profiles/default/docx/to.xsl so that it preserves context information. (Since there is no way to tell the XSLT processor "use the tei:label processing from stylesheet/docx/to/lists.xsl instead of stylesheet/profiles/default/docx/to.xsl, I'd still have to do something in my own customization like cut-and-paste things from stylesheet/docx/to/lists.xsl. Yuck!)

3. Make the choice of single line vs separate lines be a configuration option, with the default being separate lines (for compatibility with previous versions). Preserve context information no matter what option is selected.


  • Sebastian Rahtz

    Sebastian Rahtz - 2013-01-26

    I am glad you have brought that up. I have been puzzled by it several times myself, and needed an incentive to tackle it.

    I cannot see any advantage to the default/docx/to.xsl method. I have taken your option 3, and made the separator into a parameter ($glossListSeparator) which have have a value "tab" or "break". The indent is the same either way.

    I have cleaned up that default/docx/to.xsl and moved some obvious material back to the main stylesheet. It now does much less. which is as it should be.

  • Sebastian Rahtz

    Sebastian Rahtz - 2013-01-26
    • status: open --> closed-fixed