Skip to content

Commit

Permalink
Merge pull request #31 from DCLP/issue31
Browse files Browse the repository at this point in the history
handle principal edition in header and metadata with more nuance
fixes DCLP/dclpxsltbox#316
fixes DCLP/dclpxsltbox#31
  • Loading branch information
paregorios authored Aug 24, 2017
2 parents b5930a0 + d023ce7 commit 7d600dd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 26 deletions.
44 changes: 23 additions & 21 deletions pn-xslt/MakeHTML.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -702,27 +702,29 @@
<xsl:template name="get-references">
<xsl:choose>
<xsl:when test="$collection = 'dclp'">
<xsl:if test="/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='dclp-hybrid' and not(starts-with(., 'na'))]">
<xsl:for-each select="//t:div[@type='bibliography' and @subtype='principalEdition'][1]/t:listBibl/t:bibl[@type='publication' and @subtype='principal'][1]">
<xsl:variable name="passThrough">
<xsl:call-template name="dclp-get-biblio-passthrough">
<xsl:with-param name="references" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="dclp-biblio-principal-dereference">
<xsl:with-param name="passThrough" select="$passThrough"/>
<xsl:with-param name="type">principalEdition</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
<xsl:text> = </xsl:text>
</xsl:if>
<xsl:if test="/t:TEI/t:teiHeader/t:fileDesc/t:titleStmt/t:title[matches(., '^P\.\s*Herc\.')]">
<xsl:value-of select="/t:TEI/t:teiHeader/t:fileDesc/t:titleStmt/t:title[matches(., '^P\.\s*Herc\.')]"/>
<xsl:text> = </xsl:text>
</xsl:if>
<xsl:text>Trismegistos </xsl:text>
<a href="http://www.trismegistos.org/text/{/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='filename']}"><xsl:value-of select="/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='filename']"></xsl:value-of></a>
<xsl:text> = </xsl:text><a href="http://www.trismegistos.org/ldab/text.php?quick={/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='LDAB']}">LDAB <xsl:value-of select="/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='LDAB']"></xsl:value-of></a>
<xsl:choose>
<xsl:when test="/t:TEI/t:teiHeader/t:fileDesc/t:titleStmt/t:title[matches(., '^P\.\s*Herc\.')]">
<xsl:value-of select="/t:TEI/t:teiHeader/t:fileDesc/t:titleStmt/t:title[matches(., '^P\.\s*Herc\.')]"/>
<xsl:text> = </xsl:text>
</xsl:when>
<xsl:when test="/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='dclp-hybrid' and not(starts-with(., 'na'))]">
<xsl:for-each select="//t:div[@type='bibliography' and @subtype='principalEdition'][1]/t:listBibl/t:bibl[@type='publication' and @subtype='principal'][1]">
<xsl:variable name="passThrough">
<xsl:call-template name="dclp-get-biblio-passthrough">
<xsl:with-param name="references" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="dclp-biblio-principal-dereference">
<xsl:with-param name="passThrough" select="$passThrough"/>
<xsl:with-param name="type">title</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
<xsl:text> = </xsl:text>
</xsl:when>
</xsl:choose>
<xsl:text>Trismegistos </xsl:text>
<a href="http://www.trismegistos.org/text/{/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='filename']}"><xsl:value-of select="/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='filename']"></xsl:value-of></a>
<xsl:text> = </xsl:text><a href="http://www.trismegistos.org/ldab/text.php?quick={/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='LDAB']}">LDAB <xsl:value-of select="/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='LDAB']"></xsl:value-of></a>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$collection = 'hgv'">HGV </xsl:if>
Expand Down
8 changes: 7 additions & 1 deletion pn-xslt/htm-teibibl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
<xsl:when test="(@type='article' or @type='review') and $mainWork//*"><xsl:apply-templates select="$mainWork/t:bibl" mode="mainTitle"/></xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$biblType = 'principalEdition'">
<xsl:choose>
<xsl:when test="descendant::t:title[@type='short-Checklist']"><xsl:apply-templates select="descendant::t:title[@type='short-Checklist'][1]"/><xsl:text> </xsl:text></xsl:when>
<xsl:otherwise><xsl:apply-templates select="t:title[1]"/><xsl:text> </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="t:title[@type='main']">
<i><xsl:value-of select="t:title[@type='main']"/></i><xsl:if test="t:title[@type='short']"> (<i><xsl:value-of select="t:title[@type='short']"/></i>)</xsl:if>
</xsl:when>
Expand All @@ -68,7 +74,7 @@
</xsl:choose></xsl:variable>
<xsl:variable name="pubInfo"><xsl:call-template name="pubInfo"><xsl:with-param name="main" select="$mainWork"/></xsl:call-template></xsl:variable>
<xsl:choose>
<xsl:when test="$biblType = 'principalEdition'">
<xsl:when test="$biblType = 'title'">
<xsl:choose>
<xsl:when test="descendant::t:title[@type='short-Checklist']"><xsl:apply-templates select="descendant::t:title[@type='short-Checklist'][1]"/><xsl:text> </xsl:text></xsl:when>
<xsl:otherwise><xsl:apply-templates select="t:title[1]"/><xsl:text> </xsl:text></xsl:otherwise>
Expand Down
13 changes: 9 additions & 4 deletions pn-xslt/metadata-dclp.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@

<!-- handle principal edition bibliography -->
<xsl:template match="t:div[@type = 'bibliography' and @subtype = 'principalEdition']" mode="metadata-dclp">
<xsl:for-each-group select="t:listBibl/t:bibl[@type='publication' and @subtype='principal']" group-by="@subtype">
<xsl:for-each-group select="t:listBibl/t:bibl[@type='publication' and @subtype='principal' and *]" group-by="@subtype">
<tr>
<th>Principal Edition</th>
<td>
Expand Down Expand Up @@ -382,7 +382,13 @@
<xsl:when test="doc-available($biblio-filename)">
<xsl:variable name="biblio-doc" select="pi:get-docs($biblio-target, 'xml')"/>
<xsl:for-each select="$biblio-doc/t:bibl">
<xsl:call-template name="buildCitation"><xsl:with-param name="biblType" select="$type"/></xsl:call-template>
<xsl:variable name="biblType">
<xsl:choose>
<xsl:when test="$type='principalEdition' and .//t:title[@type='short-Checklist']">title</xsl:when>
<xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="buildCitation"><xsl:with-param name="biblType" select="$biblType"/></xsl:call-template>
</xsl:for-each>
<xsl:value-of select="$passThrough"/>
</xsl:when>
Expand All @@ -396,11 +402,10 @@
<xsl:value-of select="$passThrough"/>
</xsl:otherwise>
</xsl:choose> </xsl:template>

<xsl:template name="dclp-bibliography">
<xsl:param name="heading"/>
<xsl:param name="references"/>
<xsl:for-each select="$references">
<xsl:for-each select="$references">
<xsl:variable name="type">
<xsl:choose>
<xsl:when test="@type='publication' and @subtype='principal'">principalEdition</xsl:when>
Expand Down

0 comments on commit 7d600dd

Please sign in to comment.