-
Notifications
You must be signed in to change notification settings - Fork 2
/
convert_tei-to-yaml_issues.xsl
33 lines (32 loc) · 1.87 KB
/
convert_tei-to-yaml_issues.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns="http://www.loc.gov/mods/v3"
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:oape="https://openarabicpe.github.io/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xpath-default-namespace="http://www.loc.gov/mods/v3">
<xsl:output encoding="UTF-8" indent="yes" method="text" omit-xml-declaration="yes" version="1.0"/>
<!-- this stylesheet generates a MODS XML file with bibliographic metadata for each <div> in the body of the TEI source file. File names are based on the source's @xml:id and the @xml:id of the <div>. -->
<xsl:import href="convert_tei-to-biblstruct_functions.xsl"/>
<xsl:include href="convert_tei-to-yaml_functions.xsl"/>
<xsl:template match="/">
<xsl:result-document href="{$v_base-directory}metadata/issues/{$vgFileId}.yml">
<!-- construct YAML -->
<xsl:apply-templates select="descendant::tei:text/tei:body/descendant::tei:div"/>
</xsl:result-document>
</xsl:template>
<xsl:template match="tei:div">
<xsl:choose>
<!-- prevent output for sections of legal texts -->
<xsl:when test="ancestor::tei:div[@type = 'bill'] or ancestor::tei:div[@subtype = 'bill']"/>
<!-- prevent output for mastheads -->
<xsl:when test="@type='masthead' or @subtype='masthead'"/>
<!-- prevent output for sections of articles -->
<xsl:when test="ancestor::tei:div[@type='item']"/>
<xsl:when test="@type = ('section', 'item')">
<xsl:copy-of select="oape:bibliography-tei-to-yaml(oape:bibliography-tei-div-to-biblstruct(.), $p_target-language, true())"/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>