layout.xslt 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cpscrn
  5. (C) Copyright IBM Corp. 2005, 2011
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  15. xmlns:layout="http://developer.cognos.com/common/layout"
  16. exclude-result-prefixes="xts layout">
  17. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  18. <xsl:template match="layout:action">
  19. <xsl:apply-templates select="./*"/>
  20. </xsl:template>
  21. <xsl:template match="layout:actionlist">
  22. <table>
  23. <tr>
  24. <xsl:for-each select="./layout:action">
  25. <td><xsl:apply-templates select="."/></td>
  26. </xsl:for-each>
  27. </tr>
  28. </table>
  29. </xsl:template>
  30. <xsl:template match="layout:button">
  31. <xsl:variable name="btncls" select="'cogstyle-layout-button-spacing'"/>
  32. <xsl:variable name="useClass">
  33. <xsl:choose>
  34. <xsl:when test="not(@class)">portlet-form-button</xsl:when>
  35. <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
  36. </xsl:choose>
  37. </xsl:variable>
  38. <xsl:variable name="useType">
  39. <xsl:choose>
  40. <xsl:when test="string(@type)='reset' or string(@type)='submit'"><xsl:value-of select="@type"/></xsl:when>
  41. <xsl:otherwise>button</xsl:otherwise>
  42. </xsl:choose>
  43. </xsl:variable>
  44. <div class="{$btncls}">
  45. <input class="{$useClass}" type="{$useType}">
  46. <xsl:copy-of select="@*[name()!='type' and name()!='class']"/>
  47. <xsl:attribute name="value"><xsl:apply-templates select="./layout:value"/></xsl:attribute>
  48. </input>
  49. </div>
  50. </xsl:template>
  51. <xsl:template match="layout:column">
  52. <xsl:variable name="pcnt" select="floor(100 div (count(following-sibling::layout:column) + count(preceding-sibling::layout:column) + 1))"/>
  53. <td width="{$pcnt}%">
  54. <xsl:apply-templates select="./*"/>
  55. </td>
  56. </xsl:template>
  57. <xsl:template match="layout:columnset">
  58. <div class="cogstyle-layout-column-set">
  59. <table width="100%" >
  60. <tr class="cogstyle-layout-column">
  61. <xsl:apply-templates select="./*"/>
  62. </tr>
  63. </table>
  64. </div>
  65. </xsl:template>
  66. <xsl:template match="layout:field">
  67. <xsl:variable name="useFieldSR">
  68. <xsl:apply-templates select="./layout:keyscript"/>
  69. </xsl:variable>
  70. <xsl:variable name="fId">
  71. <xsl:choose>
  72. <xsl:when test="contains(string(@id),'_THIS_')">
  73. <xsl:value-of select="@id"/>
  74. </xsl:when>
  75. <xsl:otherwise><xsl:value-of select="concat('_THIS_',@id)"/></xsl:otherwise>
  76. </xsl:choose>
  77. </xsl:variable>
  78. <xsl:variable name="fValue">
  79. <xsl:choose>
  80. <xsl:when test="./*[name()='layout:text']">
  81. <xsl:apply-templates select="./*[name()='layout:text']"/>
  82. </xsl:when>
  83. <xsl:when test="./*[name()='layout:value']">
  84. <xsl:apply-templates select="./*[name()='layout:value']"/>
  85. </xsl:when>
  86. </xsl:choose>
  87. </xsl:variable>
  88. <xsl:variable name="useClass">
  89. <xsl:choose>
  90. <xsl:when test="@class"><xsl:value-of select="@class"/></xsl:when>
  91. <xsl:otherwise>portlet-form-input-field</xsl:otherwise>
  92. </xsl:choose>
  93. </xsl:variable>
  94. <div class="cogstyle-layout-field"><xsl:text/>
  95. <xsl:if test="not(./layout:label)"><xsl:apply-templates select="./layout:hint"/></xsl:if>
  96. <xsl:apply-templates select="./layout:label">
  97. <xsl:with-param name="forParam" select="string($fId)"/>
  98. </xsl:apply-templates>
  99. <xsl:choose>
  100. <xsl:when test="@type='textarea'">
  101. <xsl:variable name="fRows">
  102. <xsl:choose>
  103. <xsl:when test="@rows"><xsl:value-of select="@rows"/></xsl:when>
  104. <xsl:otherwise>10</xsl:otherwise>
  105. </xsl:choose>
  106. </xsl:variable>
  107. <xsl:variable name="fCols">
  108. <xsl:choose>
  109. <xsl:when test="@cols"><xsl:value-of select="@cols"/></xsl:when>
  110. <xsl:otherwise>80</xsl:otherwise>
  111. </xsl:choose>
  112. </xsl:variable>
  113. <table cellpadding="0" cellspacing="0">
  114. <tr>
  115. <td>
  116. <textarea class="{$useClass}">
  117. <xsl:copy-of select="@*[name()!='id' and name()!='rows' and name()!='cols' and name()!='class']"/>
  118. <xsl:if test="@id">
  119. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  120. </xsl:if>
  121. <xsl:attribute name="rows"><xsl:value-of select="$fRows"/></xsl:attribute>
  122. <xsl:attribute name="cols"><xsl:value-of select="$fCols"/></xsl:attribute>
  123. <xsl:if test="$useFieldSR != ''">
  124. <xsl:attribute name="onkeypress"><xsl:value-of select="$useFieldSR"/></xsl:attribute>
  125. </xsl:if>
  126. <xsl:text/><xsl:value-of select="$fValue"/><xsl:text/>
  127. </textarea>
  128. </td>
  129. </tr>
  130. <xsl:if test="./layout:action">
  131. <tr>
  132. <td class="cogstyle-layout-action-list"><xsl:apply-templates select="./layout:action"/></td>
  133. </tr>
  134. </xsl:if>
  135. <xsl:if test="./layout:actionlist">
  136. <tr>
  137. <td class="cogstyle-layout-action-list"><xsl:apply-templates select="./layout:actionlist"/></td>
  138. </tr>
  139. </xsl:if>
  140. </table>
  141. </xsl:when>
  142. <xsl:otherwise>
  143. <table cellpadding="0" cellspacing="0">
  144. <tr>
  145. <td>
  146. <input class="{$useClass}">
  147. <xsl:copy-of select="@*[name()!='id' and name()!='class']"/>
  148. <xsl:if test="@id">
  149. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  150. </xsl:if>
  151. <xsl:attribute name="value">
  152. <xsl:value-of select="$fValue"/>
  153. </xsl:attribute>
  154. <xsl:if test="$useFieldSR != ''">
  155. <xsl:attribute name="onkeypress"><xsl:value-of select="$useFieldSR"/></xsl:attribute>
  156. </xsl:if>
  157. </input>
  158. </td>
  159. </tr>
  160. </table>
  161. </xsl:otherwise>
  162. </xsl:choose>
  163. </div>
  164. </xsl:template>
  165. <xsl:template match="layout:form">
  166. <form>
  167. <xsl:copy-of select="@*"/>
  168. <xsl:apply-templates select="layout:section[@format='header']"/>
  169. <div class="cogstyle-layout-on-form">
  170. <xsl:apply-templates select="*[not((name()='layout:section' and string(@format)='header')or (name()='layout:section' and string(@format)='footer'))]"/>
  171. </div>
  172. <xsl:apply-templates select="layout:section[@format='footer']"/>
  173. </form>
  174. </xsl:template>
  175. <xsl:template match="layout:hidden">
  176. <xsl:call-template name="createHiddenField">
  177. <xsl:with-param name="chfName" select="@name"/>
  178. <xsl:with-param name="chfValue" select="@value"/>
  179. <xsl:with-param name="chfId" select="@id"/>
  180. </xsl:call-template>
  181. </xsl:template>
  182. <xsl:template match="layout:hint">
  183. <xsl:if test="string(.)!=''">
  184. <xsl:if test="not(parent::layout:label)"><xsl:text disable-output-escaping="yes">&lt;table&gt;</xsl:text></xsl:if>
  185. <tr>
  186. <td class="cogstyle-layout-hint">
  187. <div class="portlet-msg-info">
  188. <xsl:choose>
  189. <xsl:when test="./layout:text">
  190. <xsl:apply-templates select="./*"/>
  191. </xsl:when>
  192. <xsl:otherwise>
  193. <xsl:value-of select="string(.)"/>
  194. </xsl:otherwise>
  195. </xsl:choose>
  196. </div>
  197. </td>
  198. </tr>
  199. <xsl:if test="not(parent::layout:label)"><xsl:text disable-output-escaping="yes">&lt;/table&gt;</xsl:text></xsl:if>
  200. </xsl:if>
  201. </xsl:template>
  202. <xsl:template match="layout:img">
  203. <img>
  204. <xsl:copy-of select="@*"/>
  205. <xsl:apply-templates select="./*"/>
  206. </img>
  207. </xsl:template>
  208. <xsl:template match="layout:faded">
  209. <xsl:attribute name="class">cogstyle-img-faded</xsl:attribute>
  210. </xsl:template>
  211. <xsl:template match="layout:keyscript">
  212. <xsl:value-of select="."/>
  213. </xsl:template>
  214. <xsl:template match="layout:label">
  215. <xsl:param name="forParam" select="''"/>
  216. <xsl:if test="string(.)!=''">
  217. <xsl:variable name="labelclass">
  218. <xsl:choose>
  219. <xsl:when test="not(ancestor::layout:rcsection) and string(@divider)='true'">cogstyle-layout-divider-label</xsl:when>
  220. <xsl:when test="not(ancestor::layout:rcsection)">cogstyle-layout-label</xsl:when>
  221. <xsl:otherwise>cogstyle-layout-label-in-control</xsl:otherwise>
  222. </xsl:choose>
  223. </xsl:variable>
  224. <xsl:variable name="forID">
  225. <xsl:choose>
  226. <xsl:when test="@for"><xsl:value-of select="@for"/></xsl:when>
  227. <xsl:otherwise><xsl:value-of select="$forParam"/></xsl:otherwise>
  228. </xsl:choose>
  229. </xsl:variable>
  230. <table cellpadding="0" cellspacing="0">
  231. <xsl:choose>
  232. <xsl:when test="string(@divider)='true'">
  233. <tr>
  234. <td class="{$labelclass}">
  235. <div class="portlet-form-field-label">
  236. <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>
  237. <xsl:apply-templates select="layout:text"/>
  238. <xsl:if test="$forID != ''"><xsl:text disable-output-escaping="yes">&lt;/label&gt;</xsl:text></xsl:if>
  239. </div>
  240. </td>
  241. <td class="cogstyle-layout-divider"><div class="cogstyle-layout-divider-line"></div></td>
  242. </tr>
  243. <xsl:if test="./layout:hint">
  244. <tr>
  245. <td colspan="2"><table cellspacing="0"><xsl:apply-templates select="./layout:hint"/></table></td>
  246. </tr>
  247. </xsl:if>
  248. </xsl:when>
  249. <xsl:otherwise>
  250. <xsl:variable name="labelClass">
  251. <xsl:choose>
  252. <xsl:when test="count(preceding-sibling::layout:label)=0"><xsl:value-of select="$labelclass"/></xsl:when>
  253. <xsl:otherwise>cogstyle-layout-sub-label</xsl:otherwise>
  254. </xsl:choose>
  255. </xsl:variable>
  256. <tr>
  257. <td>
  258. <xsl:attribute name="class"><xsl:value-of select="$labelClass"/></xsl:attribute>
  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="./layout:text"/>
  262. <xsl:if test="$forID != ''"><xsl:text disable-output-escaping="yes">&lt;/label&gt;</xsl:text></xsl:if>
  263. </div>
  264. </td>
  265. </tr>
  266. <xsl:if test="./layout:hint">
  267. <xsl:apply-templates select="./layout:hint"/>
  268. </xsl:if>
  269. </xsl:otherwise>
  270. </xsl:choose>
  271. </table>
  272. </xsl:if>
  273. </xsl:template>
  274. <xsl:template match="layout:link">
  275. <xsl:variable name="linkClass">
  276. <xsl:choose>
  277. <xsl:when test="ancestor::layout:text[@format='hasLink']">cogstyle-layout-link-inplace</xsl:when>
  278. <xsl:when test="parent::layout:action">cogstyle-layout-link-action</xsl:when>
  279. <xsl:when test="parent::layout:section[@format='dynamicexpand']">cogstyle-layout-link-expand</xsl:when>
  280. <xsl:otherwise>cogstyle-layout-link</xsl:otherwise>
  281. </xsl:choose>
  282. </xsl:variable>
  283. <xsl:text/><div>
  284. <xsl:attribute name="class"><xsl:value-of select="$linkClass"/></xsl:attribute>
  285. <a class="cognos-anchor">
  286. <xsl:copy-of select="@*"/>
  287. <xsl:text/><xsl:value-of select="string(.)"/><xsl:text/>
  288. </a>
  289. </div><xsl:text/>
  290. </xsl:template>
  291. <xsl:template match="layout:option">
  292. <xsl:choose>
  293. <xsl:when test="parent::layout:select or parent::layout:optgroup">
  294. <option>
  295. <xsl:copy-of select="@*"/>
  296. <xsl:value-of select="string(.)"/>
  297. </option>
  298. </xsl:when>
  299. </xsl:choose>
  300. </xsl:template>
  301. <xsl:template match="layout:optgroup">
  302. <xsl:choose>
  303. <xsl:when test="parent::layout:select">
  304. <optgroup label="{@label}">
  305. <xsl:apply-templates select="./*"/>
  306. </optgroup>
  307. </xsl:when>
  308. </xsl:choose>
  309. </xsl:template>
  310. <xsl:template match="layout:radio | layout:checkbox">
  311. <xsl:variable name="useRadioSR">
  312. <xsl:apply-templates select="./layout:keyscript"/>
  313. </xsl:variable>
  314. <xsl:variable name="rc" select="substring-after(string(name()),':')"/>
  315. <xsl:if test="(($rc='radio' and count(preceding-sibling::layout:radio)=0) or ($rc='checkbox' and count(preceding-sibling::layout:checkbox)=0))">
  316. <xsl:text disable-output-escaping="yes">&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;</xsl:text>
  317. </xsl:if>
  318. <xsl:variable name="fId">
  319. <xsl:choose>
  320. <xsl:when test="string(@id)='' or string(@id) = '_THIS_'">
  321. <xsl:value-of select="concat('_THIS_',generate-id())"/>
  322. </xsl:when>
  323. <xsl:when test="contains(string(@id),'_THIS_')">
  324. <xsl:value-of select="@id"/>
  325. </xsl:when>
  326. <xsl:otherwise>
  327. <xsl:value-of select="concat('_THIS_',@id)"/>
  328. </xsl:otherwise>
  329. </xsl:choose>
  330. </xsl:variable>
  331. <tr>
  332. <td class="cogstyle-layout-radio-chkbox-control">
  333. <input type="{$rc}" name="{@name}">
  334. <xsl:copy-of select="@*[name()!='id' and name()!='class' and name()!='selected']"/>
  335. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  336. <xsl:if test="string(@selected)='true'">
  337. <xsl:attribute name="checked">checked</xsl:attribute>
  338. </xsl:if>
  339. <xsl:if test="$useRadioSR != ''">
  340. <xsl:attribute name="onclick"><xsl:value-of select="$useRadioSR"/></xsl:attribute>
  341. <xsl:attribute name="onkeypress"><xsl:value-of select="$useRadioSR"/></xsl:attribute>
  342. </xsl:if>
  343. <xsl:attribute name="value"><xsl:apply-templates select="layout:value"/></xsl:attribute>
  344. </input>
  345. </td>
  346. <td class="cogstyle-layout-radio-chkbox-text"><label for="{$fId}" class="portlet-form-field"><xsl:apply-templates select="./layout:text"/></label></td>
  347. </tr>
  348. <xsl:if test="layout:rcsection">
  349. <tr>
  350. <td><br/></td>
  351. <td class="cogstyle-layout-in-radio-chkbox">
  352. <xsl:apply-templates select="./layout:rcsection"/>
  353. </td>
  354. </tr>
  355. </xsl:if>
  356. <xsl:if test="(($rc='radio' and count(following-sibling::layout:radio)=0) or ($rc='checkbox' and count(following-sibling::layout:checkbox)=0))">
  357. <xsl:text disable-output-escaping="yes">&lt;/table&gt;</xsl:text>
  358. </xsl:if>
  359. </xsl:template>
  360. <xsl:template match="layout:rcsection">
  361. <div><xsl:apply-templates select="./*"/></div>
  362. </xsl:template>
  363. <xsl:template match="layout:row">
  364. <xsl:variable name="rowFormat"><xsl:if test="@format"><xsl:value-of select="concat('cogstyle-layout-row-',@format)"/></xsl:if></xsl:variable>
  365. <table cellpadding="0" cellspacing="0">
  366. <xsl:if test="$rowFormat != ''">
  367. <xsl:attribute name="class"><xsl:value-of select="$rowFormat"/></xsl:attribute>
  368. </xsl:if>
  369. <tr>
  370. <xsl:for-each select="./child::node()">
  371. <td class="cogstyle-layout-row">
  372. <div class="portlet-form-field">
  373. <xsl:apply-templates select="."/>
  374. </div>
  375. </td>
  376. </xsl:for-each>
  377. </tr>
  378. </table>
  379. </xsl:template>
  380. <xsl:template match="layout:script">
  381. <xsl:variable name="stype">
  382. <xsl:choose>
  383. <xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
  384. <xsl:otherwise>text/javascript</xsl:otherwise>
  385. </xsl:choose>
  386. </xsl:variable>
  387. <script type="{string($stype)}">
  388. <xsl:copy-of select="./child::node()"/>
  389. </script>
  390. </xsl:template>
  391. <xsl:template match="layout:section[@format='dynamicexpand']">
  392. <xsl:variable name="deVu">
  393. <xsl:choose>
  394. <xsl:when test="string(@defaultview)!='' and string(@defaultview)!='none'">cogstyle-layout-dynamic-expand</xsl:when>
  395. <xsl:otherwise>cogstyle-layout-dynamic-collapse</xsl:otherwise>
  396. </xsl:choose>
  397. </xsl:variable>
  398. <xsl:variable name="deVuCollapsed">
  399. <xsl:if test="./layout:dynamicareacollapsed">
  400. <xsl:choose>
  401. <xsl:when test="$deVu = 'cogstyle-layout-dynamic-collapse'">cogstyle-layout-dynamic-expand</xsl:when>
  402. <xsl:otherwise>cogstyle-layout-dynamic-collapse</xsl:otherwise>
  403. </xsl:choose>
  404. </xsl:if>
  405. </xsl:variable>
  406. <xsl:variable name="cId">
  407. <xsl:if test="@id">
  408. <xsl:choose>
  409. <xsl:when test="contains(string(@id),'_THIS_')">
  410. <xsl:value-of select="@id"/>
  411. </xsl:when>
  412. <xsl:otherwise><xsl:value-of select="concat('_THIS_',@id)"/></xsl:otherwise>
  413. </xsl:choose>
  414. </xsl:if>
  415. </xsl:variable>
  416. <xsl:variable name="cName" select="@name"/>
  417. <xsl:apply-templates select="./layout:script"/>
  418. <table cellpadding="0" cellspacing="0">
  419. <tr>
  420. <td class="cogstyle-layout-label">
  421. <xsl:apply-templates select="./layout:link"/>
  422. <xsl:apply-templates select="./layout:img"/>
  423. </td>
  424. </tr>
  425. <xsl:if test="./layout:hint">
  426. <tr>
  427. <td>
  428. <xsl:apply-templates select="./layout:hint"/>
  429. </td>
  430. </tr>
  431. </xsl:if>
  432. </table>
  433. <div>
  434. <xsl:attribute name="class"><xsl:value-of select="$deVu"/></xsl:attribute>
  435. <xsl:attribute name="id"><xsl:value-of select="$cId"/></xsl:attribute>
  436. <xsl:attribute name="name"><xsl:value-of select="$cName"/></xsl:attribute>
  437. <xsl:apply-templates select="./layout:dynamicarea/*"/>
  438. </div>
  439. <xsl:if test="./layout:dynamicareacollapsed">
  440. <div>
  441. <xsl:attribute name="class"><xsl:value-of select="$deVuCollapsed"/></xsl:attribute>
  442. <xsl:attribute name="id"><xsl:value-of select="$cId"/>_collapsed</xsl:attribute>
  443. <xsl:attribute name="name"><xsl:value-of select="$cName"/>_collapsed</xsl:attribute>
  444. <xsl:apply-templates select="./layout:dynamicareacollapsed/*"/>
  445. </div>
  446. </xsl:if>
  447. </xsl:template>
  448. <xsl:template match="layout:section[@format='header']">
  449. <table width="100%">
  450. <tr>
  451. <td width="100%"><div class="portlet-msg-info"><xsl:apply-templates select="./layout:text"/></div></td>
  452. <xsl:if test="./layout:action or ./layout:actionlist">
  453. <td class="cogstyle-layout-action-list"><xsl:apply-templates select="./layout:action | ./layout:actionlist"/></td>
  454. </xsl:if>
  455. </tr>
  456. </table>
  457. </xsl:template>
  458. <xsl:template match="layout:section[@format='select-locale']">
  459. <xsl:apply-templates select="./layout:script"/>
  460. <xsl:apply-templates select="./layout:hidden"/>
  461. <xsl:choose>
  462. <xsl:when test="string(@divider)='true'">
  463. <xsl:text disable-output-escaping="yes">&lt;div class=&quot;cogstyle-layout-divider-line&quot;&gt;</xsl:text>
  464. <xsl:if test="./layout:label">
  465. <div class="cogstyle-layout-select-locale-label"><xsl:apply-templates select="./layout:label"/></div>
  466. </xsl:if>
  467. </xsl:when>
  468. <xsl:otherwise>
  469. <div class="cogstyle-layout-select-locale-label"><xsl:apply-templates select="./layout:label"/></div>
  470. </xsl:otherwise>
  471. </xsl:choose>
  472. <table cellpadding="0" cellspacing="0">
  473. <tr>
  474. <td class="cogstyle-layout-select-locale-row">
  475. <div class="cogstyle-layout-select-locale">
  476. <xsl:apply-templates select="./layout:select"/>
  477. </div>
  478. <div class="cogstyle-layout-select-locale-text">
  479. <a class="cognos-anchor" href="#">
  480. <xsl:attribute name="onclick"><xsl:value-of select="./layout:removelocaleaction"/></xsl:attribute>
  481. <xsl:text/><xts:string id="IDS_PROP_REMOVE_LANGUAGE_TEXT"/><xsl:text/>
  482. </a>
  483. </div>
  484. </td>
  485. </tr>
  486. </table>
  487. <xsl:if test="string(@divider)='true'">
  488. <xsl:text disable-output-escaping="yes">&lt;/div&gt;</xsl:text>
  489. </xsl:if>
  490. </xsl:template>
  491. <xsl:template match="layout:section[@format='division']">
  492. <table>
  493. <tr>
  494. <xsl:if test="./layout:label">
  495. <td class="cogstyle-layout-divider-label">
  496. <div class="portlet-form-field-label">
  497. <xsl:apply-templates select="./layout:label/layout:text"/>
  498. </div>
  499. </td>
  500. </xsl:if>
  501. <td class="cogstyle-layout-divider"><div class="cogstyle-layout-divider-line"></div></td>
  502. </tr>
  503. </table>
  504. <div><xsl:apply-templates select="./*[not(name()='layout:label')]"/></div>
  505. </xsl:template>
  506. <xsl:template match="layout:section">
  507. <xsl:variable name="inRC" select="preceding-sibling::*[name()='layout:radio' or name()='layout:checkbox']"/>
  508. <xsl:variable name="rsFormat"><xsl:if test="@format"><xsl:value-of select="concat('-',@format)"/></xsl:if></xsl:variable>
  509. <xsl:variable name="cls">
  510. <xsl:choose>
  511. <xsl:when test="not(@class)">cogstyle-layout-section<xsl:value-of select="$rsFormat"/></xsl:when>
  512. <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
  513. </xsl:choose>
  514. </xsl:variable>
  515. <xsl:variable name="fId">
  516. <xsl:if test="@id">
  517. <xsl:choose>
  518. <xsl:when test="contains(string(@id),'_THIS_')"><xsl:value-of select="@id"/></xsl:when>
  519. <xsl:otherwise><xsl:value-of select="concat('_THIS_',@id)"/></xsl:otherwise>
  520. </xsl:choose>
  521. </xsl:if>
  522. </xsl:variable>
  523. <xsl:if test="$inRC">
  524. <xsl:text disable-output-escaping="yes">
  525. &lt;tr&gt;&lt;td&gt;&lt;br/&gt;&lt;td&gt;
  526. </xsl:text>
  527. </xsl:if>
  528. <xsl:choose>
  529. <xsl:when test="string(@divider)='true'">
  530. <div class="cogstyle-layout-divider-line">
  531. <xsl:if test="$fId != ''">
  532. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  533. </xsl:if>
  534. <xsl:if test="./layout:hint">
  535. <div><xsl:apply-templates select="./layout:hint"/></div>
  536. </xsl:if>
  537. <div class="{$cls}"><xsl:apply-templates select="./*[not(name()='layout:hint')]"/></div>
  538. </div>
  539. </xsl:when>
  540. <xsl:otherwise>
  541. <div class="{$cls}">
  542. <xsl:if test="$fId != ''">
  543. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  544. </xsl:if>
  545. <xsl:if test="./layout:hint">
  546. <div><xsl:apply-templates select="./layout:hint"/></div>
  547. </xsl:if>
  548. <xsl:apply-templates select="./*[not(name()='layout:hint')]"/>
  549. </div>
  550. </xsl:otherwise>
  551. </xsl:choose>
  552. <xsl:if test="$inRC">
  553. <xsl:text disable-output-escaping="yes">
  554. &lt;/td&gt;&lt;/tr&gt;
  555. </xsl:text>
  556. </xsl:if>
  557. </xsl:template>
  558. <xsl:template match="layout:select">
  559. <xsl:variable name="useSelectSR">
  560. <xsl:apply-templates select="./layout:keyscript"/>
  561. </xsl:variable>
  562. <xsl:variable name="fId">
  563. <xsl:choose>
  564. <xsl:when test="contains(string(@id),'_THIS_')">
  565. <xsl:value-of select="@id"/>
  566. </xsl:when>
  567. <xsl:otherwise><xsl:value-of select="concat('_THIS_',string(@id))"/></xsl:otherwise>
  568. </xsl:choose>
  569. </xsl:variable>
  570. <xsl:if test="./layout:label">
  571. <xsl:apply-templates select="./layout:label"/>
  572. </xsl:if>
  573. <xsl:if test="not(parent::layout:section[@format='select-locale'])">
  574. <xsl:text disable-output-escaping="yes">&lt;table width=&quot;100%&quot;&gt;
  575. &lt;tr&gt;
  576. &lt;td&gt;</xsl:text>
  577. </xsl:if>
  578. <select>
  579. <xsl:copy-of select="@*[name()!='id']"/>
  580. <xsl:if test="@id">
  581. <xsl:attribute name="id"><xsl:value-of select="$fId"/></xsl:attribute>
  582. </xsl:if>
  583. <xsl:if test="$useSelectSR != ''">
  584. <xsl:attribute name="onchange"><xsl:value-of select="$useSelectSR"/></xsl:attribute>
  585. </xsl:if>
  586. <xsl:choose>
  587. <xsl:when test="./layout:option">
  588. <xsl:apply-templates select="./layout:option | ./layout:optgroup"/>
  589. </xsl:when>
  590. <xsl:when test="./option">
  591. <xsl:copy-of select="./*[name()='option'] | ./*[name()='optgroup']"/>
  592. </xsl:when>
  593. </xsl:choose>
  594. </select>
  595. <xsl:if test="not(parent::layout:section[@format='select-locale'])"><xsl:text disable-output-escaping="yes">
  596. &lt;/td&gt;
  597. &lt;/tr&gt;
  598. &lt;/table&gt;</xsl:text>
  599. </xsl:if>
  600. </xsl:template>
  601. <xsl:template match="layout:text | layout:value">
  602. <xsl:choose>
  603. <xsl:when test="@format='hasLink'">
  604. <xsl:apply-templates select="*|text()"/>
  605. </xsl:when>
  606. <xsl:otherwise>
  607. <xsl:text/><xsl:value-of select="string(.)"/><xsl:text/>
  608. </xsl:otherwise>
  609. </xsl:choose>
  610. </xsl:template>
  611. <xsl:template match="layout:span">
  612. <span>
  613. <xsl:copy-of select="@*"/>
  614. <xsl:apply-templates select="./*"/>
  615. </span>
  616. </xsl:template>
  617. <xsl:template match="layout:*">
  618. <xsl:message terminate="yes">ERR-LAY-001: Unsupported layout tag: <xsl:value-of select="name()"/>.</xsl:message>
  619. </xsl:template>
  620. <!-- CALLED TEMPLATES -->
  621. <xsl:template name="createHiddenField">
  622. <xsl:param name="chfName" select="''"/>
  623. <xsl:param name="chfId" select="''"/>
  624. <xsl:param name="chfValue" select="''"/>
  625. <xsl:variable name="lchfId">
  626. <xsl:if test="$chfId != ''">
  627. <xsl:choose>
  628. <xsl:when test="contains(string($chfId),'_THIS_')">
  629. <xsl:value-of select="$chfId"/>
  630. </xsl:when>
  631. <xsl:otherwise><xsl:value-of select="concat('_THIS_',$chfId)"/></xsl:otherwise>
  632. </xsl:choose>
  633. </xsl:if>
  634. </xsl:variable>
  635. <xsl:text/><input type="hidden"><xsl:text/>
  636. <xsl:if test="$lchfId != ''">
  637. <xsl:attribute name="id"><xsl:value-of select="$lchfId"/></xsl:attribute>
  638. </xsl:if>
  639. <xsl:if test="$chfName != ''">
  640. <xsl:attribute name="name"><xsl:value-of select="$chfName"/></xsl:attribute>
  641. </xsl:if>
  642. <xsl:attribute name="value"><xsl:value-of select="$chfValue"/></xsl:attribute>
  643. <xsl:text/></input>
  644. </xsl:template>
  645. <xsl:template name="replaceLinkInText">
  646. <xsl:param name="text"/>
  647. <xsl:param name="node"/>
  648. <xsl:param name="linkNumber"/>
  649. <xsl:choose>
  650. <xsl:when test="$linkNumber!=''">
  651. <xsl:variable name="constant" select="concat('##link',$linkNumber,'##')"/>
  652. <xsl:variable name="stringBefore" select="substring-before($text,$constant)"/>
  653. <xsl:variable name="stringAfter" select="substring-after($text,$constant)"/>
  654. <xsl:value-of select="$stringBefore"/>
  655. <xsl:apply-templates select="$node/layout:links/*[name()='layout:link'][number($linkNumber)]"/>
  656. <xsl:variable name="newLinkNumber" select="substring-before(substring-after($stringAfter,'##link'),'##')"/>
  657. <xsl:call-template name="replaceLinkInText">
  658. <xsl:with-param name="text" select="$stringAfter"/>
  659. <xsl:with-param name="node" select="$node"/>
  660. <xsl:with-param name="linkNumber" select="$newLinkNumber"/>
  661. </xsl:call-template>
  662. </xsl:when>
  663. <xsl:otherwise>
  664. <xsl:value-of select="$text"/>
  665. </xsl:otherwise>
  666. </xsl:choose>
  667. </xsl:template>
  668. <!-- Non-layout processing -->
  669. <xsl:template match="*">
  670. <xsl:copy>
  671. <xsl:copy-of select="@*"/>
  672. <xsl:apply-templates/>
  673. </xsl:copy>
  674. </xsl:template>
  675. </xsl:stylesheet>
  676. <!-- $Header$ -->
  677. <!-- $DateTime$ -->
  678. <!-- $Change$ -->