Skip to content

Commit

Permalink
ad cnec info directly into tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
matyaskopp committed May 13, 2024
1 parent e4f0dee commit ffd1ab7
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions src/tools/ParCzech2teitok.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,15 @@
<xsl:variable name="this" select="xi-orig"/>
<xsl:message select="concat('INFO [',$jobN,'/',$jobsCnt,']: Processing ', $this)"/>
<xsl:result-document href="{url-new}">
<xsl:apply-templates mode="comp" select="document(url-orig)/tei:TEI">
<xsl:with-param name="next" select="next"/>
<xsl:with-param name="prev" select="prev"/>
</xsl:apply-templates>
<!-- preprocess -->
<xsl:variable name="preprocess">
<xsl:apply-templates mode="comp" select="document(url-orig)/tei:TEI">
<xsl:with-param name="next" select="next"/>
<xsl:with-param name="prev" select="prev"/>
</xsl:apply-templates>
</xsl:variable>
<!-- copy cnec value to tokens -->
<xsl:apply-templates mode="cnec" select="$preprocess"/>
</xsl:result-document>
<xsl:message select="concat('INFO [',$jobN,'/',$jobsCnt,']: Saving to ', xi-new)"/>
</xsl:template>
Expand Down Expand Up @@ -323,6 +328,28 @@ ParCzech(3.0 like): <pb source="https://www.psp.cz/eknih/2021ps/stenprot/071schu
<xsl:copy/>
</xsl:template>

<!-- cnec -->

<xsl:template mode="cnec" match="tok[ancestor::*/@cnec]">
<xsl:copy>
<xsl:apply-templates mode="cnec" select="@*"/>
<xsl:attribute name="cnec" select="string-join(ancestor::*/@cnec,',')"/> <!-- comma due to a TEITOK query builder -->
<xsl:apply-templates mode="cnec"/>
</xsl:copy>
</xsl:template>

<xsl:template mode="cnec" match="*">
<xsl:copy>
<xsl:apply-templates mode="cnec" select="@*"/>
<xsl:apply-templates mode="cnec"/>
</xsl:copy>
</xsl:template>
<xsl:template mode="cnec" match="@*">
<xsl:copy/>
</xsl:template>
<xsl:template mode="cnec" match="text()">
<xsl:value-of select="."/>
</xsl:template>

<!-- Finalizing ROOT -->
<xsl:template match="*">
Expand Down

0 comments on commit ffd1ab7

Please sign in to comment.