#523 TEI to DOCX transform fails (TEI XSL 6.27)

AMBER
closed-works-for-me
5
2013-04-08
2013-01-31
Sorin Ristache
No

DOCX transformation applied to any simple TEI P5 document fails with the error: Cannot write to a URI that has already been read. The full output log of the ANT transformation:

Buildfile: S:\projects\eXml-trunk\frameworks\tei\xml\tei\stylesheet\docx\build-to.xml

setup:
[mkdir] Created dir: D:\support\TEI\out\temp-dir-for-ant

odd:

notodd:
[copy] Copying 1 file to D:\support\TEI\out\temp-dir-for-ant

transform:
[echo] unzip Word template
[unzip] Expanding: S:\projects\eXml-trunk\frameworks\tei\xml\tei\stylesheet\profiles\default\docx\template.docx into D:\support\TEI\out\temp-dir-for-ant
[echo] remove custom document properties, notes,
[echo] footers, headers etc from Word template
[delete] Deleting D:\support\TEI\out\temp-dir-for-ant\docProps\custom.xml
[delete] Deleting D:\support\TEI\out\temp-dir-for-ant\word\endnotes.xml
[delete] Deleting D:\support\TEI\out\temp-dir-for-ant\word\footnotes.xml
[delete] Deleting D:\support\TEI\out\temp-dir-for-ant\word\webSettings.xml
[echo] fix Word .rels file
[xslt] Processing D:\support\TEI\out\temp-dir-for-ant\_rels\.rels to D:\support\TEI\out\temp-dir-for-ant\_rels\.rels_
[xslt] Loading stylesheet S:\projects\eXml-trunk\frameworks\tei\xml\tei\stylesheet\docx\tools\fixdotrels.xsl
[move] Moving 1 file to D:\support\TEI\out\temp-dir-for-ant\_rels
[move] Attempting to rename: D:\support\TEI\out\temp-dir-for-ant\_rels\.rels_ to D:\support\TEI\out\temp-dir-for-ant\_rels\.rels
[echo] Fix Word styles file
[xslt] Processing D:\support\TEI\out\temp-dir-for-ant\word\styles.xml to D:\support\TEI\out\temp-dir-for-ant\word\_styles.xml
[xslt] Loading stylesheet S:\projects\eXml-trunk\frameworks\tei\xml\tei\stylesheet\docx\tools\fixstyle.xsl
[move] Moving 1 file to D:\support\TEI\out\temp-dir-for-ant\word
[move] Attempting to rename: D:\support\TEI\out\temp-dir-for-ant\word\_styles.xml to D:\support\TEI\out\temp-dir-for-ant\word\styles.xml
[echo] Get names of graphics files and write an ant task
[xslt] Processing D:\support\TEI\out\temp-dir-for-ant\tmp2.xml to D:\support\TEI\out\temp-dir-for-ant\copy.xml
[xslt] Loading stylesheet S:\projects\eXml-trunk\frameworks\tei\xml\tei\stylesheet\tools\makegraphicsanttask.xsl
[echo] Copy image files by running ant task

dist:
[echo] Read dimensions of image files and write info file
[echo] Generate new files for docx
[xslt] Processing D:\support\TEI\out\temp-dir-for-ant\tmp2.xml to D:\support\TEI\out\temp-dir-for-ant\newdocument.xml
[xslt] Loading stylesheet S:\projects\eXml-trunk\frameworks\tei\xml\tei\stylesheet\profiles\default\docx\to.xsl
[xslt] S:\projects\eXml-trunk\frameworks\tei\xml\tei\stylesheet\docx\to\docxfiles\numbering-definition.xsl:83: Fatal Error! Cannot write to a URI that has already been read: file:/D:/support/TEI/out/temp-dir-for-ant/word/numbering.xml
[xslt] Failed to process D:\support\TEI\out\temp-dir-for-ant\tmp2.xml

BUILD FAILED
S:\projects\eXml-trunk\frameworks\tei\xml\tei\stylesheet\docx\build-to.xml:144: Fatal error during transformation

Total time: 2 seconds

The process finished with exit code: 1

Discussion

  • I can't reproduce this, either on my command line with ant or in my oxygen 14.1

    my test is

    java -Xmx256m \ -classpath "$(OXY)/tools/ant/lib/ant-launcher.jar" \ -Dant.home=$(OXY)/tools/ant \ org.apache.tools.ant.launch.Launcher \ -f ../docx/build-to.xml \ -lib $(OXY)/lib/saxon9ee.jar \ -DoutputFile=test7.docx \ -DinputFile=test7.xml -Dprofile=default

    (where $OXY is the location of oxygen). There must be some combination of parameters
    different at your end, but I cannot understand what.

     
  • Sorin Ristache
    Sorin Ristache
    2013-01-31

    I get the error with the following command:

    "C:\Program Files (x86)\Java\jdk1.6.0_23\jre/bin/java" -classpath "S:\projects\eXml-trunk\dist\InstData\All\oxygen/tools/ant/lib/ant-launcher.jar" "-Dant.home=S:\projects\eXml-trunk\dist\InstData\All\oxygen/tools/ant" org.apache.tools.ant.launch.Launcher -lib "S:\projects\eXml-trunk\dist\InstData\All\oxygen\lib\saxon9ee.jar" -f "S:/projects/eXml-trunk/dist/InstData/All/oxygen/frameworks/tei/xml/tei/stylesheet/docx/build-to.xml" "-DoutputFile=D:\support\TEI/out/test-DOCX.docx" "-DinputFile=D:\support\TEI\test-DOCX.xml" "-Dprofile=default"

    The TEI framework is the same as:

    https://oxygen-tei.googlecode.com/files/tei-2.3.0-6.27-for14.2.zip

    Can you try please with the following Oxygen 14.2 beta kit (an All Platforms version)? Just start it with oxygen.bat (Windows)/oxygenMac.sh (Mac) /oxygen.sh (Linux), create a new TEI P5 document and run the built-in TEI P5 DOCX transform. You can download it from:

    http://mirror.oxygenxml.com/userFiles/oxygen-14.2-beta-TEI-error.tar.gz

    The full output log:

    S:\>"C:\Program Files (x86)\Java\jdk1.6.0_23\jre/bin/java" -classpath "S:\projects\eXml-trunk\dist\InstData\All\oxygen/t
    ools/ant/lib/ant-launcher.jar" "-Dant.home=S:\projects\eXml-trunk\dist\InstData\All\oxygen/tools/ant" org.apache.tools.a
    nt.launch.Launcher -lib "S:\projects\eXml-trunk\dist\InstData\All\oxygen\lib\saxon9ee.jar" -f "S:/projects/eXml-trunk/di
    st/InstData/All/oxygen/frameworks/tei/xml/tei/stylesheet/docx/build-to.xml" "-DoutputFile=D:\support\TEI/out/test-DOCX.d
    ocx" "-DinputFile=D:\support\TEI\test-DOCX.xml" "-Dprofile=default"
    Buildfile: S:\projects\eXml-trunk\dist\InstData\All\oxygen\frameworks\tei\xml\tei\stylesheet\docx\build-to.xml

    setup:
    [delete] Deleting directory D:\support\TEI\out\temp-dir-for-ant
    [mkdir] Created dir: D:\support\TEI\out\temp-dir-for-ant

    odd:

    notodd:
    [copy] Copying 1 file to D:\support\TEI\out\temp-dir-for-ant

    transform:
    [echo] unzip Word template
    [unzip] Expanding: S:\projects\eXml-trunk\dist\InstData\All\oxygen\frameworks\tei\xml\tei\stylesheet\profiles\defaul
    t\docx\template.docx into D:\support\TEI\out\temp-dir-for-ant
    [echo] remove custom document properties, notes,
    [echo] footers, headers etc from Word template
    [delete] Deleting D:\support\TEI\out\temp-dir-for-ant\docProps\custom.xml
    [delete] Deleting D:\support\TEI\out\temp-dir-for-ant\word\endnotes.xml
    [delete] Deleting D:\support\TEI\out\temp-dir-for-ant\word\footnotes.xml
    [delete] Deleting D:\support\TEI\out\temp-dir-for-ant\word\webSettings.xml
    [echo] fix Word .rels file
    [xslt] Processing D:\support\TEI\out\temp-dir-for-ant\_rels\.rels to D:\support\TEI\out\temp-dir-for-ant\_rels\.rel
    s_
    [xslt] Loading stylesheet S:\projects\eXml-trunk\dist\InstData\All\oxygen\frameworks\tei\xml\tei\stylesheet\docx\to
    ols\fixdotrels.xsl
    [move] Moving 1 file to D:\support\TEI\out\temp-dir-for-ant\_rels
    [move] Attempting to rename: D:\support\TEI\out\temp-dir-for-ant\_rels\.rels_ to D:\support\TEI\out\temp-dir-for-an
    t\_rels\.rels
    [echo] Fix Word styles file
    [xslt] Processing D:\support\TEI\out\temp-dir-for-ant\word\styles.xml to D:\support\TEI\out\temp-dir-for-ant\word\_
    styles.xml
    [xslt] Loading stylesheet S:\projects\eXml-trunk\dist\InstData\All\oxygen\frameworks\tei\xml\tei\stylesheet\docx\to
    ols\fixstyle.xsl
    [move] Moving 1 file to D:\support\TEI\out\temp-dir-for-ant\word
    [move] Attempting to rename: D:\support\TEI\out\temp-dir-for-ant\word\_styles.xml to D:\support\TEI\out\temp-dir-fo
    r-ant\word\styles.xml
    [echo] Get names of graphics files and write an ant task
    [xslt] Processing D:\support\TEI\out\temp-dir-for-ant\tmp2.xml to D:\support\TEI\out\temp-dir-for-ant\copy.xml
    [xslt] Loading stylesheet S:\projects\eXml-trunk\dist\InstData\All\oxygen\frameworks\tei\xml\tei\stylesheet\tools\m
    akegraphicsanttask.xsl
    [echo] Copy image files by running ant task

    dist:
    [echo] Read dimensions of image files and write info file
    [echo] Generate new files for docx
    [xslt] Processing D:\support\TEI\out\temp-dir-for-ant\tmp2.xml to D:\support\TEI\out\temp-dir-for-ant\newdocument.x
    ml
    [xslt] Loading stylesheet S:\projects\eXml-trunk\dist\InstData\All\oxygen\frameworks\tei\xml\tei\stylesheet\profile
    s\default\docx\to.xsl
    Warning: XML resolver not found; external catalogs will be ignored
    [xslt] S:\projects\eXml-trunk\dist\InstData\All\oxygen\frameworks\tei\xml\tei\stylesheet\docx\to\docxfiles\numberin
    g-definition.xsl:83: Fatal Error! Cannot write to a URI that has already been read: file:/D:/support/TEI/out/temp-dir-fo
    r-ant/word/numbering.xml
    [xslt] Failed to process D:\support\TEI\out\temp-dir-for-ant\tmp2.xml

    BUILD FAILED
    S:\projects\eXml-trunk\dist\InstData\All\oxygen\frameworks\tei\xml\tei\stylesheet\docx\build-to.xml:144: Fatal error during transformation

    Total time: 1 second

     
  • I downloaded the beta kit, but get the same (correct) result, using the new framework. i really don't understand this..... the file numbering.xml is written out in the template <xsl:template name="write-docxfiles"> in teitodocx.xsl, which is called in match="/" before any processing starts which might read it. I cant see a flaw in the procedure.

    ....
    dist:
    [echo] Read dimensions of image files and write info file
    [echo] Generate new files for docx
    [xslt] Processing /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out/temp-dir-for-ant/tmp2.xml to /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out/temp-dir-for-ant/newdocument.xml
    [xslt] Loading stylesheet /Users/rahtz/oxygen/frameworks/tei/xml/tei/stylesheet/profiles/default/docx/to.xsl
    [move] Moving 1 file to /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out/temp-dir-for-ant/docProps
    [move] Moving 1 file to /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out/temp-dir-for-ant/docProps
    [move] Moving 1 file to /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out/temp-dir-for-ant/docProps

    nocoverpages:
    [move] Moving 1 file to /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out/temp-dir-for-ant/word

    coverpages:

    zip:
    [echo] ZIP: put files from /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out/temp-dir-for-ant together into /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out/freddy2.docx
    [zip] Building zip: /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out/temp-for-ant.zip
    [move] Moving 1 file to /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out

    cleanup:
    [delete] Deleting directory /Volumes/Repo/TEI/Sourceforge/trunk/Stylesheets/Test/out/temp-dir-for-ant

    dist:

    BUILD SUCCESSFUL
    Total time: 2 seconds

     
  • Sorin Ristache
    Sorin Ristache
    2013-01-31

    I get the error on Windows if that helps, on any TEI P5 file. I tested on the exact Oxygen 14.2 beta kit (All Platforms) which I mentioned.I don't know what difference between our environments is causing this.

     
  • the only difference can be that I am on a Mac, using java version "1.6.0_37"; we're using the same Saxon, the same Ant, the same XSL. It is irrational....

    unless the Windows file system objects because the file was written in XSL, and then read a few microseconds later. it is as if the read is happening before the write.

     
    • status: open --> closed-works-for-me
    • milestone: --> AMBER
     
  • I am closing this ticket, as I have not been able to reproduce the problem