Skip to content

Commit

Permalink
Generate spans with annotation and dictionary links from standOff ann…
Browse files Browse the repository at this point in the history
…otations
  • Loading branch information
simar0at committed Oct 23, 2024
1 parent f7a425c commit b867bcc
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions xslt/corpus_utterances_json.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
</div>
<div class="content">
<xsl:for-each select="$u/*">
<xsl:variable name="ana-id" select="substring(@ana, 2)"/>
<span>
<xsl:attribute name="class">
<xsl:value-of select="./name()"/>
Expand All @@ -35,19 +36,32 @@
</xsl:attribute>
<xsl:attribute name="id" select="@xml:id"/>
<xsl:value-of select="."/>
<span class="ana">
<xsl:apply-templates select="//*[@xml:id=$ana-id]/tei:f"/>
&#xA0;
</span>
</span>
<xsl:if test="not(./@join = 'right' or following-sibling::*[1]/name() = 'pc')">
<span xml:space="preserve"> </span>
<span class="c" xml:space="preserve"> <span class="ana">&#xA0;</span></span>
</xsl:if>
<xsl:if test="./@join = 'right' and ./@rend='withDash'">
<span>-</span>
<span class="c">-<span class="ana">&#xA0;</span></span>
</xsl:if>
</xsl:for-each>
</div>
</div>
</xsl:variable>
<xsl:value-of select='serialize($html, map{"method":"html"})'/>
</xsl:function>

<xsl:template match="tei:f">
<span class="sep">/</span><span class="{@name}"><xsl:value-of select="(tei:string|@fVal)"/></span>
</xsl:template>

<xsl:template match="tei:f[@name='dict']">
<xsl:variable name="dict" select="replace(//tei:prefixDef[@ident='dict']/@replacementPattern, '.+/(.+)\.xml#\$1$', '$1')"/>
<span class="sep">/</span><a class="{@name}" data-target-type="DictQuery" data-text-id="{$dict}" data-query-params="{{&quot;id&quot;: &quot;{replace((tei:string|@fVal), '^dict:', '')}&quot;}}" href="#"><i class="fa-solid fa-book"></i></a>
</xsl:template>

<xsl:template match="/doc">
<id><xsl:value-of select="@id"/></id>
Expand Down

0 comments on commit b867bcc

Please sign in to comment.