From 500b2e8d30791a683dbd61012b0bba67f29a8008 Mon Sep 17 00:00:00 2001 From: berndmoos Date: Mon, 10 Jun 2024 12:49:00 +0200 Subject: [PATCH] Some smaller changes for https://github.com/berndmoos/zumulttgdp/issues/29 --- src/main/java/org/zumult/backend/Configuration.java | 11 +++++++++++ .../org/zumult/webservices/ZumultDataServlet.java | 7 +++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/zumult/backend/Configuration.java b/src/main/java/org/zumult/backend/Configuration.java index f24a0fd..df3b7ea 100644 --- a/src/main/java/org/zumult/backend/Configuration.java +++ b/src/main/java/org/zumult/backend/Configuration.java @@ -57,6 +57,7 @@ public class Configuration { // new for #174 private static String isoTei2HtmlStylesheet; + private static String isoTei2HtmlAnnotationsStylesheet; // new for #175 private static String event2HtmlStylesheet; private static String speechEvent2HtmlStylesheet; @@ -164,6 +165,14 @@ public static String getIsoTei2HTMLStylesheet(){ } return Constants.ISOTEI2HTML_STYLESHEET2; } + + public static String getIsoTei2HTMLAnnotationsStylesheet() { + if (isoTei2HtmlAnnotationsStylesheet!=null){ + return isoTei2HtmlAnnotationsStylesheet; + } + return Constants.ISOTEI2HTML_ANNOTATIONS_STYLESHEET; + } + // new for #175 public static String getEvent2HTMLStylesheet(){ @@ -231,6 +240,7 @@ static void read(){ // new for #174 isoTei2HtmlStylesheet = config.getString("backend.isotei2html-xsl"); + isoTei2HtmlAnnotationsStylesheet = config.getString("backend.isotei2html-annotations-xsl"); // new for #175 event2HtmlStylesheet = config.getString("backend.event2html-xsl"); speechEvent2HtmlStylesheet = config.getString("backend.speechevent2html-xsl"); @@ -275,6 +285,7 @@ static void read(){ Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); } } + } diff --git a/src/main/java/org/zumult/webservices/ZumultDataServlet.java b/src/main/java/org/zumult/webservices/ZumultDataServlet.java index 2e48619..3086259 100644 --- a/src/main/java/org/zumult/webservices/ZumultDataServlet.java +++ b/src/main/java/org/zumult/webservices/ZumultDataServlet.java @@ -949,7 +949,7 @@ private void getAnnotations(HttpServletRequest request, HttpServletResponse resp String startAnnotationBlockID = request.getParameter("startAnnotationBlockID"); String endAnnotationBlockID = request.getParameter("endAnnotationBlockID"); - System.out.println("getAnnotations called with TRANSCRIPT ID=" + transcriptID + " and START_ANNOTATION_BLOCK_ID=" + startAnnotationBlockID); + //System.out.println("getAnnotations called with TRANSCRIPT ID=" + transcriptID + " and START_ANNOTATION_BLOCK_ID=" + startAnnotationBlockID); BackendInterface backend = BackendInterfaceFactory.newBackendInterface(); Transcript transcript = backend.getTranscript(transcriptID); @@ -959,7 +959,10 @@ private void getAnnotations(HttpServletRequest request, HttpServletResponse resp {"END_ANNOTATION_BLOCK_ID", endAnnotationBlockID}, }; - String annotationHTML = new IOHelper().applyInternalStylesheetToString(Constants.ISOTEI2HTML_ANNOTATIONS_STYLESHEET, transcript.toXML(), parameters); + String xsl = Configuration.getIsoTei2HTMLAnnotationsStylesheet(); + + //String annotationHTML = new IOHelper().applyInternalStylesheetToString(Constants.ISOTEI2HTML_ANNOTATIONS_STYLESHEET, transcript.toXML(), parameters); + String annotationHTML = new IOHelper().applyInternalStylesheetToString(xsl, transcript.toXML(), parameters); //System.out.println("********* ANNOTATION HTML ************\n" + annotationHTML); response.setContentType("text/html");