Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
implemented verse, list, table, adjusted mode for block formulas
  • Loading branch information
EsGeh authored and EsGeh committed Mar 20, 2019
1 parent bc2bdc5 commit ac4538d
Showing 1 changed file with 61 additions and 1 deletion.
62 changes: 61 additions & 1 deletion tei2html.xsl
Expand Up @@ -955,11 +955,71 @@
</p>
</xsl:template>

<xsl:template match="tei:ab[@type='equation']">
<xsl:template match="tei:ab[@type='equation']" mode="body">
<xsl:message>block formula</xsl:message>
<xsl:value-of select="concat('$', ., '$')"/>
</xsl:template>

<xsl:template match="tei:lg[@type='verse']" mode="body">
<!-- TODO: find a way to indent the poem -->
<xsl:message>verse</xsl:message>
<p>
<xsl:for-each select="tei:l">
<xsl:apply-templates mode="html"/>
<xsl:if test="position() != last()">
<br/>
</xsl:if>
</xsl:for-each>
</p>
</xsl:template>

<xsl:template match="tei:list[@type='ordered' or @type='unordered' or @type='gloss']" mode="body">
<xsl:message>list</xsl:message>
<xsl:variable name="element_name">
<xsl:choose>
<xsl:when test="@type = 'ordered'">ol</xsl:when>
<xsl:when test="@type = 'unordered'">ul</xsl:when>
<xsl:when test="@type = 'gloss'">ul</xsl:when>
<xsl:otherwise>
<xsl:message>ERROR: unknown list type!!</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$element_name}">
<xsl:for-each select="tei:item">
<li>
<xsl:if test="preceding-sibling::tei:label[1]">
<xsl:apply-templates select="preceding-sibling::tei:label[1]"/>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:apply-templates mode="html"/>
</li>
</xsl:for-each>
</xsl:element>
</xsl:template>

<xsl:template match="tei:table" mode="body">
<xsl:message>table</xsl:message>
<figure>
<xsl:element name="table">
<xsl:for-each select="tei:row">
<tr>
<xsl:for-each select="tei:cell">
<xsl:element name="{if( @role = 'label') then 'th' else 'td'}">
<xsl:apply-templates mode="html"/>
</xsl:element>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:element>
<xsl:if test="tei:head">
<figcaption>
<xsl:apply-templates select="tei:head/node() | text()" mode="html"/>
</figcaption>
</xsl:if>
</figure>
</xsl:template>

<!--
<xsl:template match="tei:formula">
<xsl:message>formula</xsl:message>
Expand Down

0 comments on commit ac4538d

Please sign in to comment.