Skip to content
Permalink
380d7af310
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
134 lines (122 sloc) 4.78 KB
<?xml version="1.0"?>
<stylesheet
xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:eoa="http://www.edition-open-access.de/ns"
exclude-result-prefixes="xs html eoa"
version="2.0"
>
<output
method="xml"
encoding="UTF-8"
indent="yes"
version="1.0"
/>
<param name="dashed_file" as="xs:string"/>
<variable name="dashed_doc" select="doc($dashed_file)"/>
<variable name="bibliography_chapter_prefix" as="xs:string" select="'BIBLIOGRAPHY'"/>
<variable name="shorthands_chapter_heading" as="xs:string" select="'Shorthands'"/>
<template
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
match="/"
>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title>Bibliography for </title>
</titleStmt>
<publicationStmt>
<p>Publication Information</p>
</publicationStmt>
<sourceDesc>
<p>Information about the source</p>
</sourceDesc>
</fileDesc>
</teiHeader>
<text>
<body>
<div type="citations">
<xsl:call-template name="render_citations"/>
</div>
<div type="shorthands">
<xsl:call-template name="render_shorthands"/>
</div>
<div type="bibliographies">
<xsl:call-template name="render_bibliographies"/>
</div>
</body>
</text>
</TEI>
</template>
<template name="render_shorthands">
<message>rendering shorthands</message>
<for-each select="//html:h3[. = $shorthands_chapter_heading]/following-sibling::html:p[preceding-sibling::html:h3[1] = $shorthands_chapter_heading]">
<tei:p>
<apply-templates mode="imhtml_to_tei"/>
</tei:p>
</for-each>
</template>
<template name="render_bibliographies">
<message>rendering bibliographies</message>
<variable name="keywords" as="xs:string*" select="$dashed_doc//html:h3[starts-with(., $bibliography_chapter_prefix)]/(if (. = $bibliography_chapter_prefix) then '' else substring-after(., concat($bibliography_chapter_prefix, '-')))"/>
<for-each select="$keywords">
<message>keyword '<value-of select="."/>'</message>
<call-template name="render_bibliography">
<with-param name="keyword" as="xs:string" select="."/>
</call-template>
</for-each>
</template>
<template name="render_bibliography">
<param name="keyword" as="xs:string" select="''"/>
<tei:listBibl type="references" n="{$keyword}">
<variable name="html_chap_heading" as="xs:string" select="if ($keyword = '') then $bibliography_chapter_prefix else string-join(($bibliography_chapter_prefix, $keyword), '-')"/>
<for-each select="$dashed_doc//html:h3[. = $html_chap_heading]/following-sibling::html:dl/html:dt[starts-with(@id, 'X0-')]">
<variable name="citekey" as="xs:string" select="substring-after(@id, 'X0-')"/>
<tei:bibl corresp="{$citekey}">
<apply-templates mode="imhtml_to_tei" select="following-sibling::html:dd[1]/html:p"/>
</tei:bibl>
</for-each>
</tei:listBibl>
</template>
<template mode="imhtml_to_tei" match="*" priority="-100">
<message>
<value-of select="concat('when converting to tei: unknown html element ', name(), '. ignoring...')"/>
</message>
<apply-templates mode="imhtml_to_tei"/>
</template>
<template mode="imhtml_to_tei" match="html:p">
<apply-templates mode="imhtml_to_tei"/>
</template>
<template mode="imhtml_to_tei" match="html:a">
<apply-templates mode="imhtml_to_tei"/>
</template>
<template mode="imhtml_to_tei" match="html:span[@class = 'ectt-1095']">
<tei:hi rend="monospace">
<apply-templates mode="imhtml_to_tei"/>
</tei:hi>
</template>
<template mode="imhtml_to_tei" match="html:span[@class = 'ecti-1095']">
<tei:hi rend="italic">
<apply-templates mode="imhtml_to_tei"/>
</tei:hi>
</template>
<template name="render_citations">
<message>rendering citations</message>
<for-each select="//html:h3[. = '1 Citations']/following-sibling::html:div//html:table/html:tr[normalize-space(.) != '']">
<variable name="citekey" as="xs:string" select="html:td[1]"/>
<variable name="authoryear" as="xs:string" select="html:td[2]"/>
<variable name="year" as="xs:string" select="html:td[3]"/>
<variable name="title" as="xs:string" select="html:td[4]"/>
<variable name="full" as="element()" select="//html:h3[. = 'BIBLIOGRAPHY']/following-sibling::html:dl/html:dt[substring-after(@id, 'X0-') = $citekey]/following-sibling::html:dd[1]"/>
<tei:listBibl xml:id="{$citekey}">
<tei:bibl type="authoryear"><value-of select="$authoryear"/></tei:bibl>
<tei:bibl type="year"><value-of select="$year"/></tei:bibl>
<tei:bibl type="title"><value-of select="$title"/></tei:bibl>
<tei:bibl type="full"><apply-templates mode="imhtml_to_tei" select="$full/node()"/></tei:bibl>
</tei:listBibl>
</for-each>
</template>
</stylesheet>