Skip to content

Commit c732c4a

Browse files
committed
ExPath modules not available in Saxon HE
Cf. #43
1 parent c0feefc commit c732c4a

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ Paragraphs not having a defined outline level are not recognized as headings.**
1919
Build the package using `ant` on `build.xml`. You can upload docx files via a web form or by POSTing them to cnvert2.xql
2020

2121
### CLI
22-
To convert a docx, apply `docx.xsl` to `word-empty.xml` (or any XML file) and pass the parameter `filename` with a full
23-
URL to the docx to be converted.
22+
! The older `zip:xml-entry` function is available in Saxon ⩽ 9.5.1.1 while `file:read-binary` and `archive:extract-text`
23+
require Saxon *PE or EE* ⩾ 9.6. If you do not have Saxon PE or EE, you currently have to use a different XSLT processor,
24+
use oXygen (as it includes a recent version ofSaxon PE and EE), or use the web service implementation from within
25+
eXist-DB or baseX as these implement the ExPath modules independently.
26+
27+
To convert a docx, apply `docx.xsl` to `word-empty.xml` (or any XML file) and pass the parameter `filename` with a path
28+
to the docx to be converted.
2429

2530
## How to use (XML to TEI)
2631
apply basic transformation scenario to docx or apply wt0.xsl and wt1.xsl to any flat Word XML

docx.xsl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111
<xsl:param name="filename" />
1212

1313
<xsl:variable name="zip">
14-
<xsl:choose>
15-
<xsl:when test="function-available('archive:extract-text')">
16-
<xsl:sequence select="file:read-binary($filename)" />
17-
</xsl:when>
18-
<xsl:when test="function-available('zip:xml-entry')">
19-
<xsl:value-of select="xs:anyURI($filename)"/>
20-
</xsl:when>
21-
</xsl:choose>
22-
</xsl:variable>
14+
<xsl:sequence select="file:read-binary($filename)" use-when="function-available('archive:extract-text')" />
15+
<xsl:value-of select="xs:anyURI($filename)" use-when="function-available('zip:xml-entry')" />
16+
</xsl:variable>
2317

2418
<xsl:template match="/">
19+
<xsl:if test="not(function-available('file:read-binary')) and not(function-available('zip:xml-entry'))">
20+
<xsl:message terminate="yes">!!
21+
Neither file:read-binary nor zip:xml-entry functions are available. Word document
22+
cannot be extracted with this XSLT processor. zip:xml-entry is available in Saxon
23+
⩽ 9.5.1.1, file:read-binary requires Saxon PE or EE ⩾ 9.6.
24+
</xsl:message>
25+
</xsl:if>
2526
<pkg:package
2627
xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
2728
<xsl:variable name="parts" select="('word/document.xml', 'word/comments.xml', 'word/endnotes.xml',

0 commit comments

Comments
 (0)