VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/plugins/com.sophos.tocjs/xsl/jstext.xsl@ 99507

最後變更 在這個檔案從99507是 98584,由 vboxsync 提交於 2 年 前

Docs: bugref:10302. Setting svn properties of DITA-OT library.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.2 KB
 
1<!--
2 This file is part of the DITA Open Toolkit project hosted on
3 Sourceforge.net. See the accompanying license.txt file for
4 applicable licenses.
5
6 (C) Copyright Shawn McKenzie, 2007. All Rights Reserved.
7 *-->
8<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
9
10
11 <!-- this template will stip out funky chars used for js variable names -->
12 <xsl:template name="stripstring">
13 <xsl:param name="jsvarstring"/>
14 <!-- this should simply strip strange characters from the param so it can
15 be used as a JavaScript variable name -->
16
17 <!-- can't use the following chars in xsl, so make vars -->
18 <xsl:variable name="apos">'</xsl:variable>
19 <xsl:variable name="comma">,</xsl:variable>
20 <xsl:variable name="colon">:</xsl:variable>
21 <xsl:variable name="gt">&gt;</xsl:variable>
22 <xsl:variable name="lt">&lt;</xsl:variable>
23
24 <xsl:value-of select="translate(translate(translate(translate(translate(translate($jsvarstring,
25 '/\^&amp;|\¬`*.-) (%?$£!+=1234567890[]{}',
26 ''), $apos, ''), $comma, ''), $colon, ''), $gt, ''), $lt, '')"/>
27 <!-- above does not catch , ' or : -->
28
29
30 <!-- <xsl:variable name="self"
31 select="translate(translate(translate(@navtitle, '/', ''), '.', ''), ' ', '')"/>-->
32 </xsl:template>
33
34
35
36
37
38
39 <xsl:template name="escapestring">
40 <xsl:param name="jstextstring"/>
41 <!-- this might need recursion. I'll need to escape chars in the output
42 so that these symbols , : ' (others?) look like \, \: \'
43 I might need recursion because there may be multiple instances of
44 these chars.-->
45
46 <!-- can't use the following chars in xsl, so make vars -->
47 <xsl:variable name="apos">'</xsl:variable>
48 <xsl:variable name="jsapos">\'</xsl:variable>
49 <xsl:variable name="comma">,</xsl:variable>
50 <xsl:variable name="jscomma">\,</xsl:variable>
51 <xsl:variable name="colon">:</xsl:variable>
52 <xsl:variable name="jscolon">\:</xsl:variable>
53
54
55 <!-- use the strip for testing and escape later -->
56 <xsl:value-of select="translate(translate(translate($jstextstring, '/\^&amp;|\¬`*?.-) (%$£!+=', ''),
57 $apos, ''), $comma, '')"/>/>
58 </xsl:template>
59
60</xsl:stylesheet>
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette