-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
425 additions
and
0 deletions.
There are no files selected for viewing
157 changes: 157 additions & 0 deletions
157
src/main/java/org/zumult/io/Transcript2AnnotationHTML.xsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
xmlns:tei="http://www.tei-c.org/ns/1.0" | ||
exclude-result-prefixes="xs" | ||
version="2.0"> | ||
|
||
<!-- start and end of the transcript ; empty for whole transcript --> | ||
<xsl:param name="START_ANNOTATION_BLOCK_ID"/> | ||
<xsl:param name="END_ANNOTATION_BLOCK_ID"/> | ||
|
||
|
||
<!-- <xsl:template match="/"> | ||
<div> | ||
<xsl:apply-templates select="//tei:annotationBlock"/> | ||
</div> | ||
</xsl:template> --> | ||
|
||
<xsl:template match="/"> | ||
<div class="annotations-div" style="overflow:auto;"> | ||
<xsl:choose> | ||
<xsl:when test="$START_ANNOTATION_BLOCK_ID and $END_ANNOTATION_BLOCK_ID"> | ||
<xsl:apply-templates select="//tei:annotationBlock[not(following-sibling::tei:*[@xml:id=$START_ANNOTATION_BLOCK_ID]) and not(preceding-sibling::tei:*[@xml:id=$END_ANNOTATION_BLOCK_ID])]"/> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:apply-templates select="//tei:annotationBlock"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</div> | ||
</xsl:template> | ||
|
||
|
||
<xsl:template match="tei:annotationBlock"> | ||
<xsl:variable name="WHO" select="@who"/> | ||
<table> | ||
<tr> | ||
<td class="numbering"><xsl:value-of select="count(preceding-sibling::tei:annotationBlock) + 1"/></td> | ||
<td class="audioplay"> | ||
<xsl:variable name="START_ID" select="@start"/> | ||
<xsl:variable name="START_TIME" select="//tei:when[@xml:id=$START_ID]/@interval"/> | ||
<span> | ||
<xsl:attribute name="onclick">playAudioFromAnnotation(<xsl:value-of select="$START_TIME"/>)</xsl:attribute> | ||
<i class="fa-duotone fa-circle-play"></i> | ||
</span> | ||
</td> | ||
<td class="speaker"><xsl:value-of select="//tei:person[@xml:id=$WHO]/@n"/></td> | ||
<td> | ||
<xsl:apply-templates select="descendant::tei:u"/> | ||
</td> | ||
</tr> | ||
</table> | ||
</xsl:template> | ||
|
||
<xsl:template match="tei:u"> | ||
<table class="annotations"> | ||
<xsl:if test="descendant::tei:spanGrp[@type='original']"> | ||
<tr> | ||
<th>Original</th> | ||
<td class="original"> | ||
<xsl:attribute name="colspan" select="count(descendant::tei:w)"/> | ||
<xsl:value-of select="ancestor::tei:annotationBlock/descendant::tei:spanGrp[@type='original']/tei:span/text()"/> | ||
</td> | ||
</tr> | ||
</xsl:if> | ||
<xsl:if test="descendant::tei:spanGrp[@type='translation' or @type='en']"> | ||
<tr> | ||
<th>Translation</th> | ||
<td class="translation"> | ||
<xsl:attribute name="colspan" select="count(descendant::tei:w)"/> | ||
<xsl:value-of select="ancestor::tei:annotationBlock/descendant::tei:spanGrp[@type='translation' or @type='en']/tei:span/text()"/> | ||
</td> | ||
</tr> | ||
</xsl:if> | ||
<tr> | ||
<th>ID</th> | ||
<xsl:apply-templates select="descendant::tei:w" mode="ID"/> | ||
</tr> | ||
<tr> | ||
<th>Token</th> | ||
<xsl:apply-templates select="descendant::tei:w" mode="TRANS"/> | ||
</tr> | ||
<xsl:if test="descendant::tei:w[@xml_lang]"> | ||
<tr> | ||
<th>Language</th> | ||
<xsl:apply-templates select="descendant::tei:w" mode="LANG"/> | ||
</tr> | ||
</xsl:if> | ||
<xsl:if test="descendant::tei:w[@norm]"> | ||
<tr> | ||
<th>Normalisation</th> | ||
<xsl:apply-templates select="descendant::tei:w" mode="NORM"/> | ||
</tr> | ||
</xsl:if> | ||
<xsl:if test="descendant::tei:w[@lemma]"> | ||
<tr> | ||
<th>Lemma</th> | ||
<xsl:apply-templates select="descendant::tei:w" mode="LEMMA"/> | ||
</tr> | ||
<tr> | ||
<th>POS</th> | ||
<xsl:apply-templates select="descendant::tei:w" mode="POS"/> | ||
</tr> | ||
</xsl:if> | ||
<xsl:if test="descendant::tei:w[@phon]"> | ||
<tr> | ||
<th>Phon</th> | ||
<xsl:apply-templates select="descendant::tei:w" mode="PHON"/> | ||
</tr> | ||
</xsl:if> | ||
</table> | ||
</xsl:template> | ||
|
||
<!-- <tei:w norm="okay" xml:id="a19_w1" xml:lang="eng" pos="FM" lemma="okay" phon="@U . k ' eI">OKAY</tei:w> --> | ||
|
||
<xsl:template match="tei:w" mode="ID"> | ||
<td class="id"> | ||
<xsl:attribute name="class">id <xsl:value-of select="@xml:lang"/></xsl:attribute> | ||
<xsl:value-of select="@xml:id"/> | ||
</td> | ||
</xsl:template> | ||
|
||
<xsl:template match="tei:w" mode="TRANS"> | ||
<td class="trans"> | ||
<xsl:attribute name="class">trans <xsl:value-of select="@xml:lang"/></xsl:attribute> | ||
<xsl:value-of select="text()"/> | ||
</td> | ||
</xsl:template> | ||
|
||
<xsl:template match="tei:w" mode="LANG"> | ||
<td class="lang"> | ||
<xsl:attribute name="class">lang <xsl:value-of select="@xml:lang"/></xsl:attribute> | ||
<xsl:value-of select="@xml:lang"/> | ||
</td> | ||
</xsl:template> | ||
|
||
<xsl:template match="tei:w" mode="NORM"> | ||
<td class="norm"><xsl:value-of select="@norm"/></td> | ||
</xsl:template> | ||
|
||
<xsl:template match="tei:w" mode="LEMMA"> | ||
<td class="lemma"><xsl:value-of select="@lemma"/></td> | ||
</xsl:template> | ||
|
||
<xsl:template match="tei:w" mode="POS"> | ||
<td class="pos"><xsl:value-of select="@pos"/></td> | ||
</xsl:template> | ||
|
||
<xsl:template match="tei:w" mode="PHON"> | ||
<td class="phon"> | ||
<xsl:text>[</xsl:text> | ||
<xsl:value-of select="translate(@phon, ' ', '')"/> | ||
<xsl:text>]</xsl:text> | ||
</td> | ||
</xsl:template> | ||
|
||
|
||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/CascadeStyleSheet.css to edit this template | ||
*/ | ||
/* | ||
Created on : 23.01.2024, 12:37:21 | ||
Author : bernd | ||
*/ | ||
|
||
table.annotations { | ||
margin-top : 15px; | ||
border : 3px solid gray; | ||
} | ||
|
||
|
||
table.annotations td { | ||
white-space: nowrap; | ||
border: 1px solid rgb(245,245,245); | ||
} | ||
|
||
div.annotations-div td.numbering { | ||
font-weight: bold; | ||
min-width: 50px; | ||
background: gray; | ||
color: white; | ||
text-align:center; | ||
} | ||
|
||
div.annotations-div td.speaker { | ||
min-width:160px; | ||
font-weight: bold; | ||
text-align: right; | ||
padding-right: 10px; | ||
} | ||
|
||
table.annotations td.id { | ||
color : gray; | ||
font-size : 8pt; | ||
} | ||
|
||
table.annotations th { | ||
text-align: right; | ||
padding-right: 10px; | ||
} | ||
|
||
table.annotations td.trans { | ||
font-size : 15pt; | ||
padding-right: 5px; | ||
} | ||
|
||
table.annotations td.original { | ||
background : rgb(252, 239, 169); | ||
} | ||
|
||
table.annotations td.translation { | ||
font-style : italic; | ||
} | ||
|
||
table.annotations td.lang { | ||
font-size : 8pt; | ||
} | ||
|
||
table.annotations td.eng { | ||
color: blue; | ||
} | ||
|
||
table.annotations td.amb { | ||
color: red; | ||
} | ||
|
||
table.annotations td.xxx { | ||
color: green; | ||
} | ||
|
||
table.annotations td.norm { | ||
font-size : 11pt; | ||
padding-right: 5px; | ||
} | ||
|
||
table.annotations td.lemma { | ||
font-style : italic; | ||
padding-right: 5px; | ||
} | ||
|
||
table.annotations td.pos { | ||
font-weight: bold; | ||
font-size: 10pt; | ||
} | ||
|
||
table.annotations td.phon { | ||
font-size : 9pt; | ||
font-family: monospace; | ||
} | ||
|
Oops, something went wrong.