Skip to content

Commit

Permalink
error handling for no end dates of religious communities
Browse files Browse the repository at this point in the history
  • Loading branch information
emgeier authored Nov 18, 2024
1 parent 10f3065 commit b5e0abb
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions json-stylesheet.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -942,28 +942,44 @@
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="*:fields[@function = 'religiousCommunitiesDates']">
<xsl:param name="doc"/>
<xsl:param name="id"/>
<xsl:if test="contains($id, '/place')">
<xsl:if test="$doc/descendant::tei:state[@type = 'confession'][@srophe:computed-start]">

<xsl:template match="*:fields[@function = 'religiousCommunitiesDates']">
<xsl:param name="doc"/>
<xsl:param name="id"/>
<xsl:if test="contains($id, '/place')">
<xsl:if test="$doc/descendant::tei:state[@type = 'confession'][@srophe:computed-start]">
<array key="religiousCommunitiesDatesStart" xmlns="http://www.w3.org/2005/xpath-functions">
<xsl:for-each select="$doc/descendant::tei:state[@type = 'confession']">
<xsl:variable name="startDate" select="local:format-date(@srophe:computed-start)"/>
<number xmlns="http://www.w3.org/2005/xpath-functions"><xsl:value-of select="$startDate"/></number>
<number xmlns="http://www.w3.org/2005/xpath-functions">
<xsl:value-of select="$startDate"/>
</number>
</xsl:for-each>
</array>
<xsl:if test="$doc/descendant::tei:state[@type = 'confession'][@srophe:computed-end]">
</xsl:if>

<xsl:if test="$doc/descendant::tei:state[@type = 'confession']">
<array key="religiousCommunitiesDatesEnd" xmlns="http://www.w3.org/2005/xpath-functions">
<xsl:for-each select="$doc/descendant::tei:state[@type = 'confession']">
<xsl:variable name="endDate" select="local:format-date(@srophe:computed-end)"/>
<number xmlns="http://www.w3.org/2005/xpath-functions"><xsl:value-of select="$endDate"/></number>
<xsl:variable name="endDate">
<xsl:choose>
<xsl:when test="@srophe:computed-end">
<xsl:value-of select="local:format-date(@srophe:computed-end)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local:format-date(@srophe:computed-start)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<number xmlns="http://www.w3.org/2005/xpath-functions">
<xsl:value-of select="endDate"/>
</number>
</xsl:for-each>
</array>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:if>
</xsl:template>

<xsl:template match="*:fields[@function = 'existenceDates']">
<xsl:param name="doc"/>
<xsl:param name="id"/>
Expand Down

0 comments on commit b5e0abb

Please sign in to comment.