Skip to content
This repository has been archived by the owner on Sep 30, 2022. It is now read-only.

Commit

Permalink
Making OxGarage work with XSLT 3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
hcayless committed Jan 18, 2018
1 parent 4c84c6b commit 7587d44
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ege-xsl-converter/pom.xml
Expand Up @@ -160,7 +160,7 @@
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.4</version>
<version>9.8.0-7</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Expand Up @@ -27,6 +27,7 @@
import net.sf.saxon.s9api.XsltCompiler;
import net.sf.saxon.s9api.XsltExecutable;
import net.sf.saxon.s9api.XsltTransformer;
import net.sf.saxon.s9api.Xslt30Transformer;
import net.sf.saxon.s9api.XdmAtomicValue;
import net.sf.saxon.s9api.QName;

Expand Down Expand Up @@ -193,18 +194,15 @@ private File performEADTransformation(InputStream inputStream)
proc.getUnderlyingConfiguration().setOutputURIResolver(
new MultiXslOutputResolver(uid));
XsltExecutable exec = comp.compile(new StreamSource(is));
XsltTransformer transformer = exec.load();
transformer.setInitialContextNode(proc.newDocumentBuilder().build(
new StreamSource(inputStream)));
Serializer result = new Serializer();
Xslt30Transformer transformer = exec.load30();
Serializer result = proc.newSerializer();

// create dummy result file - result file is empty
File dummyResult = new File(tempDir.getPath() + ".xml");
FileOutputStream dummyOs = new FileOutputStream(dummyResult);

result.setOutputStream(dummyOs);
transformer.setDestination(result);
transformer.transform();
transformer.applyTemplates(new StreamSource(inputStream), result);
dummyOs.close();
dummyResult.delete();

Expand Down Expand Up @@ -309,7 +307,7 @@ private File performStandardTransformation(InputStream inputStream)
transformer.setParameter(new QName("input-uri"), new XdmAtomicValue(inputFile.toString()));
}
transformer.setParameter(new QName("configDirectory"), new XdmAtomicValue(EGEConstants.TEIROOT));
Serializer result = new Serializer();
Serializer result = proc.newSerializer();
result.setOutputStream(fos);
transformer.setDestination(result);
transformer.transform();
Expand Down
2 changes: 1 addition & 1 deletion tei-converter/pom.xml
Expand Up @@ -156,7 +156,7 @@
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.8</version>
<version>9.8.0-7</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
Expand Down
2 changes: 1 addition & 1 deletion tei-javalib/pom.xml
Expand Up @@ -103,7 +103,7 @@
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.4</version>
<version>9.8.0-7</version>
</dependency>
<dependency>
<groupId>com.thaiopensource</groupId>
Expand Down
4 changes: 2 additions & 2 deletions tei-javalib/src/main/java/org/tei/docx/DocX.java
Expand Up @@ -292,7 +292,7 @@ public void mergeTEI(XdmNode teiDoc) {

// transform and write back to newdocument.xml
File wordDotXMLFile = new File(directoryName + File.separator + "word" + File.separator + "document.xml");
Serializer result = new Serializer();
Serializer result = proc.newSerializer();
result.setOutputFile(wordDotXMLFile);
toDocX.setInitialContextNode(teiDoc);
toDocX.setDestination(result);
Expand Down Expand Up @@ -353,7 +353,7 @@ public void checkDocX() {
XdmNode wordDotXML = XMLUtils.readFileIntoSaxonDoc( oldDocumentFile );


Serializer result = new Serializer();
Serializer result = proc.newSerializer();
result.setOutputFile(newDocumentFile);
toDocX.setInitialContextNode(wordDotXML);
toDocX.setDestination(result);
Expand Down
4 changes: 2 additions & 2 deletions tei-javalib/src/main/java/org/tei/tei/TEI.java
Expand Up @@ -215,7 +215,7 @@ public void generateDTD(DTDGenerationProperties properties) throws SaxonApiExcep
if(null != properties.getMessageListener())
odd2dtdTransformer.setMessageListener(properties.getMessageListener());
odd2dtdTransformer.setInitialContextNode(tei);
Serializer result = new Serializer();
Serializer result = proc.newSerializer();
result.setOutputFile(properties.getOutputFile());
odd2dtdTransformer.setDestination(result);
odd2dtdTransformer.transform();
Expand Down Expand Up @@ -282,7 +282,7 @@ public void transformTo(TransformationProperties properties) throws SaxonApiExce
if(null != properties.getMessageListener())
transformer.setMessageListener(properties.getMessageListener());
transformer.setInitialContextNode(tei);
Serializer result = new Serializer();
Serializer result = proc.newSerializer();
result.setOutputFile( properties.getOutputFile() );
transformer.setDestination(result);
transformer.transform();
Expand Down

0 comments on commit 7587d44

Please sign in to comment.