-
Notifications
You must be signed in to change notification settings - Fork 0
/
SAB-timingfile-from-transscriber.xslt
42 lines (40 loc) · 1.65 KB
/
SAB-timingfile-from-transscriber.xslt
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
<?xml version="1.0" encoding="utf-8"?>
<!--
#############################################################
# Name: .xslt
# Purpose:
# Part of: Vimod Pub - http://projects.palaso.org/projects/vimod-pub
# Author: Ian McQuay <[email protected]>
# Created: 2015- -
# Copyright: (c) 2015 SIL International
# Licence: <LGPL>
################################################################
Input file is a Transcriber 1.5 file and output file is a ??? file for inclusion in
-->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8"/>
<xsl:strip-space elements="*"/>
<xsl:template match="//Turn">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="Sync">
<xsl:choose>
<xsl:when test="@time = '0'"/>
<xsl:otherwise>
<xsl:value-of select="@time"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="@time"/>
<xsl:text>	</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="text()">
<xsl:choose>
<xsl:when test="normalize-space(.) = '\ref \gl'"/>
<xsl:otherwise>
<xsl:value-of select="tokenize(normalize-space(.),'\s')[1]"/>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>