Skip to content

Commit

Permalink
add function wega:get-doc-languages
Browse files Browse the repository at this point in the history
and employ for localized quotes
  • Loading branch information
peterstadler committed Sep 23, 2020
1 parent 139ec32 commit 0275f55
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xsl/common_funcs.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,14 @@
</xsl:variable>
<xsl:sequence select="substring-before($enquoted, 'dummy'), $input, substring-after($enquoted, 'dummy')"/>
</xsl:function>

<xsl:function name="wega:get-doc-languages" as="xs:string*">
<xsl:param name="docID" as="xs:string"/>
<xsl:variable name="doc" select="wega:doc($docID)"/>
<xsl:for-each select="$doc//tei:language">
<xsl:value-of select="substring-before(@ident, '-')"/>
</xsl:for-each>
</xsl:function>

<!-- ********************************************* -->
<!-- * Functx - Funktionen http://www.functx.com * -->
Expand Down
26 changes: 26 additions & 0 deletions xsl/common_main.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<xsl:template name="enquote">
<xsl:param name="double" select="true()"/>
<xsl:param name="ellipsis" select="false()"/>
<xsl:param name="lang" select="$lang"/>
<xsl:choose>
<!-- German double quotation marks -->
<xsl:when test="$lang eq 'de' and $double">
Expand Down Expand Up @@ -172,6 +173,11 @@
<xsl:apply-templates mode="#current"/>
<xsl:text>’</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>"</xsl:text>
<xsl:apply-templates mode="#current"/>
<xsl:text>"</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

Expand Down Expand Up @@ -739,6 +745,16 @@
<xsl:variable name="doubleQuotes" select="(count(ancestor::tei:q | ancestor::tei:quote) mod 2) = 0"/>
<xsl:call-template name="enquote">
<xsl:with-param name="double" select="$doubleQuotes"/>
<xsl:with-param name="lang">
<xsl:choose>
<xsl:when test="ancestor::tei:body">
<xsl:value-of select="wega:get-doc-languages($docID)[1]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:template>

Expand All @@ -748,6 +764,16 @@
<xsl:when test="@rend">
<xsl:call-template name="enquote">
<xsl:with-param name="double" select="@rend='double-quotes'"/>
<xsl:with-param name="lang">
<xsl:choose>
<xsl:when test="ancestor::tei:body">
<xsl:value-of select="wega:get-doc-languages($docID)[1]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<!-- no quotation marks as default -->
Expand Down

0 comments on commit 0275f55

Please sign in to comment.