8
16
############################################################################ -->
10
18
<!-- These templates boost the text processing but needs some post-parsing
11
to escape the TeX characters. -->
19
to escape the TeX characters and do the encoding. -->
21
<!-- use Reserved Unicode characters as delimiters -->
13
22
<xsl:template name="scape" >
14
23
<xsl:param name="string"/>
15
<xsl:text><t></xsl:text>
24
<xsl:text>&t1;</xsl:text>
16
25
<xsl:value-of select="$string"/>
17
<xsl:text></t></xsl:text>
26
<xsl:text>&t2;</xsl:text>
20
<!-- tag the text for the perl script -->
29
<!-- tag the text for post-processing -->
21
30
<xsl:template match="text()">
22
<xsl:text><t></xsl:text>
31
<xsl:text>&t1;</xsl:text>
23
32
<xsl:value-of select="."/>
25
<xsl:value-of select="normalize-space(.)"/>
27
<xsl:text></t></xsl:text>
33
<xsl:text>&t2;</xsl:text>
36
<xsl:template match="text()" mode="latex.programlisting">
37
<xsl:text>&v1;</xsl:text>
38
<xsl:value-of select="."/>
39
<xsl:text>&v2;</xsl:text>
42
<xsl:template match="text()" mode="latex.verbatim">
43
<xsl:text>&v1;</xsl:text>
44
<xsl:value-of select="."/>
45
<xsl:text>&v2;</xsl:text>
49
<!-- replace some text in a string *as is* the string is already escaped.
50
Here it ends to inserting raw text between tags. -->
51
<xsl:template name="scape-replace" >
52
<xsl:param name="string"/>
53
<xsl:param name="from"/>
54
<xsl:param name="to"/>
55
<xsl:call-template name="string-replace">
56
<xsl:with-param name="string" select="$string"/>
57
<xsl:with-param name="from" select="$from"/>
58
<xsl:with-param name="to" select="concat('&t2;',$to,'&t1;')"/>
62
<!-- just ask for encoding -->
63
<xsl:template name="scape-encode" >
64
<xsl:param name="string"/>
65
<xsl:text>&u1;</xsl:text>
66
<xsl:value-of select="$string"/>
67
<xsl:text>&u2;</xsl:text>
30
70
<!-- specific behaviour for MML -->