forked from dracor-org/engdracor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.xsl
41 lines (37 loc) · 1.29 KB
/
list.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
34
35
36
37
38
39
40
41
<!-- stylesheet to generate lists from index.xml -->
<xsl:stylesheet version="1.0"
xmlns="http://www.tei-c.org/ns/1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:param name="type">csv</xsl:param>
<xsl:param name="vanilla"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$type = 'csv'">
<xsl:text>DraCor_ID,TCP_ID,DraCor_slug,ZIP_URL </xsl:text>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="//item"/>
</xsl:template>
<xsl:template match="item[@id and (not($vanilla) or @vanilla)]">
<xsl:choose>
<xsl:when test="$type = 'csv'">
<xsl:value-of select="@id"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="@sourceid"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="@slug"/>
<xsl:text>,</xsl:text>
<xsl:text>https://texts.earlyprint.org/downloads/</xsl:text>
<xsl:value-of select="substring(@sourceid, 1, 3)"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="@sourceid"/>
<xsl:text>.xml.zip</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@*[local-name()=$type]"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>