|
1 | 1 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
| 2 | + xmlns:xs="http://www.w3.org/2001/XMLSchema" |
| 3 | + xmlns:map="http://www.w3.org/2005/xpath-functions/map" |
2 | 4 | xmlns:t="http://www.tei-c.org/ns/1.0"
|
3 | 5 | version="3.0">
|
4 | 6 |
|
5 | 7 | <xsl:output encoding="UTF-8" method="text" indent="no"/>
|
6 | 8 | <xsl:strip-space elements="*"/>
|
7 | 9 |
|
| 10 | + <xsl:variable name="dict" select="doc('../vicav_dicts/dc_shawi_eng.xml')"/> |
| 11 | + <xsl:variable name="dictById" select="map:merge($dict//t:entry!map {data(./@xml:id): .})"/> |
| 12 | + |
8 | 13 | <xsl:template match="t:TEI">
|
9 | 14 | <xsl:text><doc id="</xsl:text>
|
10 | 15 | <xsl:value-of select="t:teiHeader//t:idno[ends-with(@type, 'CorpusID')]"/>
|
|
18 | 23 | <xsl:value-of select="string-join(t:teiHeader//t:textClass//t:catRef/@target, ' ')"/>
|
19 | 24 | <xsl:text>" status="</xsl:text>
|
20 | 25 | <xsl:value-of select="t:teiHeader//t:revisionDesc/@status"/>
|
21 |
| - <xsl:text xml:space="preserve">" attrs="word wid decomp dict=lemmaRef pos=msd trans=n"> |
| 26 | + <xsl:text xml:space="preserve">" attrs="word wid decomp dict=lemmaRef msd trans=n pos root subc diaroot"> |
22 | 27 | </xsl:text>
|
23 | 28 | <xsl:apply-templates select="t:text/t:body"/>
|
24 | 29 | <xsl:text xml:space="preserve">
|
25 | 30 | </doc>
|
26 | 31 | </xsl:text>
|
27 | 32 | </xsl:template>
|
28 | 33 |
|
29 |
| - <xsl:template match="t:w|t:pc" xml:space="preserve"><xsl:if test=". = (',', '.', '!', '?', '[', '(')"><g/>
</xsl:if><xsl:value-of select="normalize-unicode(text(), 'NFKC')"/>	<xsl:value-of select="@xml:id"/>	<xsl:value-of select="normalize-unicode(text(), 'NFKD')"/>	<xsl:value-of select="@lemmaRef"/>	<xsl:value-of select="@msd"/>	<xsl:value-of select="@n"/><xsl:apply-templates select="@* except (@xml:id,@n,@lemmaRef,@msd,@join,@rend,@xml:lang)" mode="tsv"/><xsl:if test="@rend='withDash'">
<g/>
-
<g/></xsl:if>
</xsl:template> |
| 34 | + <xsl:template match="t:w|t:pc"> |
| 35 | + <xsl:variable name="dictId" select="replace(@lemmaRef, 'dict:', '')" as="xs:string"/> |
| 36 | + <xsl:variable name="dictEntry" select="$dictById($dictId)" as="element(t:entry)?"/> |
| 37 | + <xsl:if test=". = (',', '.', '!', '?', '[', '(')" xml:space="preserve"><g/>
</xsl:if> |
| 38 | + <xsl:if test="true()" xml:space="preserve"><xsl:value-of select="normalize-unicode(text(), 'NFKC')"/>	<xsl:value-of select="@xml:id"/>	<xsl:value-of select="normalize-unicode(text(), 'NFKD')"/>	<xsl:value-of select="@lemmaRef"/>	<xsl:value-of select="@msd"/>	<xsl:value-of select="@n"/>	<xsl:value-of select="$dictEntry//t:gram[@type='pos']"/>	<xsl:value-of select="$dictEntry//t:gram[@type='synRoot']"/>	<xsl:value-of select="$dictEntry//t:gram[@type='subc']"/>	<xsl:value-of select="$dictEntry//t:gram[@type='diaRoot']"/><xsl:apply-templates select="@* except (@xml:id,@n,@lemmaRef,@msd,@join,@rend,@xml:lang)" mode="tsv"/></xsl:if> |
| 39 | + <xsl:if test="@rend='withDash'" xml:space="preserve">
<g/>
-
<g/></xsl:if> |
| 40 | + <xsl:if test="true()" xml:space="preserve">
</xsl:if> |
| 41 | + </xsl:template> |
30 | 42 |
|
31 | 43 | <xsl:template match="@*" mode="tsv">
|
32 | 44 | <xsl:text>	</xsl:text><xsl:value-of select="local-name()"/>=<xsl:value-of select="."/>
|
|
0 commit comments