ispp.xsl 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output doctype-system="isetup.dtd" indent="yes" encoding="utf-8"/>
  4. <xsl:strip-space elements="*"/>
  5. <xsl:template match="yasyx">
  6. <xsl:comment>
  7. Inno Setup Preprocessor Reference
  8. Copyright (C) 1997-2025 Jordan Russell
  9. Portions Copyright (C) 2000-2024 Martijn Laan
  10. For conditions of distribution and use, see LICENSE.TXT.
  11. Portions Copyright (C) 2001-2004 Alex Yackimoff
  12. This file is automatically generated by ISHelpGen. Do not edit.
  13. </xsl:comment>
  14. <ishelp version="1">
  15. <xsl:apply-templates/>
  16. </ishelp>
  17. </xsl:template>
  18. <xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
  19. <xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
  20. <xsl:template match="topic">
  21. <topic name="{translate(@id,$ucletters,$lcletters)}" title="Inno Setup Preprocessor: {title}">
  22. <xsl:if test="title">
  23. <keyword value="{title}" />
  24. </xsl:if>
  25. <xsl:for-each select="keywords/kwd">
  26. <keyword value="{text()}" />
  27. </xsl:for-each>
  28. <body>
  29. <xsl:apply-templates select="*[name()!='topic']"/>
  30. <xsl:if test="topic">
  31. <heading><xsl:value-of select="subtopicstitle"/></heading>
  32. <ul>
  33. <xsl:choose>
  34. <xsl:when test="@id='funcs'">
  35. <xsl:for-each select="topic">
  36. <xsl:sort select="title" data-type="text" order="ascending"/>
  37. <xsl:if test="title">
  38. <li><link topic="{translate(@id,$ucletters,$lcletters)}"><xsl:value-of select="title"/></link></li>
  39. </xsl:if>
  40. </xsl:for-each>
  41. </xsl:when>
  42. <xsl:otherwise>
  43. <xsl:for-each select="topic">
  44. <xsl:if test="title and not(@unlisted='yes')">
  45. <li><link topic="{translate(@id,$ucletters,$lcletters)}"><xsl:value-of select="title"/></link></li>
  46. </xsl:if>
  47. </xsl:for-each>
  48. </xsl:otherwise>
  49. </xsl:choose>
  50. </ul>
  51. </xsl:if>
  52. </body>
  53. </topic>
  54. <xsl:for-each select="topic">
  55. <xsl:apply-templates select="."/>
  56. </xsl:for-each>
  57. </xsl:template>
  58. <xsl:template match="title">
  59. </xsl:template>
  60. <xsl:template match="subtopicstitle">
  61. </xsl:template>
  62. <xsl:template match="line">
  63. <xsl:apply-templates/><br />
  64. </xsl:template>
  65. <xsl:template match="table">
  66. <table><xsl:apply-templates/></table>
  67. </xsl:template>
  68. <xsl:template match="tr">
  69. <tr><xsl:apply-templates/></tr>
  70. </xsl:template>
  71. <xsl:template match="td">
  72. <td><xsl:apply-templates/></td>
  73. </xsl:template>
  74. <xsl:template match="code">
  75. <tt><xsl:apply-templates/></tt>
  76. </xsl:template>
  77. <xsl:template match="keywords">
  78. </xsl:template>
  79. <xsl:template match="description">
  80. <xsl:if test="@header='yes'">
  81. <heading>Description</heading>
  82. </xsl:if>
  83. <xsl:apply-templates/>
  84. </xsl:template>
  85. <xsl:template match="section">
  86. <heading><xsl:value-of select="@title"/></heading>
  87. <xsl:apply-templates/>
  88. </xsl:template>
  89. <xsl:template match="p">
  90. <p><xsl:apply-templates/></p>
  91. </xsl:template>
  92. <xsl:template match="ul">
  93. <ul><xsl:apply-templates/></ul>
  94. </xsl:template>
  95. <xsl:template match="li">
  96. <li><xsl:apply-templates/></li>
  97. </xsl:template>
  98. <xsl:template match="tt">
  99. <tt><xsl:apply-templates/></tt>
  100. </xsl:template>
  101. <xsl:template match="syntax">
  102. <heading>Syntax</heading>
  103. <xsl:apply-templates select="*[@inline!='yes']"/>
  104. </xsl:template>
  105. <xsl:template match="pre">
  106. <p><tt><xsl:apply-templates/></tt></p>
  107. </xsl:template>
  108. <xsl:template match="alink">
  109. <!-- <link topic="{@kwd}"><xsl:apply-templates/></link> -->
  110. </xsl:template>
  111. <xsl:template match="extlink">
  112. <extlink href="{@href}"><xsl:apply-templates/></extlink>
  113. </xsl:template>
  114. <xsl:template match="link">
  115. <xsl:choose>
  116. <xsl:when test="ancestor::topic/@id=@href">
  117. <xsl:choose>
  118. <xsl:when test="text()">
  119. <xsl:apply-templates/>
  120. </xsl:when>
  121. <xsl:otherwise>
  122. <xsl:choose>
  123. <xsl:when test="//topic[@id=current()/@href]/@usetitle='no'">
  124. <xsl:value-of select="//topic[@id=current()/@href]/@id"/>
  125. </xsl:when>
  126. <xsl:otherwise>
  127. <xsl:value-of select="//topic[@id=current()/@href]/title/text()"/>
  128. </xsl:otherwise>
  129. </xsl:choose>
  130. </xsl:otherwise>
  131. </xsl:choose>
  132. </xsl:when>
  133. <xsl:otherwise>
  134. <link topic="{translate(@href,$ucletters,$lcletters)}">
  135. <xsl:choose>
  136. <xsl:when test="text()">
  137. <xsl:apply-templates/>
  138. </xsl:when>
  139. <xsl:otherwise>
  140. <xsl:choose>
  141. <xsl:when test="//topic[@id=current()/@href]/@usetitle='no'">
  142. <xsl:value-of select="//topic[@id=current()/@href]/@id"/>
  143. </xsl:when>
  144. <xsl:otherwise>
  145. <xsl:value-of select="//topic[@id=current()/@href]/title/text()"/>
  146. </xsl:otherwise>
  147. </xsl:choose>
  148. </xsl:otherwise>
  149. </xsl:choose>
  150. </link></xsl:otherwise>
  151. </xsl:choose>
  152. </xsl:template>
  153. <!--SYNTAX-->
  154. <xsl:template match="txt">
  155. <xsl:if test="(ancestor::opt or ancestor::group or ancestor::define[@inline='yes'])=0 or position()!=1">
  156. <xsl:text> </xsl:text>
  157. </xsl:if>
  158. <b><xsl:value-of select="text()"/></b>
  159. <xsl:if test="(ancestor::opt or ancestor::group or ancestor::define[@inline='yes'])=0 or position()!=last()">
  160. <xsl:text> </xsl:text>
  161. </xsl:if>
  162. </xsl:template>
  163. <xsl:template match="define/variant">
  164. <xsl:apply-templates/>
  165. </xsl:template>
  166. <xsl:template match="b">
  167. <xsl:copy-of select="."/></xsl:template>
  168. <xsl:template match="i">
  169. <xsl:copy-of select="."/></xsl:template>
  170. <xsl:template match="nt">
  171. <xsl:if test="(ancestor::opt or ancestor::group)=0 or position()!=last()">
  172. <xsl:text> </xsl:text>
  173. </xsl:if>
  174. <xsl:choose>
  175. <xsl:when test="@name">
  176. <xsl:choose>
  177. <xsl:when test="id(@name)[@inline='yes']">
  178. <xsl:apply-templates select="id(@name)"/>
  179. </xsl:when>
  180. <xsl:otherwise>
  181. <xsl:text>&lt;</xsl:text>
  182. <!--link>
  183. <xsl:attribute name="href">
  184. <xsl:value-of select="@name"/>
  185. </xsl:attribute-->
  186. <xsl:value-of select="@name"/>
  187. <!--/link-->
  188. <xsl:text>&gt;</xsl:text>
  189. </xsl:otherwise>
  190. </xsl:choose>
  191. </xsl:when>
  192. <xsl:otherwise>
  193. <xsl:text>&lt;</xsl:text>
  194. <xsl:value-of select="text()"/>
  195. <xsl:text>&gt;</xsl:text>
  196. </xsl:otherwise>
  197. </xsl:choose>
  198. <xsl:if test="(ancestor::opt or ancestor::group)=0 or position()!=last()">
  199. <xsl:text> </xsl:text>
  200. </xsl:if>
  201. </xsl:template>
  202. <xsl:template match="opt">
  203. <xsl:if test="(ancestor::opt or ancestor::group)=0 or position()!=1">
  204. <xsl:text> </xsl:text>
  205. </xsl:if>
  206. <xsl:text>[</xsl:text>
  207. <xsl:apply-templates/>
  208. <xsl:text>]</xsl:text>
  209. <xsl:if test="@repeated='yes'">
  210. <xsl:text>...</xsl:text>
  211. </xsl:if>
  212. <xsl:if test="(ancestor::opt or ancestor::group)=0 or position()!=last()">
  213. <xsl:text> </xsl:text>
  214. </xsl:if>
  215. </xsl:template>
  216. <xsl:template match="define">
  217. <xsl:choose>
  218. <xsl:when test="@inline='yes'">
  219. <xsl:apply-templates/>
  220. </xsl:when>
  221. <xsl:otherwise>
  222. <xsl:choose>
  223. <xsl:when test="variant">
  224. <table>
  225. <tr>
  226. <td>
  227. <i><xsl:value-of select="@id"/>
  228. <xsl:text>:</xsl:text></i></td>
  229. <td>
  230. <xsl:apply-templates select="variant[position()=1]"/>
  231. </td>
  232. </tr>
  233. <xsl:for-each select="variant[position()!=1]">
  234. <tr>
  235. <td></td>
  236. <td><xsl:apply-templates/></td>
  237. </tr>
  238. </xsl:for-each>
  239. </table>
  240. <!-- NT DESCRIPTION -->
  241. <xsl:for-each select="description">
  242. <para><xsl:value-of select="text()"/></para>
  243. </xsl:for-each>
  244. </xsl:when>
  245. <xsl:otherwise>
  246. <table><tr><td><i><xsl:value-of select="@id"/><xsl:text>:</xsl:text></i>
  247. </td><td><xsl:apply-templates/></td></tr></table>
  248. </xsl:otherwise>
  249. </xsl:choose>
  250. </xsl:otherwise>
  251. </xsl:choose>
  252. </xsl:template>
  253. <xsl:template match="br">
  254. <br/>
  255. </xsl:template>
  256. <xsl:template match="case" name="fromcases">
  257. <xsl:if test="child::*[position()>1] or id(nt/@name)/@inline='yes'">
  258. <xsl:text>(</xsl:text>
  259. </xsl:if>
  260. <xsl:apply-templates/>
  261. <xsl:if test="child::*[position()>1] or id(nt/@name)/@inline='yes'">
  262. <xsl:text>)</xsl:text>
  263. </xsl:if>
  264. </xsl:template>
  265. <xsl:template match="cases">
  266. <xsl:for-each select="case[position()!=last()]">
  267. <xsl:call-template name="fromcases"/>
  268. <xsl:text> | </xsl:text>
  269. </xsl:for-each>
  270. <xsl:apply-templates select="case[position()=last()]"/>
  271. </xsl:template>
  272. <xsl:template match="group">
  273. <xsl:if test="(ancestor::opt or ancestor::group)=0 or position()!=1">
  274. <xsl:text> </xsl:text>
  275. </xsl:if>
  276. <xsl:text>(</xsl:text>
  277. <xsl:apply-templates/>
  278. <xsl:text>)</xsl:text>
  279. <xsl:if test="@repeated='yes'">
  280. <xsl:text>...</xsl:text>
  281. </xsl:if>
  282. <xsl:if test="(ancestor::opt or ancestor::group)=0 or position()!=last()">
  283. <xsl:text> </xsl:text>
  284. </xsl:if>
  285. </xsl:template>
  286. </xsl:stylesheet>