File: translate.xslt

package info (click to toggle)
postbooks 4.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 112,660 kB
  • ctags: 22,890
  • sloc: cpp: 310,358; sh: 607; xml: 214; python: 140; awk: 104; makefile: 50
file content (115 lines) | stat: -rw-r--r-- 3,144 bytes parent folder | download | duplicates (3)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
 <xsl:stylesheet version="1.0"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:tr="mynamespace" exclude-result-prefixes="tr">
     <xsl:output method="xml" omit-xml-declaration="yes" encoding="utf-8"/>




<xsl:template match="/">
   <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE TS &gt;</xsl:text>
   <xsl:text>&#xa;</xsl:text>
   <xsl:copy>
      <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>


<xsl:template match="@*|node()">
   <xsl:copy>
      <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>



<!--Matches message nodes that have translation nodes whose types are unfinished. Then the valid child nodes of message are matched so that they appear in the order specified by the documentation.-->
<xsl:template match="context/message[translation[@type='unfinished']]">
   <xsl:copy>
      <xsl:apply-templates select="location" />
      <xsl:apply-templates select="source" />
      <xsl:apply-templates select="oldsource" />
      <xsl:apply-templates select="comment" />
      <xsl:apply-templates select="oldcomment" />
      <xsl:apply-templates select="extracomment" />
      <xsl:apply-templates select="translatorcomment" />
      <xsl:text>&#xa;      </xsl:text>
      <xsl:element name="translation">
           <xsl:attribute name="type">
                <xsl:value-of select="'unfinished'" />
           </xsl:attribute>
      <xsl:value-of disable-output-escaping="yes" select="(tr:translate(string(source)))"/>
      </xsl:element>
      <xsl:apply-templates select="userdata" />
       <xsl:text>&#xa;    </xsl:text>
   </xsl:copy>
</xsl:template>


<xsl:template match="source">
   <xsl:text>&#xa;      </xsl:text>
   <xsl:copy>
       <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>


<xsl:template match="location">
   <xsl:text>&#xa;      </xsl:text>
   <xsl:copy>
       <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>


<xsl:template match="oldsource">
   <xsl:text>&#xa;      </xsl:text>
   <xsl:copy>
       <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>


<xsl:template match="comment">
   <xsl:text>&#xa;      </xsl:text>
   <xsl:copy>
       <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>


<xsl:template match="oldcomment">
   <xsl:text>&#xa;      </xsl:text>
   <xsl:copy>
       <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>


<xsl:template match="extracomment">
   <xsl:text>&#xa;      </xsl:text>
   <xsl:copy>
       <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>


<xsl:template match="translatorcomment">
   <xsl:text>&#xa;      </xsl:text>
   <xsl:copy>
       <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>


<xsl:template match="userdata">
   <xsl:text>&#xa;      </xsl:text>
   <xsl:copy>
       <xsl:apply-templates select="@* | node()" />
   </xsl:copy>
</xsl:template>


</xsl:stylesheet>