javahelp.xsl 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
  4. xmlns:ng="http://docbook.org/docbook-ng"
  5. xmlns:db="http://docbook.org/ns/docbook"
  6. xmlns:exsl="http://exslt.org/common"
  7. version="1.0"
  8. exclude-result-prefixes="doc ng db exsl">
  9. <xsl:import href="../html/chunk.xsl"/>
  10. <xsl:output method="html"/>
  11. <!-- ********************************************************************
  12. $Id: javahelp.xsl 9152 2011-11-12 00:17:33Z bobstayton $
  13. ********************************************************************
  14. This file is part of the XSL DocBook Stylesheet distribution.
  15. See ../README or http://docbook.sf.net/release/xsl/current/ for
  16. copyright and other information.
  17. ******************************************************************** -->
  18. <!-- ==================================================================== -->
  19. <xsl:template match="/">
  20. <!-- * Get a title for current doc so that we let the user -->
  21. <!-- * know what document we are processing at this point. -->
  22. <xsl:variable name="doc.title">
  23. <xsl:call-template name="get.doc.title"/>
  24. </xsl:variable>
  25. <xsl:choose>
  26. <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
  27. toss the namespace and continue. Use the docbook5 namespaced
  28. stylesheets for DocBook5 if you don't want to use this feature.-->
  29. <xsl:when test="$exsl.node.set.available != 0
  30. and (*/self::ng:* or */self::db:*)">
  31. <xsl:call-template name="log.message">
  32. <xsl:with-param name="level">Note</xsl:with-param>
  33. <xsl:with-param name="source" select="$doc.title"/>
  34. <xsl:with-param name="context-desc">
  35. <xsl:text>namesp. cut</xsl:text>
  36. </xsl:with-param>
  37. <xsl:with-param name="message">
  38. <xsl:text>stripped namespace before processing</xsl:text>
  39. </xsl:with-param>
  40. </xsl:call-template>
  41. <xsl:variable name="nons">
  42. <xsl:apply-templates mode="stripNS"/>
  43. </xsl:variable>
  44. <xsl:call-template name="log.message">
  45. <xsl:with-param name="level">Note</xsl:with-param>
  46. <xsl:with-param name="source" select="$doc.title"/>
  47. <xsl:with-param name="context-desc">
  48. <xsl:text>namesp. cut</xsl:text>
  49. </xsl:with-param>
  50. <xsl:with-param name="message">
  51. <xsl:text>processing stripped document</xsl:text>
  52. </xsl:with-param>
  53. </xsl:call-template>
  54. <xsl:apply-templates select="exsl:node-set($nons)"/>
  55. </xsl:when>
  56. <xsl:otherwise>
  57. <xsl:choose>
  58. <xsl:when test="$rootid != ''">
  59. <xsl:choose>
  60. <xsl:when test="count(key('id',$rootid)) = 0">
  61. <xsl:message terminate="yes">
  62. <xsl:text>ID '</xsl:text>
  63. <xsl:value-of select="$rootid"/>
  64. <xsl:text>' not found in document.</xsl:text>
  65. </xsl:message>
  66. </xsl:when>
  67. <xsl:otherwise>
  68. <xsl:message>Formatting from <xsl:value-of select="$rootid"/></xsl:message>
  69. <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
  70. </xsl:otherwise>
  71. </xsl:choose>
  72. </xsl:when>
  73. <xsl:otherwise>
  74. <xsl:apply-templates select="/" mode="process.root"/>
  75. </xsl:otherwise>
  76. </xsl:choose>
  77. <xsl:for-each select="/"> <!-- This is just a hook for building profiling stylesheets -->
  78. <xsl:call-template name="helpset"/>
  79. <xsl:call-template name="helptoc"/>
  80. <xsl:call-template name="helpmap"/>
  81. <xsl:call-template name="helpidx"/>
  82. </xsl:for-each>
  83. </xsl:otherwise>
  84. </xsl:choose>
  85. </xsl:template>
  86. <xsl:param name="suppress.navigation" select="1"/>
  87. <!-- ==================================================================== -->
  88. <xsl:template name="helpset">
  89. <xsl:call-template name="write.chunk.with.doctype">
  90. <xsl:with-param name="filename" select="concat($chunk.base.dir,'jhelpset.hs')"/>
  91. <xsl:with-param name="method" select="'xml'"/>
  92. <xsl:with-param name="indent" select="'yes'"/>
  93. <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN'"/>
  94. <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/helpset_1_0.dtd'"/>
  95. <xsl:with-param name="content">
  96. <xsl:call-template name="helpset.content"/>
  97. </xsl:with-param>
  98. <xsl:with-param name="quiet" select="$chunk.quietly"/>
  99. </xsl:call-template>
  100. </xsl:template>
  101. <xsl:template name="helpset.content">
  102. <xsl:variable name="title">
  103. <xsl:apply-templates select="." mode="title.markup"/>
  104. </xsl:variable>
  105. <helpset version="1.0">
  106. <title>
  107. <xsl:value-of select="normalize-space($title)"/>
  108. </title>
  109. <!-- maps -->
  110. <maps>
  111. <homeID>top</homeID>
  112. <mapref location="jhelpmap.jhm"/>
  113. </maps>
  114. <!-- views -->
  115. <view>
  116. <name>TOC</name>
  117. <label>Table Of Contents</label>
  118. <type>javax.help.TOCView</type>
  119. <data>jhelptoc.xml</data>
  120. </view>
  121. <view>
  122. <name>Index</name>
  123. <label>Index</label>
  124. <type>javax.help.IndexView</type>
  125. <data>jhelpidx.xml</data>
  126. </view>
  127. <view>
  128. <name>Search</name>
  129. <label>Search</label>
  130. <type>javax.help.SearchView</type>
  131. <data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data>
  132. </view>
  133. </helpset>
  134. </xsl:template>
  135. <!-- ==================================================================== -->
  136. <xsl:template name="helptoc">
  137. <xsl:call-template name="write.chunk.with.doctype">
  138. <xsl:with-param name="filename" select="concat($chunk.base.dir,'jhelptoc.xml')"/>
  139. <xsl:with-param name="method" select="'xml'"/>
  140. <xsl:with-param name="indent" select="'yes'"/>
  141. <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN'"/>
  142. <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/toc_1_0.dtd'"/>
  143. <xsl:with-param name="encoding" select="$javahelp.encoding"/>
  144. <xsl:with-param name="content">
  145. <xsl:call-template name="helptoc.content"/>
  146. </xsl:with-param>
  147. <xsl:with-param name="quiet" select="$chunk.quietly"/>
  148. </xsl:call-template>
  149. </xsl:template>
  150. <xsl:template name="helptoc.content">
  151. <toc version="1.0">
  152. <xsl:choose>
  153. <xsl:when test="$rootid != ''">
  154. <xsl:apply-templates select="key('id',$rootid)" mode="jhtoc"/>
  155. </xsl:when>
  156. <xsl:otherwise>
  157. <xsl:apply-templates select="." mode="jhtoc"/>
  158. </xsl:otherwise>
  159. </xsl:choose>
  160. </toc>
  161. </xsl:template>
  162. <xsl:template match="set" mode="jhtoc">
  163. <xsl:variable name="id">
  164. <xsl:call-template name="object.id">
  165. <xsl:with-param name="object" select="."/>
  166. </xsl:call-template>
  167. </xsl:variable>
  168. <xsl:variable name="title">
  169. <xsl:apply-templates select="." mode="title.markup"/>
  170. </xsl:variable>
  171. <tocitem target="{$id}">
  172. <xsl:attribute name="text">
  173. <xsl:value-of select="normalize-space($title)"/>
  174. </xsl:attribute>
  175. <xsl:apply-templates select="book" mode="jhtoc"/>
  176. </tocitem>
  177. </xsl:template>
  178. <xsl:template match="book" mode="jhtoc">
  179. <xsl:variable name="id">
  180. <xsl:call-template name="object.id"/>
  181. </xsl:variable>
  182. <xsl:variable name="title">
  183. <xsl:apply-templates select="." mode="title.markup"/>
  184. </xsl:variable>
  185. <tocitem target="{$id}">
  186. <xsl:attribute name="text">
  187. <xsl:value-of select="normalize-space($title)"/>
  188. </xsl:attribute>
  189. <xsl:apply-templates select="part|reference|preface|chapter|appendix|article|colophon|glossary|bibliography"
  190. mode="jhtoc"/>
  191. </tocitem>
  192. </xsl:template>
  193. <xsl:template match="part|reference|preface|chapter|appendix|article"
  194. mode="jhtoc">
  195. <xsl:variable name="id">
  196. <xsl:call-template name="object.id"/>
  197. </xsl:variable>
  198. <xsl:variable name="title">
  199. <xsl:apply-templates select="." mode="title.markup"/>
  200. </xsl:variable>
  201. <tocitem target="{$id}">
  202. <xsl:attribute name="text">
  203. <xsl:value-of select="normalize-space($title)"/>
  204. </xsl:attribute>
  205. <xsl:apply-templates
  206. select="article|preface|chapter|appendix|refentry|section|sect1|glossary|bibliography"
  207. mode="jhtoc"/>
  208. </tocitem>
  209. </xsl:template>
  210. <xsl:template match="section" mode="jhtoc">
  211. <xsl:variable name="id">
  212. <xsl:call-template name="object.id"/>
  213. </xsl:variable>
  214. <xsl:variable name="title">
  215. <xsl:apply-templates select="." mode="title.markup"/>
  216. </xsl:variable>
  217. <tocitem target="{$id}">
  218. <xsl:attribute name="text">
  219. <xsl:value-of select="normalize-space($title)"/>
  220. </xsl:attribute>
  221. <xsl:apply-templates select="section" mode="jhtoc"/>
  222. </tocitem>
  223. </xsl:template>
  224. <xsl:template match="sect1" mode="jhtoc">
  225. <xsl:variable name="id">
  226. <xsl:call-template name="object.id"/>
  227. </xsl:variable>
  228. <xsl:variable name="title">
  229. <xsl:apply-templates select="." mode="title.markup"/>
  230. </xsl:variable>
  231. <tocitem target="{$id}">
  232. <xsl:attribute name="text">
  233. <xsl:value-of select="normalize-space($title)"/>
  234. </xsl:attribute>
  235. <xsl:apply-templates select="sect2" mode="jhtoc"/>
  236. </tocitem>
  237. </xsl:template>
  238. <xsl:template match="sect2" mode="jhtoc">
  239. <xsl:variable name="id">
  240. <xsl:call-template name="object.id"/>
  241. </xsl:variable>
  242. <xsl:variable name="title">
  243. <xsl:apply-templates select="." mode="title.markup"/>
  244. </xsl:variable>
  245. <tocitem target="{$id}">
  246. <xsl:attribute name="text">
  247. <xsl:value-of select="normalize-space($title)"/>
  248. </xsl:attribute>
  249. <xsl:apply-templates select="sect3" mode="jhtoc"/>
  250. </tocitem>
  251. </xsl:template>
  252. <xsl:template match="sect3" mode="jhtoc">
  253. <xsl:variable name="id">
  254. <xsl:call-template name="object.id"/>
  255. </xsl:variable>
  256. <xsl:variable name="title">
  257. <xsl:apply-templates select="." mode="title.markup"/>
  258. </xsl:variable>
  259. <tocitem target="{$id}">
  260. <xsl:attribute name="text">
  261. <xsl:value-of select="normalize-space($title)"/>
  262. </xsl:attribute>
  263. <xsl:apply-templates select="sect4" mode="jhtoc"/>
  264. </tocitem>
  265. </xsl:template>
  266. <xsl:template match="sect4" mode="jhtoc">
  267. <xsl:variable name="id">
  268. <xsl:call-template name="object.id"/>
  269. </xsl:variable>
  270. <xsl:variable name="title">
  271. <xsl:apply-templates select="." mode="title.markup"/>
  272. </xsl:variable>
  273. <tocitem target="{$id}">
  274. <xsl:attribute name="text">
  275. <xsl:value-of select="normalize-space($title)"/>
  276. </xsl:attribute>
  277. <xsl:apply-templates select="sect5" mode="jhtoc"/>
  278. </tocitem>
  279. </xsl:template>
  280. <xsl:template match="sect5|colophon|refentry" mode="jhtoc">
  281. <xsl:variable name="id">
  282. <xsl:call-template name="object.id"/>
  283. </xsl:variable>
  284. <xsl:variable name="title">
  285. <xsl:apply-templates select="." mode="title.markup"/>
  286. </xsl:variable>
  287. <tocitem target="{$id}">
  288. <xsl:attribute name="text">
  289. <xsl:value-of select="normalize-space($title)"/>
  290. </xsl:attribute>
  291. </tocitem>
  292. </xsl:template>
  293. <xsl:template match="glossary" mode="jhtoc">
  294. <xsl:variable name="id">
  295. <xsl:call-template name="object.id"/>
  296. </xsl:variable>
  297. <xsl:variable name="title">
  298. <xsl:call-template name="gentext">
  299. <xsl:with-param name="key" select="'Glossary'"/>
  300. </xsl:call-template>
  301. </xsl:variable>
  302. <tocitem target="{$id}">
  303. <xsl:attribute name="text">
  304. <xsl:value-of select="$title"/>
  305. </xsl:attribute>
  306. </tocitem>
  307. </xsl:template>
  308. <xsl:template match="bibliography" mode="jhtoc">
  309. <xsl:variable name="id">
  310. <xsl:call-template name="object.id"/>
  311. </xsl:variable>
  312. <xsl:variable name="title">
  313. <xsl:call-template name="gentext">
  314. <xsl:with-param name="key" select="'Bibliography'"/>
  315. </xsl:call-template>
  316. </xsl:variable>
  317. <tocitem target="{$id}">
  318. <xsl:attribute name="text">
  319. <xsl:value-of select="$title"/>
  320. </xsl:attribute>
  321. </tocitem>
  322. </xsl:template>
  323. <!-- ==================================================================== -->
  324. <xsl:template name="helpmap">
  325. <xsl:call-template name="write.chunk.with.doctype">
  326. <xsl:with-param name="filename" select="concat($chunk.base.dir, 'jhelpmap.jhm')"/>
  327. <xsl:with-param name="method" select="'xml'"/>
  328. <xsl:with-param name="indent" select="'yes'"/>
  329. <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN'"/>
  330. <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/map_1_0.dtd'"/>
  331. <xsl:with-param name="encoding" select="$javahelp.encoding"/>
  332. <xsl:with-param name="content">
  333. <xsl:call-template name="helpmap.content"/>
  334. </xsl:with-param>
  335. <xsl:with-param name="quiet" select="$chunk.quietly"/>
  336. </xsl:call-template>
  337. </xsl:template>
  338. <xsl:template name="helpmap.content">
  339. <map version="1.0">
  340. <xsl:choose>
  341. <xsl:when test="$rootid != ''">
  342. <xsl:apply-templates select="key('id',$rootid)//set
  343. | key('id',$rootid)//book
  344. | key('id',$rootid)//part
  345. | key('id',$rootid)//reference
  346. | key('id',$rootid)//preface
  347. | key('id',$rootid)//chapter
  348. | key('id',$rootid)//appendix
  349. | key('id',$rootid)//article
  350. | key('id',$rootid)//colophon
  351. | key('id',$rootid)//refentry
  352. | key('id',$rootid)//section
  353. | key('id',$rootid)//sect1
  354. | key('id',$rootid)//sect2
  355. | key('id',$rootid)//sect3
  356. | key('id',$rootid)//sect4
  357. | key('id',$rootid)//sect5
  358. | key('id',$rootid)//indexterm
  359. | key('id',$rootid)//glossary
  360. | key('id',$rootid)//bibliography
  361. | key('id',$rootid)//*[@id]"
  362. mode="map"/>
  363. </xsl:when>
  364. <xsl:otherwise>
  365. <xsl:apply-templates select="//set
  366. | //book
  367. | //part
  368. | //reference
  369. | //preface
  370. | //chapter
  371. | //appendix
  372. | //article
  373. | //colophon
  374. | //refentry
  375. | //section
  376. | //sect1
  377. | //sect2
  378. | //sect3
  379. | //sect4
  380. | //sect5
  381. | //indexterm
  382. | //glossary
  383. | //bibliography
  384. | //*[@id]"
  385. mode="map"/>
  386. </xsl:otherwise>
  387. </xsl:choose>
  388. </map>
  389. </xsl:template>
  390. <xsl:template match="set" mode="map">
  391. <xsl:variable name="id">
  392. <xsl:call-template name="object.id">
  393. <xsl:with-param name="object" select="."/>
  394. </xsl:call-template>
  395. </xsl:variable>
  396. <mapID target="{$id}">
  397. <xsl:attribute name="url">
  398. <xsl:call-template name="href.target.uri"/>
  399. </xsl:attribute>
  400. </mapID>
  401. </xsl:template>
  402. <xsl:template match="book" mode="map">
  403. <xsl:variable name="id">
  404. <xsl:call-template name="object.id"/>
  405. </xsl:variable>
  406. <mapID target="{$id}">
  407. <xsl:attribute name="url">
  408. <xsl:call-template name="href.target.uri"/>
  409. </xsl:attribute>
  410. </mapID>
  411. </xsl:template>
  412. <xsl:template match="part|reference|preface|chapter|appendix|refentry|article|glossary|bibliography"
  413. mode="map">
  414. <xsl:variable name="id">
  415. <xsl:call-template name="object.id"/>
  416. </xsl:variable>
  417. <mapID target="{$id}">
  418. <xsl:attribute name="url">
  419. <xsl:call-template name="href.target.uri"/>
  420. </xsl:attribute>
  421. </mapID>
  422. </xsl:template>
  423. <xsl:template match="section|sect1|sect2|sect3|sect4|sect5|colophon" mode="map">
  424. <xsl:variable name="id">
  425. <xsl:call-template name="object.id"/>
  426. </xsl:variable>
  427. <mapID target="{$id}">
  428. <xsl:attribute name="url">
  429. <xsl:call-template name="href.target.uri"/>
  430. </xsl:attribute>
  431. </mapID>
  432. </xsl:template>
  433. <xsl:template match="indexterm[@class='endofrange']" mode="map"/>
  434. <xsl:template match="indexterm" mode="map">
  435. <xsl:variable name="id">
  436. <xsl:call-template name="object.id"/>
  437. </xsl:variable>
  438. <mapID target="{$id}">
  439. <xsl:attribute name="url">
  440. <xsl:call-template name="href.target.uri"/>
  441. </xsl:attribute>
  442. </mapID>
  443. </xsl:template>
  444. <xsl:template match="*[@id]" mode="map">
  445. <xsl:variable name="id">
  446. <xsl:call-template name="object.id"/>
  447. </xsl:variable>
  448. <mapID target="{$id}">
  449. <xsl:attribute name="url">
  450. <xsl:call-template name="href.target.uri"/>
  451. </xsl:attribute>
  452. </mapID>
  453. </xsl:template>
  454. <!-- ==================================================================== -->
  455. <xsl:template name="helpidx">
  456. <xsl:call-template name="write.chunk.with.doctype">
  457. <xsl:with-param name="filename" select="concat($chunk.base.dir, 'jhelpidx.xml')"/>
  458. <xsl:with-param name="method" select="'xml'"/>
  459. <xsl:with-param name="indent" select="'yes'"/>
  460. <xsl:with-param name="doctype-public" select="'-//Sun Microsystems Inc.//DTD JavaHelp Index Version 1.0//EN'"/>
  461. <xsl:with-param name="doctype-system" select="'http://java.sun.com/products/javahelp/index_1_0.dtd'"/>
  462. <xsl:with-param name="encoding" select="$javahelp.encoding"/>
  463. <xsl:with-param name="content">
  464. <xsl:call-template name="helpidx.content"/>
  465. </xsl:with-param>
  466. <xsl:with-param name="quiet" select="$chunk.quietly"/>
  467. </xsl:call-template>
  468. </xsl:template>
  469. <xsl:template name="helpidx.content">
  470. <index version="1.0">
  471. <xsl:choose>
  472. <xsl:when test="$rootid != ''">
  473. <xsl:apply-templates select="key('id',$rootid)//indexterm" mode="idx">
  474. <xsl:sort select="primary"/>
  475. <xsl:sort select="secondary"/>
  476. <xsl:sort select="tertiary"/>
  477. </xsl:apply-templates>
  478. </xsl:when>
  479. <xsl:otherwise>
  480. <xsl:apply-templates select="//indexterm" mode="idx">
  481. <xsl:sort select="primary"/>
  482. <xsl:sort select="secondary"/>
  483. <xsl:sort select="tertiary"/>
  484. </xsl:apply-templates>
  485. </xsl:otherwise>
  486. </xsl:choose>
  487. </index>
  488. </xsl:template>
  489. <xsl:template match="indexterm[@class='endofrange']" mode="idx"/>
  490. <xsl:template match="indexterm" mode="idx">
  491. <xsl:variable name="id">
  492. <xsl:call-template name="object.id"/>
  493. </xsl:variable>
  494. <xsl:variable name="text">
  495. <xsl:value-of select="normalize-space(primary)"/>
  496. <xsl:if test="secondary">
  497. <xsl:text>, </xsl:text>
  498. <xsl:value-of select="normalize-space(secondary)"/>
  499. </xsl:if>
  500. <xsl:if test="tertiary">
  501. <xsl:text>, </xsl:text>
  502. <xsl:value-of select="normalize-space(tertiary)"/>
  503. </xsl:if>
  504. </xsl:variable>
  505. <xsl:choose>
  506. <xsl:when test="see">
  507. <xsl:variable name="see"><xsl:value-of select="normalize-space(see)"/></xsl:variable>
  508. <indexitem text="{$text} see '{$see}'"/>
  509. </xsl:when>
  510. <xsl:otherwise>
  511. <indexitem text="{$text}" target="{$id}"/>
  512. </xsl:otherwise>
  513. </xsl:choose>
  514. </xsl:template>
  515. <!-- ==================================================================== -->
  516. <!-- Kludge for Xalan outputting &trade; which fails in javahelp -->
  517. <xsl:template name="dingbat.characters">
  518. <!-- now that I'm using the real serializer, all that dingbat malarky -->
  519. <!-- isn't necessary anymore... -->
  520. <xsl:param name="dingbat">bullet</xsl:param>
  521. <xsl:choose>
  522. <xsl:when test="$dingbat='bullet'">&#x2022;</xsl:when>
  523. <xsl:when test="$dingbat='copyright'">&#x00A9;</xsl:when>
  524. <xsl:when test="$dingbat='trademark' or $dingbat='trade'">
  525. <xsl:choose>
  526. <xsl:when test="contains(system-property('xsl:vendor'),
  527. 'Apache Software Foundation')">
  528. <sup>TM</sup>
  529. </xsl:when>
  530. <xsl:otherwise>&#x2122;</xsl:otherwise>
  531. </xsl:choose>
  532. </xsl:when>
  533. <xsl:when test="$dingbat='registered'">&#x00AE;</xsl:when>
  534. <xsl:when test="$dingbat='service'">(SM)</xsl:when>
  535. <xsl:when test="$dingbat='nbsp'">&#x00A0;</xsl:when>
  536. <xsl:when test="$dingbat='ldquo'">&#x201C;</xsl:when>
  537. <xsl:when test="$dingbat='rdquo'">&#x201D;</xsl:when>
  538. <xsl:when test="$dingbat='lsquo'">&#x2018;</xsl:when>
  539. <xsl:when test="$dingbat='rsquo'">&#x2019;</xsl:when>
  540. <xsl:when test="$dingbat='em-dash'">&#x2014;</xsl:when>
  541. <xsl:when test="$dingbat='mdash'">&#x2014;</xsl:when>
  542. <xsl:when test="$dingbat='en-dash'">&#x2013;</xsl:when>
  543. <xsl:when test="$dingbat='ndash'">&#x2013;</xsl:when>
  544. <xsl:otherwise>
  545. <xsl:text>&#x2022;</xsl:text>
  546. </xsl:otherwise>
  547. </xsl:choose>
  548. </xsl:template>
  549. </xsl:stylesheet>