-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathno-translate-elements.xsl
92 lines (79 loc) · 3.86 KB
/
no-translate-elements.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
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the DITA-OT Translate Plug-in project.
See the accompanying LICENSE file for applicable licenses.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<!-- Process DITA block elements and comments -->
<xsl:template mode="no-translate" match="*|comment()|text()" />
<!-- draft-comment and required-cleanup should never be translated -->
<xsl:template mode="no-translate" match="draft-comment|required-cleanup">
<xsl:call-template name="add-no-translate-attr" />
</xsl:template>
<!-- Inline body elements are listed here -->
<xsl:template mode="no-translate" match="codeph|synph|term|option|fn">
<xsl:call-template name="add-no-translate-attr" />
</xsl:template>
<!-- Inline xmlconstruct elements are listed here -->
<xsl:template mode="no-translate" match="numcharref|parameterentity|textentity|xmlatt|xmlelement|xmlnsname|xmlpi">
<xsl:call-template name="add-no-translate-attr" />
</xsl:template>
<!-- Inline software elements are listed here -->
<xsl:template mode="no-translate" match="filepath|msgph|userinput|systemoutput|cmdname|msgnum|varname">
<xsl:call-template name="add-no-translate-attr" />
</xsl:template>
<!-- Inline userinteface elements are listed here -->
<xsl:template mode="no-translate" match="uicontrol|menucascade|wintitle">
<xsl:call-template name="add-no-translate-attr" />
</xsl:template>
<!-- Inline programming elements are listed here -->
<xsl:template mode="no-translate" match="parmname|apiname">
<xsl:call-template name="add-no-translate-attr" />
</xsl:template>
<!-- Process DITA block elements and comments -->
<xsl:template mode="add-no-translate-mark" match="*|comment()|text()">
<xsl:apply-templates select="node()" mode="trans-source" />
</xsl:template>
<!-- draft-comment and required-cleanup should never be translated -->
<xsl:template mode="add-no-translate-mark" match="draft-comment|required-cleanup">
<xsl:call-template name="add-no-translate-mark" />
</xsl:template>
<!-- Inline body elements are listed here -->
<xsl:template mode="add-no-translate-mark" match="codeph|synph|term|option|fn">
<xsl:call-template name="add-no-translate-mark" />
</xsl:template>
<!-- Inline xmlconstruct elements are listed here -->
<xsl:template mode="add-no-translate-mark" match="numcharref|parameterentity|textentity|xmlatt|xmlelement|xmlnsname|xmlpi">
<xsl:call-template name="add-no-translate-mark" />
</xsl:template>
<!-- Inline software elements are listed here -->
<xsl:template mode="add-no-translate-mark" match="filepath|msgph|userinput|systemoutput|cmdname|msgnum|varname">
<xsl:call-template name="add-no-translate-mark" />
</xsl:template>
<!-- Inline userinteface elements are listed here -->
<xsl:template mode="add-no-translate-mark" match="uicontrol|menucascade|wintitle">
<xsl:call-template name="add-no-translate-mark" />
</xsl:template>
<!-- Inline programming elements are listed here -->
<xsl:template mode="add-no-translate-mark" match="parmname|apiname">
<xsl:call-template name="add-no-translate-mark" />
</xsl:template>
<xsl:template name="add-no-translate-mark">
<mrk type="term">
<xsl:attribute name="translate">
<xsl:choose>
<xsl:when test="@translate">
<xsl:value-of select="@translate"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>no</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="concat('m',generate-id())" />
</xsl:attribute>
<xsl:apply-templates select="node()" mode="trans-source" />
</mrk>
</xsl:template>
</xsl:stylesheet>