<xsl:template match="tei:analytic" mode="mla">
<xsl:variable name="refIdwHash">
<xsl:value-of select="following-sibling::tei:monogr/tei:ref/@target"/>
</xsl:variable>
<xsl:variable name="refId">
<xsl:value-of select="substring-after($refIdwHash, '#')"/>
</xsl:variable>
<xsl:apply-templates/>
<xsl:if test="not(following-sibling::tei:monogr/tei:title[@level='m']) and $refId!=''">
<xsl:text> </xsl:text>
<xsl:if test="following-sibling::tei:monogr/tei:imprint/tei:date">
<xsl:value-of select="following-sibling::tei:monogr/tei:imprint/tei:date"/>
<xsl:text>. </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[1]">
<xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[1], ',')"/>
</xsl:when>
<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][1]">
<xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][1], ',')"/>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[3]">
<xsl:text>, </xsl:text>
<xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[2], ',')"/>
<xsl:text>, and </xsl:text>
</xsl:when>
<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][3]">
<xsl:text>, </xsl:text>
<xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][2], ',')"/>
<xsl:text>, and </xsl:text>
</xsl:when>
<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[2]">
<xsl:text> and </xsl:text>
<xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[2], ',')"/>
</xsl:when>
<xsl:when test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][2]">
<xsl:text> and </xsl:text>
<xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][2], ',')"/>
</xsl:when>
</xsl:choose>
<xsl:if test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[3]">
<xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:author[3], ',')"/>
</xsl:if>
<xsl:if test="ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][3]">
<xsl:value-of select="substring-before(ancestor::tei:listBibl/tei:biblStruct[@xml:id=$refId]/tei:monogr/tei:editor[@role='editor'][3], ',')"/>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:value-of select="following-sibling::tei:monogr/tei:imprint/tei:biblScope[@type='pp']"/>
<xsl:text>. </xsl:text>
</xsl:if>
</xsl:template> |