hts_ui.xslt 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: HTS
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0"
  9. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  10. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  11. xmlns:hts="http://developer.cognos.com/myinbox/common/hts_ui"
  12. exclude-result-prefixes="xts hts">
  13. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  14. <xsl:template match="hts:action">
  15. <xsl:apply-templates select="./*"/>
  16. </xsl:template>
  17. <xsl:template match="hts:actionlist">
  18. <table role="presentation">
  19. <tr>
  20. <xsl:for-each select="./hts:action">
  21. <td>
  22. <xsl:if test="./@id">
  23. <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
  24. </xsl:if>
  25. <xsl:if test="./@style">
  26. <xsl:attribute name="style"><xsl:value-of select="./@style"/></xsl:attribute>
  27. </xsl:if>
  28. <xsl:apply-templates select="."/>
  29. </td>
  30. </xsl:for-each>
  31. </tr>
  32. </table>
  33. </xsl:template>
  34. <xsl:template match="hts:button">
  35. <xsl:variable name="btncls">
  36. <xsl:choose>
  37. <xsl:when test="not(@nospace)"><xsl:text>cogstyle-layout-button-spacing</xsl:text></xsl:when>
  38. <xsl:otherwise><xsl:text>cogstyle-layout-button</xsl:text></xsl:otherwise>
  39. </xsl:choose>
  40. </xsl:variable>
  41. <xsl:variable name="useClass">
  42. <xsl:choose>
  43. <xsl:when test="not(@class)">htsButton</xsl:when>
  44. <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
  45. </xsl:choose>
  46. </xsl:variable>
  47. <xsl:variable name="useType">
  48. <xsl:choose>
  49. <xsl:when test="string(@type)='reset' or string(@type)='submit'"><xsl:value-of select="@type"/></xsl:when>
  50. <xsl:otherwise>button</xsl:otherwise>
  51. </xsl:choose>
  52. </xsl:variable>
  53. <div class="{$btncls}">
  54. <input role="button" class="{$useClass}" type="{$useType}" onmouseout="javascript:this.className='htsButton'" onmouseover="javascript:this.className='htsButtonMouseOver'">
  55. <xsl:copy-of select="@*[name()!='type' and name()!='class']"/>
  56. <xsl:attribute name="value"><xsl:apply-templates select="./hts:value"/></xsl:attribute>
  57. </input>
  58. </div>
  59. </xsl:template>
  60. <xsl:template match="hts:column">
  61. <xsl:variable name="pcnt" select="floor(100 div (count(following-sibling::hts:column) + count(preceding-sibling::hts:column) + 1))"/>
  62. <td width="{$pcnt}%">
  63. <xsl:apply-templates select="./*"/>
  64. </td>
  65. </xsl:template>
  66. <xsl:template match="hts:columnset">
  67. <div class="cogstyle-layout-column-set">
  68. <table width="100%" role="presentation">
  69. <tr class="cogstyle-layout-column">
  70. <xsl:apply-templates select="./*"/>
  71. </tr>
  72. </table>
  73. </div>
  74. </xsl:template>
  75. <xsl:template match="hts:field">
  76. <xsl:variable name="useFieldSR">
  77. <xsl:apply-templates select="./hts:keyscript"/>
  78. </xsl:variable>
  79. <xsl:variable name="fId">
  80. <xsl:choose>
  81. <xsl:when test="contains(string(@id),'_THIS_')">
  82. <xsl:value-of select="@id"/>
  83. </xsl:when>
  84. <xsl:otherwise><xsl:value-of select="concat('_THIS_',@id)"/></xsl:otherwise>
  85. </xsl:choose>
  86. </xsl:variable>
  87. <xsl:variable name="fValue">
  88. <xsl:choose>
  89. <xsl:when test="./*[name()='hts:text']">
  90. <xsl:apply-templates select="./*[name()='hts:text']"/>
  91. </xsl:when>
  92. <xsl:when test="./*[name()='hts:value']">
  93. <xsl:apply-templates select="./*[name()='hts:value']"/>
  94. </xsl:when>
  95. </xsl:choose>
  96. </xsl:variable>
  97. <xsl:variable name="useClass">
  98. <xsl:choose>
  99. <xsl:when test="@class"><xsl:value-of select="@class"/></xsl:when>
  100. <xsl:otherwise>portlet-form-input-field</xsl:otherwise>
  101. </xsl:choose>
  102. </xsl:variable>
  103. <div class="cogstyle-layout-field"><xsl:text/>
  104. <xsl:if test="not(./hts:label)"><xsl:apply-templates select="./hts:hint"/></xsl:if>
  105. <xsl:apply-templates select="./hts:label">
  106. <xsl:with-param name="forParam" select="string($fId)"/>
  107. </xsl:apply-templates>
  108. <xsl:choose>
  109. <xsl:when test="@type='textarea'">
  110. <xsl:variable name="fRows">
  111. <xsl:choose>
  112. <xsl:when test="@rows"><xsl:value-of select="@rows"/></xsl:when>
  113. <xsl:otherwise>10</xsl:otherwise>
  114. </xsl:choose>
  115. </xsl:variable>
  116. <xsl:variable name="fCols">
  117. <xsl:choose>
  118. <xsl:when test="@cols"><xsl:value-of select="@cols"/></xsl:when>
  119. <xsl:otherwise>80</xsl:otherwise>
  120. </xsl:choose>
  121. </xsl:variable>
  122. <table cellpadding="0" cellspacing="0" class="cogstyle-layout-wide" role="presentation">
  123. <tr>
  124. <td>
  125. <textarea role="textbox" aria-multiline="true" class="{$useClass}">
  126. <xsl:copy-of select="@*[name()!='id' and name()!='name' and name()!='rows' and name()!='cols' and name()!='class']"/>
  127. <xsl:if test="@id">
  128. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  129. </xsl:if>
  130. <xsl:if test="@name">
  131. <xsl:attribute name="name"><xsl:value-of select="concat('_THIS_',@name)"/></xsl:attribute>
  132. </xsl:if>
  133. <xsl:attribute name="rows"><xsl:value-of select="$fRows"/></xsl:attribute>
  134. <xsl:attribute name="cols"><xsl:value-of select="$fCols"/></xsl:attribute>
  135. <xsl:if test="$useFieldSR != ''">
  136. <xsl:attribute name="onkeypress"><xsl:value-of select="$useFieldSR"/></xsl:attribute>
  137. </xsl:if>
  138. <xsl:text/><xsl:value-of select="$fValue"/><xsl:text/>
  139. </textarea>
  140. </td>
  141. </tr>
  142. <xsl:if test="./hts:action">
  143. <tr>
  144. <td class="cogstyle-layout-action-list"><xsl:apply-templates select="./hts:action"/></td>
  145. </tr>
  146. </xsl:if>
  147. <xsl:if test="./hts:actionlist">
  148. <tr>
  149. <td class="cogstyle-layout-action-list"><xsl:apply-templates select="./hts:actionlist"/></td>
  150. </tr>
  151. </xsl:if>
  152. </table>
  153. </xsl:when>
  154. <xsl:otherwise>
  155. <table cellpadding="0" cellspacing="0" role="presentation">
  156. <tr>
  157. <td>
  158. <input class="{$useClass}">
  159. <xsl:copy-of select="@*[name()!='id' and name()!='name' and name()!='class']"/>
  160. <xsl:if test="@id">
  161. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  162. </xsl:if>
  163. <xsl:if test="@name">
  164. <xsl:attribute name="name"><xsl:value-of select="concat('_THIS_',@name)"/></xsl:attribute>
  165. </xsl:if>
  166. <xsl:attribute name="value">
  167. <xsl:value-of select="$fValue"/>
  168. </xsl:attribute>
  169. <xsl:if test="$useFieldSR != ''">
  170. <xsl:attribute name="onkeypress"><xsl:value-of select="$useFieldSR"/></xsl:attribute>
  171. </xsl:if>
  172. <xsl:if test="@type='text'">
  173. <xsl:attribute name="role"><xsl:text>textbox</xsl:text></xsl:attribute>
  174. <xsl:attribute name="aria-multiline"><xsl:text>false</xsl:text></xsl:attribute>
  175. </xsl:if>
  176. </input>
  177. </td>
  178. </tr>
  179. </table>
  180. </xsl:otherwise>
  181. </xsl:choose>
  182. </div>
  183. </xsl:template>
  184. <xsl:template match="hts:form">
  185. <form role="form">
  186. <xsl:copy-of select="@*"/>
  187. <xsl:apply-templates select="hts:section[@format='header']"/>
  188. <div class="cogstyle-layout-on-form">
  189. <xsl:apply-templates select="*[not((name()='hts:section' and string(@format)='header')or (name()='hts:section' and string(@format)='footer'))]"/>
  190. </div>
  191. <xsl:apply-templates select="hts:section[@format='footer']"/>
  192. </form>
  193. </xsl:template>
  194. <xsl:template match="hts:hidden">
  195. <xsl:call-template name="createHiddenField">
  196. <xsl:with-param name="chfName" select="@name"/>
  197. <xsl:with-param name="chfValue" select="@value"/>
  198. <xsl:with-param name="chfId" select="@id"/>
  199. </xsl:call-template>
  200. </xsl:template>
  201. <xsl:template match="hts:hint">
  202. <xsl:if test="string(.)!=''">
  203. <xsl:if test="not(parent::hts:label)"><xsl:text disable-output-escaping="yes">&lt;table&gt;</xsl:text></xsl:if>
  204. <tr>
  205. <td class="cogstyle-layout-hint">
  206. <div class="portlet-msg-info" role="note">
  207. <xsl:choose>
  208. <xsl:when test="./hts:text">
  209. <xsl:apply-templates select="./*"/>
  210. </xsl:when>
  211. <xsl:otherwise>
  212. <xsl:value-of select="string(.)"/>
  213. </xsl:otherwise>
  214. </xsl:choose>
  215. </div>
  216. </td>
  217. </tr>
  218. <xsl:if test="not(parent::hts:label)"><xsl:text disable-output-escaping="yes">&lt;/table&gt;</xsl:text></xsl:if>
  219. </xsl:if>
  220. </xsl:template>
  221. <xsl:template match="hts:img">
  222. <img>
  223. <xsl:if test="not(@role)">
  224. <xsl:attribute name="role">
  225. <xsl:text>img</xsl:text>
  226. </xsl:attribute>
  227. </xsl:if>
  228. <xsl:copy-of select="@*"/>
  229. <xsl:apply-templates select="./*"/>
  230. </img>
  231. </xsl:template>
  232. <xsl:template match="hts:faded">
  233. <xsl:attribute name="class">cogstyle-img-faded</xsl:attribute>
  234. </xsl:template>
  235. <xsl:template match="hts:keyscript">
  236. <xsl:value-of select="."/>
  237. </xsl:template>
  238. <xsl:template match="hts:label">
  239. <xsl:param name="forParam" select="''"/>
  240. <xsl:if test="string(.)!=''">
  241. <xsl:variable name="labelclass">
  242. <xsl:choose>
  243. <xsl:when test="not(ancestor::hts:rcsection) and string(@divider)='true'">cogstyle-layout-divider-label</xsl:when>
  244. <xsl:when test="not(ancestor::hts:rcsection)">cogstyle-layout-label</xsl:when>
  245. <xsl:otherwise>cogstyle-layout-label-in-control</xsl:otherwise>
  246. </xsl:choose>
  247. </xsl:variable>
  248. <xsl:variable name="forID">
  249. <xsl:choose>
  250. <xsl:when test="@for"><xsl:value-of select="@for"/></xsl:when>
  251. <xsl:otherwise><xsl:value-of select="$forParam"/></xsl:otherwise>
  252. </xsl:choose>
  253. </xsl:variable>
  254. <table class="cogstyle-layout-wide" cellpadding="0" cellspacing="0">
  255. <xsl:choose>
  256. <xsl:when test="string(@divider)='true'">
  257. <tr>
  258. <td class="{$labelclass}">
  259. <div class="portlet-form-field-label">
  260. <xsl:if test="$forID != ''"><xsl:text disable-output-escaping="yes">&lt;label for=&quot;</xsl:text><xsl:value-of select="$forID"/><xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text></xsl:if>
  261. <xsl:apply-templates select="hts:text"/>
  262. <xsl:if test="$forID != ''"><xsl:text disable-output-escaping="yes">&lt;/label&gt;</xsl:text></xsl:if>
  263. </div>
  264. </td>
  265. <td class="cogstyle-layout-divider"><div class="cogstyle-layout-divider-line"></div></td>
  266. </tr>
  267. <xsl:if test="./hts:hint">
  268. <tr>
  269. <td colspan="2"><table cellspacing="0"><xsl:apply-templates select="./hts:hint"/></table></td>
  270. </tr>
  271. </xsl:if>
  272. </xsl:when>
  273. <xsl:otherwise>
  274. <xsl:variable name="labelClass">
  275. <xsl:choose>
  276. <xsl:when test="count(preceding-sibling::hts:label)=0"><xsl:value-of select="$labelclass"/></xsl:when>
  277. <xsl:otherwise>cogstyle-layout-sub-label</xsl:otherwise>
  278. </xsl:choose>
  279. </xsl:variable>
  280. <tr>
  281. <td>
  282. <xsl:attribute name="class"><xsl:value-of select="$labelClass"/></xsl:attribute>
  283. <div class="portlet-form-field-label">
  284. <!--xsl:if test="$forID != ''"><xsl:text disable-output-escaping="yes">&lt;label for=&quot;</xsl:text><xsl:value-of select="$forID"/><xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text></xsl:if-->
  285. <xsl:apply-templates select="./hts:text"/>
  286. <!--xsl:if test="$forID != ''"><xsl:text disable-output-escaping="yes">&lt;/label&gt;</xsl:text></xsl:if-->
  287. </div>
  288. </td>
  289. </tr>
  290. <xsl:if test="./hts:hint">
  291. <xsl:apply-templates select="./hts:hint"/>
  292. </xsl:if>
  293. </xsl:otherwise>
  294. </xsl:choose>
  295. </table>
  296. </xsl:if>
  297. </xsl:template>
  298. <xsl:template match="hts:link">
  299. <xsl:variable name="linkClass">
  300. <xsl:choose>
  301. <xsl:when test="ancestor::hts:text[@format='hasLink']">cogstyle-layout-link-inplace</xsl:when>
  302. <xsl:when test="parent::hts:action">cogstyle-layout-link-action</xsl:when>
  303. <xsl:when test="parent::hts:section[@format='dynamicexpand']">cogstyle-layout-link-expand</xsl:when>
  304. <xsl:otherwise>cogstyle-layout-link</xsl:otherwise>
  305. </xsl:choose>
  306. </xsl:variable>
  307. <xsl:variable name="tabindex"><xsl:if test="./@tabindex"><xsl:value-of select="./@tabindex"/></xsl:if></xsl:variable>
  308. <xsl:text/><div>
  309. <!--xsl:if test="$tabindex != ''">
  310. <xsl:attribute name="tabindex"><xsl:value-of select="$tabindex"/></xsl:attribute>
  311. </xsl:if-->
  312. <xsl:attribute name="class"><xsl:value-of select="$linkClass"/></xsl:attribute>
  313. <!--xsl:if test="./@id">
  314. <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
  315. </xsl:if-->
  316. <a class="cognos-anchor">
  317. <xsl:choose>
  318. <xsl:when test="@role!=''"><xsl:copy-of select="@role"/></xsl:when>
  319. <xsl:otherwise><xsl:attribute name="role"><xsl:text>link</xsl:text></xsl:attribute></xsl:otherwise>
  320. </xsl:choose>
  321. <!--xsl:if test="parent::hts:section[@format='dynamicexpand']">
  322. <xsl:attribute name="aria-expanded"><xsl:text>false</xsl:text></xsl:attribute>
  323. </xsl:if-->
  324. <xsl:copy-of select="@*[not(self::id)]"/>
  325. <xsl:text/><xsl:value-of select="string(.)"/><xsl:text/>
  326. </a>
  327. </div><xsl:text/>
  328. </xsl:template>
  329. <xsl:template match="hts:link[@type='button']">
  330. <xsl:variable name="btncls">
  331. <xsl:choose>
  332. <xsl:when test="not(@nospace)"><xsl:text>cogstyle-layout-button-spacing</xsl:text></xsl:when>
  333. <xsl:otherwise><xsl:text>cogstyle-layout-button</xsl:text></xsl:otherwise>
  334. </xsl:choose>
  335. </xsl:variable>
  336. <xsl:variable name="display">
  337. <xsl:if test="./@display"><xsl:value-of select="./@display"/></xsl:if>
  338. </xsl:variable>
  339. <xsl:text/>
  340. <div class="{$btncls}" style="display:{$display}">
  341. <xsl:if test="./@id">
  342. <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
  343. </xsl:if>
  344. <a role="button" class="portlet-form-button taskOptionButtons" onmouseout="javascript:this.className='taskOptionButtonsMouseOut taskOptionButtons'" onmouseover="javascript:this.className='taskOptionButtonsMouseOver taskOptionButtons'">
  345. <xsl:copy-of select="@*[not(self::id)]"/>
  346. <xsl:apply-templates select="./*[not(./@disabled='true')]"/>
  347. </a>
  348. </div>
  349. <div class="{$btncls}" style="display:none;'">
  350. <xsl:if test="./@id">
  351. <xsl:attribute name="id"><xsl:value-of select="./@id"/>_disabled</xsl:attribute>
  352. </xsl:if>
  353. <span class="portlet-form-button taskOptionButtons_hidden" onmouseover="javascript:this.className='taskOptionButtons_hiddenMouseOver taskOptionButtons_hidden'">
  354. <xsl:apply-templates select="./*[local-name() = 'value' or @disabled='true']"/>
  355. </span>
  356. </div>
  357. <xsl:text/>
  358. </xsl:template>
  359. <xsl:template match="hts:separator">
  360. <xsl:if test="./@type = 'vertical'">
  361. <div style="border-right-color: rgb(153,153,153);border-right-style: solid;border-right-width: 1px;height: 24px;padding-left: 10px;"/>
  362. </xsl:if>
  363. <xsl:if test="./@type = 'horizontal'">
  364. <xsl:variable name="width">
  365. <xsl:choose>
  366. <xsl:when test="./@width"><xsl:value-of select="./@width"/></xsl:when>
  367. <xsl:otherwise>5px</xsl:otherwise>
  368. </xsl:choose>
  369. </xsl:variable>
  370. <img role="separator" src="_THIS?frag-resource=/fragments/common/images/space.gif/THIS_" alt="" height="0px" width="{$width}"/>
  371. </xsl:if>
  372. </xsl:template>
  373. <xsl:template match="hts:option">
  374. <xsl:choose>
  375. <xsl:when test="parent::hts:select or parent::hts:optgroup">
  376. <option role="option">
  377. <xsl:copy-of select="@*"/>
  378. <xsl:value-of select="string(.)"/>
  379. </option>
  380. </xsl:when>
  381. </xsl:choose>
  382. </xsl:template>
  383. <xsl:template match="hts:optgroup">
  384. <xsl:choose>
  385. <xsl:when test="parent::hts:select">
  386. <optgroup label="{@label}">
  387. <xsl:apply-templates select="./*"/>
  388. </optgroup>
  389. </xsl:when>
  390. </xsl:choose>
  391. </xsl:template>
  392. <xsl:template match="hts:radio | hts:checkbox">
  393. <xsl:variable name="useRadioSR">
  394. <xsl:apply-templates select="./hts:keyscript"/>
  395. </xsl:variable>
  396. <xsl:variable name="rc" select="substring-after(string(name()),':')"/>
  397. <xsl:if test="(($rc='radio' and count(preceding-sibling::hts:radio)=0) or ($rc='checkbox' and count(preceding-sibling::hts:checkbox)=0))">
  398. <xsl:text disable-output-escaping="yes">&lt;table role=&quot;presentation&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;</xsl:text>
  399. </xsl:if>
  400. <xsl:variable name="fId">
  401. <xsl:choose>
  402. <xsl:when test="string(@id)='' or string(@id) = '_THIS_'">
  403. <xsl:value-of select="concat('_THIS_',generate-id())"/>
  404. </xsl:when>
  405. <xsl:when test="contains(string(@id),'_THIS_')">
  406. <xsl:value-of select="@id"/>
  407. </xsl:when>
  408. <xsl:otherwise>
  409. <xsl:value-of select="concat('_THIS_',@id)"/>
  410. </xsl:otherwise>
  411. </xsl:choose>
  412. </xsl:variable>
  413. <tr>
  414. <td class="cogstyle-layout-radio-chkbox-control">
  415. <input type="{$rc}" name="{@name}">
  416. <xsl:copy-of select="@*[name()!='id' and name()!='class' and name()!='selected']"/>
  417. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  418. <xsl:if test="string(@selected)='true'">
  419. <xsl:attribute name="checked">checked</xsl:attribute>
  420. </xsl:if>
  421. <xsl:attribute name="role">
  422. <xsl:choose>
  423. <xsl:when test="$rc='radio'"><xsl:text>radio</xsl:text></xsl:when>
  424. <xsl:otherwise><xsl:text>checkbox</xsl:text></xsl:otherwise>
  425. </xsl:choose>
  426. </xsl:attribute>
  427. <xsl:if test="$useRadioSR != ''">
  428. <xsl:attribute name="onclick"><xsl:value-of select="$useRadioSR"/></xsl:attribute>
  429. <xsl:attribute name="onkeypress"><xsl:value-of select="$useRadioSR"/></xsl:attribute>
  430. </xsl:if>
  431. <xsl:attribute name="value"><xsl:apply-templates select="hts:value"/></xsl:attribute>
  432. </input>
  433. </td>
  434. <td class="cogstyle-layout-radio-chkbox-text"><label for="{$fId}" class="portlet-form-field"><xsl:apply-templates select="./hts:text"/></label></td>
  435. </tr>
  436. <xsl:if test="hts:rcsection">
  437. <tr>
  438. <td><br/></td>
  439. <td class="cogstyle-layout-in-radio-chkbox">
  440. <xsl:apply-templates select="./hts:rcsection"/>
  441. </td>
  442. </tr>
  443. </xsl:if>
  444. <xsl:if test="(($rc='radio' and count(following-sibling::hts:radio)=0) or ($rc='checkbox' and count(following-sibling::hts:checkbox)=0))">
  445. <xsl:text disable-output-escaping="yes">&lt;/table&gt;</xsl:text>
  446. </xsl:if>
  447. </xsl:template>
  448. <xsl:template match="hts:rcsection">
  449. <div role="radiogroup"><xsl:apply-templates select="./*"/></div>
  450. </xsl:template>
  451. <xsl:template match="hts:rowset">
  452. <div class="cogstyle-layout-row">
  453. <xsl:variable name="rowFormat"><xsl:if test="@format"><xsl:value-of select="concat('cogstyle-layout-row-',@format)"/></xsl:if></xsl:variable>
  454. <xsl:variable name="width"><xsl:if test="@width"><xsl:value-of select="@width"/></xsl:if></xsl:variable>
  455. <xsl:variable name="cellpadding">
  456. <xsl:choose>
  457. <xsl:when test="./@cellpadding"><xsl:value-of select="./@cellpadding"/></xsl:when>
  458. <xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise>
  459. </xsl:choose>
  460. </xsl:variable>
  461. <xsl:variable name="cellspacing">
  462. <xsl:choose>
  463. <xsl:when test="./@cellspacing"><xsl:value-of select="./@cellspacing"/></xsl:when>
  464. <xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise>
  465. </xsl:choose>
  466. </xsl:variable>
  467. <table cellpadding="{$cellpadding}" cellspacing="{$cellspacing}" role="presentation">
  468. <xsl:if test="$rowFormat != ''">
  469. <xsl:attribute name="class"><xsl:value-of select="$rowFormat"/></xsl:attribute>
  470. </xsl:if>
  471. <xsl:if test="$width != ''">
  472. <xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
  473. </xsl:if>
  474. <xsl:apply-templates select="./*"/>
  475. </table>
  476. </div>
  477. </xsl:template>
  478. <xsl:template match="hts:row">
  479. <tr>
  480. <xsl:for-each select="./child::node()">
  481. <xsl:variable name="colspan"><xsl:if test="./@colspan"><xsl:value-of select="./@colspan"/></xsl:if></xsl:variable>
  482. <xsl:variable name="width"><xsl:if test="./@width"><xsl:value-of select="./@width"/></xsl:if></xsl:variable>
  483. <xsl:variable name="nowrap"><xsl:if test="./@nowrap"><xsl:value-of select="./@nowrap"/></xsl:if></xsl:variable>
  484. <!--xsl:variable name="tabindex"><xsl:if test="./@tabindex"><xsl:value-of select="./@tabindex"/></xsl:if></xsl:variable-->
  485. <xsl:variable name="class">
  486. <xsl:choose>
  487. <xsl:when test="./@class"><xsl:value-of select="./@class"/></xsl:when>
  488. <xsl:otherwise><xsl:value-of select="'cogstyle-layout-rows'"/></xsl:otherwise>
  489. </xsl:choose>
  490. </xsl:variable>
  491. <td class="{$class}">
  492. <xsl:if test="$colspan != ''">
  493. <xsl:attribute name="colspan"><xsl:value-of select="$colspan"/></xsl:attribute>
  494. </xsl:if>
  495. <xsl:if test="$width != ''">
  496. <xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
  497. </xsl:if>
  498. <xsl:if test="$nowrap != ''">
  499. <xsl:attribute name="nowrap"><xsl:value-of select="$nowrap"/></xsl:attribute>
  500. </xsl:if>
  501. <!--xsl:if test="$tabindex != ''">
  502. <xsl:attribute name="tabindex"><xsl:value-of select="$tabindex"/></xsl:attribute>
  503. </xsl:if-->
  504. <div class="portlet-form-field">
  505. <xsl:apply-templates select="."/>
  506. </div>
  507. </td>
  508. </xsl:for-each>
  509. </tr>
  510. </xsl:template>
  511. <xsl:template match="hts:row[@format='header']">
  512. <xsl:variable name="rowClass"><xsl:if test="./@class"><xsl:value-of select="./@class"/></xsl:if></xsl:variable>
  513. <tr>
  514. <xsl:if test="$rowClass != ''">
  515. <xsl:attribute name="class"><xsl:value-of select="$rowClass"/></xsl:attribute>
  516. </xsl:if>
  517. <xsl:for-each select="./child::node()">
  518. <xsl:variable name="colspan"><xsl:if test="./@colspan"><xsl:value-of select="./@colspan"/></xsl:if></xsl:variable>
  519. <xsl:variable name="width"><xsl:if test="./@width"><xsl:value-of select="./@width"/></xsl:if></xsl:variable>
  520. <th>
  521. <xsl:if test="$colspan != ''">
  522. <xsl:attribute name="colspan"><xsl:value-of select="$colspan"/></xsl:attribute>
  523. </xsl:if>
  524. <xsl:if test="$width != ''">
  525. <xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
  526. </xsl:if>
  527. <div class="portlet-form-field">
  528. <xsl:apply-templates select="."/>
  529. </div>
  530. </th>
  531. </xsl:for-each>
  532. </tr>
  533. </xsl:template>
  534. <xsl:template match="hts:script">
  535. <xsl:variable name="stype">
  536. <xsl:choose>
  537. <xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
  538. <xsl:otherwise>text/javascript</xsl:otherwise>
  539. </xsl:choose>
  540. </xsl:variable>
  541. <script type="{string($stype)}">
  542. <xsl:copy-of select="./child::node()"/>
  543. </script>
  544. </xsl:template>
  545. <xsl:template match="hts:section[@format='dynamicexpand']">
  546. <xsl:variable name="deVu">
  547. <xsl:choose>
  548. <xsl:when test="string(@defaultview)!='' and string(@defaultview)!='none'">cogstyle-layout-dynamic-expand</xsl:when>
  549. <xsl:otherwise>cogstyle-layout-dynamic-collapse</xsl:otherwise>
  550. </xsl:choose>
  551. </xsl:variable>
  552. <xsl:variable name="deVuCollapsed">
  553. <xsl:if test="./hts:dynamicareacollapsed">
  554. <xsl:choose>
  555. <xsl:when test="$deVu = 'cogstyle-layout-dynamic-collapse'">cogstyle-layout-dynamic-expand</xsl:when>
  556. <xsl:otherwise>cogstyle-layout-dynamic-collapse</xsl:otherwise>
  557. </xsl:choose>
  558. </xsl:if>
  559. </xsl:variable>
  560. <xsl:variable name="cId">
  561. <xsl:if test="@id">
  562. <xsl:choose>
  563. <xsl:when test="contains(string(@id),'_THIS_')">
  564. <xsl:value-of select="@id"/>
  565. </xsl:when>
  566. <xsl:otherwise><xsl:value-of select="concat('_THIS_',@id)"/></xsl:otherwise>
  567. </xsl:choose>
  568. </xsl:if>
  569. </xsl:variable>
  570. <xsl:variable name="cName" select="@name"/>
  571. <xsl:apply-templates select="./hts:script"/>
  572. <table cellpadding="0" cellspacing="0" class="cogstyle-layout-wide" role="presentation">
  573. <tr>
  574. <td class="cogstyle-layout-label">
  575. <xsl:apply-templates select="./hts:link"/>
  576. <xsl:apply-templates select="./hts:img"/>
  577. </td>
  578. </tr>
  579. <xsl:if test="./hts:hint">
  580. <tr>
  581. <td>
  582. <xsl:apply-templates select="./hts:hint"/>
  583. </td>
  584. </tr>
  585. </xsl:if>
  586. </table>
  587. <div>
  588. <xsl:attribute name="class"><xsl:value-of select="$deVu"/></xsl:attribute>
  589. <xsl:attribute name="id"><xsl:value-of select="$cId"/></xsl:attribute>
  590. <xsl:attribute name="name"><xsl:value-of select="$cName"/></xsl:attribute>
  591. <xsl:apply-templates select="./hts:dynamicarea/*"/>
  592. </div>
  593. <xsl:if test="./hts:dynamicareacollapsed">
  594. <div>
  595. <xsl:attribute name="class"><xsl:value-of select="$deVuCollapsed"/></xsl:attribute>
  596. <xsl:attribute name="id"><xsl:value-of select="$cId"/>_collapsed</xsl:attribute>
  597. <xsl:attribute name="name"><xsl:value-of select="$cName"/>_collapsed</xsl:attribute>
  598. <xsl:apply-templates select="./hts:dynamicareacollapsed/*"/>
  599. </div>
  600. </xsl:if>
  601. </xsl:template>
  602. <xsl:template match="hts:section[@format='header']">
  603. <table width="100%" role="presentation">
  604. <tr>
  605. <td width="100%"><div class="portlet-msg-info"><xsl:apply-templates select="./hts:text"/></div></td>
  606. <xsl:if test="./hts:action or ./hts:actionlist">
  607. <td class="cogstyle-layout-action-list"><xsl:apply-templates select="./hts:action | ./hts:actionlist"/></td>
  608. </xsl:if>
  609. </tr>
  610. </table>
  611. </xsl:template>
  612. <xsl:template match="hts:section[@format='select-locale']">
  613. <xsl:apply-templates select="./hts:script"/>
  614. <xsl:apply-templates select="./hts:hidden"/>
  615. <xsl:choose>
  616. <xsl:when test="string(@divider)='true'">
  617. <xsl:text disable-output-escaping="yes">&lt;div class=&quot;cogstyle-layout-divider-line&quot;&gt;</xsl:text>
  618. <xsl:if test="./hts:label">
  619. <div class="cogstyle-layout-select-locale-label"><xsl:apply-templates select="./hts:label"/></div>
  620. </xsl:if>
  621. </xsl:when>
  622. <xsl:otherwise>
  623. <div class="cogstyle-layout-select-locale-label"><xsl:apply-templates select="./hts:label"/></div>
  624. </xsl:otherwise>
  625. </xsl:choose>
  626. <table cellpadding="0" cellspacing="0">
  627. <tr>
  628. <td class="cogstyle-layout-select-locale-row">
  629. <div class="cogstyle-layout-select-locale">
  630. <xsl:apply-templates select="./hts:select"/>
  631. </div>
  632. <div class="cogstyle-layout-select-locale-text">
  633. <a class="cognos-anchor" href="#">
  634. <xsl:attribute name="onclick"><xsl:value-of select="./hts:removelocaleaction"/></xsl:attribute>
  635. <xsl:text/><xts:string id="IDS_PROP_REMOVE_LANGUAGE_TEXT"/><xsl:text/>
  636. </a>
  637. </div>
  638. </td>
  639. </tr>
  640. </table>
  641. <xsl:if test="string(@divider)='true'">
  642. <xsl:text disable-output-escaping="yes">&lt;/div&gt;</xsl:text>
  643. </xsl:if>
  644. </xsl:template>
  645. <xsl:template match="hts:section[@format='division']">
  646. <table>
  647. <tr>
  648. <xsl:if test="./hts:label">
  649. <td class="cogstyle-layout-divider-label">
  650. <div class="portlet-form-field-label">
  651. <xsl:apply-templates select="./hts:label/hts:text"/>
  652. </div>
  653. </td>
  654. </xsl:if>
  655. <td class="cogstyle-layout-divider"><div class="cogstyle-layout-divider-line"></div></td>
  656. </tr>
  657. </table>
  658. <div><xsl:apply-templates select="./*[not(name()='hts:label')]"/></div>
  659. </xsl:template>
  660. <xsl:template match="hts:section">
  661. <xsl:variable name="style" select="@style"/>
  662. <xsl:variable name="inRC" select="preceding-sibling::*[name()='hts:radio' or name()='hts:checkbox']"/>
  663. <xsl:variable name="rsFormat"><xsl:if test="@format"><xsl:value-of select="concat('-',@format)"/></xsl:if></xsl:variable>
  664. <xsl:variable name="cls">
  665. <xsl:choose>
  666. <xsl:when test="not(@class)">cogstyle-layout-section<xsl:value-of select="$rsFormat"/></xsl:when>
  667. <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
  668. </xsl:choose>
  669. </xsl:variable>
  670. <xsl:variable name="fId">
  671. <xsl:if test="@id">
  672. <xsl:choose>
  673. <xsl:when test="contains(string(@id),'_THIS_')"><xsl:value-of select="@id"/></xsl:when>
  674. <xsl:otherwise><xsl:value-of select="concat('_THIS_',@id)"/></xsl:otherwise>
  675. </xsl:choose>
  676. </xsl:if>
  677. </xsl:variable>
  678. <xsl:if test="$inRC">
  679. <xsl:text disable-output-escaping="yes">
  680. &lt;tr&gt;&lt;td&gt;&lt;br/&gt;&lt;td&gt;
  681. </xsl:text>
  682. </xsl:if>
  683. <xsl:choose>
  684. <xsl:when test="string(@divider)='true'">
  685. <div class="cogstyle-layout-divider-line">
  686. <xsl:if test="$style != ''">
  687. <xsl:attribute name="style"><xsl:value-of select="$style"/></xsl:attribute>
  688. </xsl:if>
  689. <xsl:if test="$fId != ''">
  690. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  691. </xsl:if>
  692. <xsl:if test="./hts:hint">
  693. <div><xsl:apply-templates select="./hts:hint"/></div>
  694. </xsl:if>
  695. <div class="{$cls}"><xsl:apply-templates select="./*[not(name()='hts:hint')]"/></div>
  696. </div>
  697. </xsl:when>
  698. <xsl:otherwise>
  699. <div class="{$cls}">
  700. <xsl:if test="$style != ''">
  701. <xsl:attribute name="style"><xsl:value-of select="$style"/></xsl:attribute>
  702. </xsl:if>
  703. <xsl:if test="$fId != ''">
  704. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  705. </xsl:if>
  706. <xsl:if test="./hts:hint">
  707. <div><xsl:apply-templates select="./hts:hint"/></div>
  708. </xsl:if>
  709. <xsl:apply-templates select="./*[not(name()='hts:hint')]"/>
  710. </div>
  711. </xsl:otherwise>
  712. </xsl:choose>
  713. <xsl:if test="$inRC">
  714. <xsl:text disable-output-escaping="yes">
  715. &lt;/td&gt;&lt;/tr&gt;
  716. </xsl:text>
  717. </xsl:if>
  718. </xsl:template>
  719. <xsl:template match="hts:select">
  720. <xsl:variable name="useSelectSR">
  721. <xsl:apply-templates select="./hts:keyscript"/>
  722. </xsl:variable>
  723. <xsl:variable name="fId">
  724. <xsl:choose>
  725. <xsl:when test="contains(string(@id),'_THIS_')">
  726. <xsl:value-of select="@id"/>
  727. </xsl:when>
  728. <xsl:otherwise><xsl:value-of select="concat('_THIS_',string(@id))"/></xsl:otherwise>
  729. </xsl:choose>
  730. </xsl:variable>
  731. <xsl:if test="./hts:label">
  732. <xsl:apply-templates select="./hts:label"/>
  733. </xsl:if>
  734. <xsl:if test="not(parent::hts:section[@format='select-locale'])">
  735. <xsl:text disable-output-escaping="yes">&lt;table role=&quot;presentation&quot; width=&quot;100%&quot;&gt;
  736. &lt;tr&gt;
  737. &lt;td&gt;</xsl:text>
  738. </xsl:if>
  739. <select role="listbox">
  740. <xsl:copy-of select="@*[name()!='id' and name()!='name']"/>
  741. <xsl:if test="@id">
  742. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  743. </xsl:if>
  744. <xsl:if test="@name">
  745. <xsl:attribute name="name"><xsl:value-of select="concat('_THIS_',string(@name))"/></xsl:attribute>
  746. </xsl:if>
  747. <xsl:if test="$useSelectSR != ''">
  748. <xsl:attribute name="onchange"><xsl:value-of select="$useSelectSR"/></xsl:attribute>
  749. </xsl:if>
  750. <xsl:choose>
  751. <xsl:when test="./hts:option">
  752. <xsl:apply-templates select="./hts:option | ./hts:optgroup"/>
  753. </xsl:when>
  754. <xsl:when test="./option">
  755. <xsl:copy-of select="./*[name()='option'] | ./*[name()='optgroup']"/>
  756. </xsl:when>
  757. </xsl:choose>
  758. </select>
  759. <xsl:if test="not(parent::hts:section[@format='select-locale'])"><xsl:text disable-output-escaping="yes">
  760. &lt;/td&gt;
  761. &lt;/tr&gt;
  762. &lt;/table&gt;</xsl:text>
  763. </xsl:if>
  764. </xsl:template>
  765. <xsl:template match="hts:text | hts:value">
  766. <xsl:choose>
  767. <xsl:when test="@label-for != ''">
  768. <label for="{@label-for}"><xsl:text/><xsl:value-of select="string(.)"/><xsl:text/></label>
  769. </xsl:when>
  770. <xsl:when test="@format='hasLink'">
  771. <xsl:apply-templates select="*|text()"/>
  772. </xsl:when>
  773. <xsl:otherwise>
  774. <xsl:text/><xsl:value-of select="string(.)"/><xsl:text/>
  775. </xsl:otherwise>
  776. </xsl:choose>
  777. </xsl:template>
  778. <xsl:template match="hts:span">
  779. <span role="presentation">
  780. <xsl:copy-of select="@*"/>
  781. <xsl:apply-templates select="./*"/>
  782. </span>
  783. </xsl:template>
  784. <xsl:template match="hts:div">
  785. <div role="presentation">
  786. <xsl:copy-of select="@*"/>
  787. <xsl:apply-templates select="./*"/>
  788. </div>
  789. </xsl:template>
  790. <xsl:template match="hts:*">
  791. <xsl:message terminate="yes">ERR-LAY-001: Unsupported layout tag: <xsl:value-of select="name()"/>.</xsl:message>
  792. </xsl:template>
  793. <!-- CALLED TEMPLATES -->
  794. <xsl:template name="createHiddenField">
  795. <xsl:param name="chfName" select="''"/>
  796. <xsl:param name="chfId" select="''"/>
  797. <xsl:param name="chfValue" select="''"/>
  798. <xsl:variable name="lchfId">
  799. <xsl:if test="$chfId != ''">
  800. <xsl:choose>
  801. <xsl:when test="contains(string($chfId),'_THIS_')">
  802. <xsl:value-of select="$chfId"/>
  803. </xsl:when>
  804. <xsl:otherwise><xsl:value-of select="concat('_THIS_',$chfId)"/></xsl:otherwise>
  805. </xsl:choose>
  806. </xsl:if>
  807. </xsl:variable>
  808. <xsl:text/><input type="hidden"><xsl:text/>
  809. <xsl:if test="$lchfId != ''">
  810. <xsl:attribute name="id"><xsl:value-of select="$lchfId"/></xsl:attribute>
  811. </xsl:if>
  812. <xsl:if test="$chfName != ''">
  813. <xsl:attribute name="name"><xsl:value-of select="$chfName"/></xsl:attribute>
  814. </xsl:if>
  815. <xsl:attribute name="value"><xsl:value-of select="$chfValue"/></xsl:attribute>
  816. <xsl:text/></input>
  817. </xsl:template>
  818. <xsl:template name="replaceLinkInText">
  819. <xsl:param name="text"/>
  820. <xsl:param name="node"/>
  821. <xsl:param name="linkNumber"/>
  822. <xsl:choose>
  823. <xsl:when test="$linkNumber!=''">
  824. <xsl:variable name="constant" select="concat('##link',$linkNumber,'##')"/>
  825. <xsl:variable name="stringBefore" select="substring-before($text,$constant)"/>
  826. <xsl:variable name="stringAfter" select="substring-after($text,$constant)"/>
  827. <xsl:value-of select="$stringBefore"/>
  828. <xsl:apply-templates select="$node/hts:links/*[name()='hts:link'][number($linkNumber)]"/>
  829. <xsl:variable name="newLinkNumber" select="substring-before(substring-after($stringAfter,'##link'),'##')"/>
  830. <xsl:call-template name="replaceLinkInText">
  831. <xsl:with-param name="text" select="$stringAfter"/>
  832. <xsl:with-param name="node" select="$node"/>
  833. <xsl:with-param name="linkNumber" select="$newLinkNumber"/>
  834. </xsl:call-template>
  835. </xsl:when>
  836. <xsl:otherwise>
  837. <xsl:value-of select="$text"/>
  838. </xsl:otherwise>
  839. </xsl:choose>
  840. </xsl:template>
  841. <!-- Non-layout processing -->
  842. <xsl:template match="*">
  843. <xsl:copy>
  844. <xsl:copy-of select="@*"/>
  845. <xsl:apply-templates/>
  846. </xsl:copy>
  847. </xsl:template>
  848. </xsl:stylesheet>