Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: adjusting display of relatedItems #16

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions scripts/overrides/tei_to_html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,40 @@
</xsl:choose>
</li>
</xsl:if>

<!-- pulled from notebooks P5 tylesheet and refactored original comment: relatedItem section (updated 4/28/17)-->
<xsl:if test="//sourceDesc//relatedItem">
<li><strong>Related Item(s): </strong>
<ul>
<xsl:for-each select="//relatedItem[@type = 'text']">
<xsl:variable name="note_id"><xsl:text>#</xsl:text><xsl:value-of select="@xml:id"/></xsl:variable>
<xsl:variable name="note_target"><xsl:value-of select="//note[contains(@target,$note_id)]/@target"/></xsl:variable>
<xsl:variable name="preceding_note_id">
<xsl:choose>
<xsl:when test="preceding-sibling::relatedItem">
<xsl:value-of select="preceding-sibling::relatedItem/@xml:id"/>
</xsl:when>
<!--this is a sort of hacky workaround so the id can be checked below, sorry-->
<xsl:otherwise>zzz</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- if there is a note with a matching target and it does not match any previous targets, display -->
<xsl:if test="not(contains($note_target,$preceding_note_id))">
<li><xsl:apply-templates select="//note[contains(@target,$note_id)]"/></li>
</xsl:if>
<!-- this part could probably be improved to create better handling for multiple relatedItems -->
<li>
<xsl:text> See </xsl:text>
<a>
<xsl:attribute name="href" select="@target"/>
<xsl:value-of select="@target"/>
</a>
<xsl:text>.</xsl:text></li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
<!--end relatedItem section-->
</ul>
</xsl:variable>

Expand Down