-
Notifications
You must be signed in to change notification settings - Fork 1
/
docbook_to_script.xsl
46 lines (38 loc) · 1.34 KB
/
docbook_to_script.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
42
43
44
45
46
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:output method="text" indent="yes"/>
<xsl:template match="article">
<xsl:apply-templates select="sect1/informaltable/tgroup/tbody/row"/>
</xsl:template>
<xsl:template match="row">
<xsl:if test="entry[3]/para/emphasis/@role = 'bold'">
<xsl:text>
// Frame </xsl:text><xsl:value-of select="entry[1]/para"/><xsl:text>
</xsl:text>
<xsl:text>/* </xsl:text>
<xsl:value-of select="normalize-space(entry[2]/para)"/>
<xsl:text>*/
</xsl:text>
<xsl:apply-templates select="entry[2]/figure"/>
<xsl:apply-templates select="entry[3]/para[emphasis/@role ='bold']"/>
</xsl:if>
</xsl:template>
<xsl:template match="figure">
<xsl:text>// </xsl:text><xsl:value-of select="title"/><xsl:text>
</xsl:text>
<xsl:text>diagram, {image:"</xsl:text>
<xsl:value-of select="graphic/@fileref"/>
<xsl:text>"},
</xsl:text>
</xsl:template>
<xsl:template match="para">
<xsl:variable name="speaker" select="translate(emphasis,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ:','abcdefghijklmnopqrstuvwxyz')"/>
<xsl:value-of select="$speaker"/><xsl:text>, "</xsl:text>
<xsl:value-of select="normalize-space(emphasis/following-sibling::text())"/>
<xsl:text>",
</xsl:text>
</xsl:template>
</xsl:stylesheet>