-
Notifications
You must be signed in to change notification settings - Fork 0
/
dir_03_generateDelimited.xsl
31 lines (28 loc) · 1.1 KB
/
dir_03_generateDelimited.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
<?xml version="1.0" encoding="UTF-8"?>
<!-- This script converts a TEI table to a tab-delimited file. While written for the file directory, it works with most TEI tables. -->
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tei="http://www.tei-c.org/ns/1.0"
exclude-result-prefixes="xs"
>
<xsl:output method="text" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="//tei:table"/>
</xsl:template>
<xsl:template match="tei:table">
<xsl:for-each select="tei:row[1]/tei:cell">
<xsl:value-of select="@role"/>
<xsl:text>	</xsl:text>
</xsl:for-each>
<xsl:text> </xsl:text>
<xsl:apply-templates select="//tei:row"/>
</xsl:template>
<xsl:template match="tei:row">
<xsl:for-each select="tei:cell">
<xsl:value-of select="normalize-space(.)"/>
<xsl:text>	</xsl:text>
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>