-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconversion-script.xslt
More file actions
72 lines (63 loc) · 2.53 KB
/
Copy pathconversion-script.xslt
File metadata and controls
72 lines (63 loc) · 2.53 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xpath-default-namespace="http://www.tei-c.org/ns/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0">
<xsl:variable name="witness-id"><xsl:value-of select="/TEI/teiHeader/fileDesc/sourceDesc/listWit/witness/@xml:id"/></xsl:variable>
<xsl:variable name="normalizeSpelling" select="true()"/>
<xsl:output method="text" indent="no"/>
<xsl:strip-space elements="div"/>
<xsl:template match="text()">
<xsl:value-of select="replace(., '\s+', ' ')"/>
</xsl:template>
<xsl:template match="/">
{witness:<xsl:value-of select="$witness-id"/>}
{content:<xsl:apply-templates select="//body"/>}
</xsl:template>
<xsl:template match="div//head"><xsl:apply-templates/></xsl:template>
<xsl:template match="p">
<xsl:text>
</xsl:text>
<xsl:apply-templates />
<xsl:text>
</xsl:text>
</xsl:template>
<!-- Normalization template -->
<xsl:template match="choice/orig">
<xsl:choose>
<xsl:when test="$normalizeSpelling">
<xsl:value-of select="./reg"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./orig"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="unclear">{unclear:<xsl:apply-templates/>}</xsl:template>
<xsl:template match="pb">{pb:@ed <xsl:value-of select="translate(./@ed, '#', '')"/> @n <xsl:value-of select="./@n"/></xsl:template>
<xsl:template match="supplied">{supplied:<xsl:apply-templates/>}</xsl:template>
<xsl:template match="secl">{secluded:<xsl:apply-templates/>}</xsl:template>
<xsl:template match="del">{del:<xsl:apply-templates/>}</xsl:template>
<xsl:template match="add">{add:<xsl:apply-templates/>, <xsl:value-of select="@place"/>}</xsl:template>
<xsl:template match="cit[bibl]">
<xsl:choose>
<xsl:when test="./quote">
<xsl:text>"</xsl:text>
<xsl:apply-templates select="quote"/>
<xsl:text>"</xsl:text>
</xsl:when>
<xsl:when test="./ref">
<xsl:apply-templates select="ref"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="ref[bibl]">
<xsl:apply-templates select="seg"/>
</xsl:template>
<xsl:template match="ref"><xsl:apply-templates/></xsl:template>
<xsl:template match="app">
<xsl:choose>
<xsl:when test="lem">
<xsl:apply-templates select="lem"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="rdg[1]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>