wizardlogic.xslt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  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. <!-- $Header: //cpscrn/main/templates/cps4/portlets/portal-admin/logicsheets/wizardlogic.xslt#1 $ -->
  13. <!-- $DateTime: 2008/10/22 11:12:04 $ -->
  14. <!-- $Change: 25109 $ -->
  15. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  16. xmlns:out="dummy-uri"
  17. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  18. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  19. xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"
  20. xmlns:dp="http://developer.cognos.com/schemas/cps/portlets/logicsheets/dialog/presentation/1/"
  21. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  22. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  23. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  24. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  25. <xsl:template match="/">
  26. <xsl:apply-templates select="/layout"/>
  27. </xsl:template>
  28. <xsl:template match="layout" priority="1">
  29. <!-- COMPILE -->
  30. <out:stylesheet version="1.0"
  31. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  32. xmlns:dp="http://developer.cognos.com/schemas/cps/portlets/logicsheets/dialog/presentation/1/"
  33. xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"
  34. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  35. <!-- dummy way of copying namespaces -->
  36. <xsl:for-each select="namespace::*[. != 'http://www.w3.org/1999/XSL/Transform']">
  37. <xsl:attribute name="{name()}:dummy" namespace="{.}"/>
  38. </xsl:for-each>
  39. <!-- construct an 'exclude-result-prefixes' attribute with the list from the source xslt plus our own list -->
  40. <xsl:attribute name="exclude-result-prefixes">
  41. <xsl:if test="@exclude-result-prefixes">
  42. <xsl:value-of select="@exclude-result-prefixes"/>
  43. <xsl:text> </xsl:text>
  44. </xsl:if>
  45. <xsl:text>xts xtsext dp wsrp SOAP-ENV</xsl:text>
  46. </xsl:attribute>
  47. <!-- output html -->
  48. <out:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  49. <!-- add some useful variables... -->
  50. <out:variable name="op" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]"/>
  51. <out:variable name="pages" select="/root/wizard/page"/>
  52. <out:variable name="page-id" select="/root/pageId"/>
  53. <out:variable name="page" select="$pages[id = $page-id]"/>
  54. <out:variable name="params" select="/root/state/param"/>
  55. <out:variable name="web-content-root" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader/bus:hdrSession/bus:environmentVars/item[name='WEB_CONTENT_ROOT']/value"/>
  56. <out:variable name="webcontent">
  57. <out:choose>
  58. <out:when test="$web-content-root"><out:value-of select="concat($web-content-root,'/ps')"/></out:when>
  59. <out:otherwise><out:value-of select="'../ps'"/></out:otherwise>
  60. </out:choose>
  61. </out:variable>
  62. <out:variable name="skincontent">
  63. <out:choose>
  64. <out:when test="$web-content-root"><out:value-of select="concat($web-content-root,'/skins')"/></out:when>
  65. <out:otherwise><out:value-of select="'../skins'"/></out:otherwise>
  66. </out:choose>
  67. </out:variable>
  68. <!-- dialoglogic variables -->
  69. <dp:variables/>
  70. <out:template match="/">
  71. <out:call-template name="render-content"/>
  72. </out:template>
  73. <out:template name="render-content">
  74. <!-- /COMPILE -->
  75. <xsl:apply-templates select="* | text() | processing-instruction()"/>
  76. <!-- COMPILE -->
  77. </out:template>
  78. </out:stylesheet>
  79. <!-- /COMPILE -->
  80. </xsl:template>
  81. <!--
  82. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  83. wizard-page
  84. -->
  85. <xsl:template match="wizard-page">
  86. <script>
  87. function wsrp_rewrite_doAction(sMode)
  88. {
  89. var frm = document.wsrp_rewrite_form;
  90. if (sMode == "next" || sMode == "finish")
  91. if (!wsrp_rewrite_validate(frm))
  92. return;
  93. frm.mode.value = sMode;
  94. frm.submit();
  95. }
  96. <!-- TODO: generate list from declared nodelist or something like /root/*/error -->
  97. <out:variable name="error" select="/root/error"/>
  98. <out:if test="$error">
  99. function wsrp_rewrite_report_errors()
  100. {
  101. <out:text>alert("<xts:string id="IDS_PAD_COM_ERROR_GENERIC"/>\n\n</out:text>
  102. <out:value-of select="xtsext:javascriptencode($error)"/>
  103. <out:text>");</out:text>
  104. }
  105. setTimeout('wsrp_rewrite_report_errors()', 1);
  106. </out:if>
  107. </script>
  108. <form name="wsrp_rewrite_form" method="post" action="wsrp_rewrite?wsrp-urlType=blockingAction/wsrp_rewrite">
  109. <input type="hidden" name="mode" value=""/>
  110. <input type="hidden" name="source" value="{ '{ $page-id }' }"/>
  111. <!-- TODO: wipe out params when certain changes happen -->
  112. <out:for-each select="$pages[id != $page-id]">
  113. <out:if test="$params[starts-with(@name, current()/id)]">
  114. <out:for-each select="param">
  115. <out:choose>
  116. <out:when test="@prefix">
  117. <out:for-each select="$params[starts-with(@name, current()/@prefix)]">
  118. <input type="hidden" name="{ '{ @name }' }" value="{ '{ . }' }"/>
  119. </out:for-each>
  120. </out:when>
  121. <out:otherwise>
  122. <out:variable name="param" select="$params[@name = current()/@name]"/>
  123. <out:if test="$param">
  124. <input type="hidden" name="{ '{ @name }' }">
  125. <out:attribute name="value">
  126. <out:choose>
  127. <out:when test="$param">
  128. <out:value-of select="$param"/>
  129. </out:when>
  130. <out:when test="value">
  131. <out:value-of select="value"/>
  132. </out:when>
  133. </out:choose>
  134. </out:attribute>
  135. </input>
  136. </out:if>
  137. </out:otherwise>
  138. </out:choose>
  139. </out:for-each>
  140. </out:if>
  141. </out:for-each>
  142. <table border="0" width="100%" cellspacing="0" cellpadding="0" class="dialogHeader">
  143. <tr>
  144. <td valign="top" class="dialogHeaderTitle" width="100%" nowrap="nowrap">
  145. <xsl:call-template name="output-string">
  146. <xsl:with-param name="text" select="title"/>
  147. </xsl:call-template>
  148. </td>
  149. <td valign="middle" nowrap="nowrap" class="dialogHeaderLink">
  150. <a href="javascript:help('{ @helpid }')" class="dialogHeaderLinkColor" onmouseover="window.status='';return true;" onmouseout="window.status='';return true;"><xts:string id="IDS_PRO_HTM_HELP_LINK"/></a>
  151. </td>
  152. <td align="right" valign="middle" style="padding-right:3px;">
  153. <a href="javascript:wsrp_rewrite_doAction('cancel')" onmouseover="window.status='';return true;" onmouseout="window.status='';return true;">
  154. <img height="14" width="14" vspace="2" border="0" class="dialogClose" onmouseover="this.className = 'dialogCloseOver'" onmouseout="this.className = 'dialogClose'" onmouseup="this.className = 'dialogClose'" src="{'{$skincontent}'}/corporate/portal/images/close.gif">
  155. <out:attribute name="title"><xts:string id="IDS_PAD_COM_CLOSE"/></out:attribute>
  156. </img>
  157. </a>
  158. </td>
  159. </tr>
  160. </table>
  161. <table border="0" cellpadding="0" cellspacing="0">
  162. <tr>
  163. <td>
  164. <img height="10" width="1" alt="" src="{'{$webcontent}'}/images/space.gif"/>
  165. </td>
  166. </tr>
  167. </table>
  168. <xsl:if test="hint">
  169. <table border="0" width="100%" cellspacing="0" cellpadding="0" style="padding-left:5px;">
  170. <tr>
  171. <td class="dialogHeaderText" align="left">
  172. <xsl:call-template name="output-string">
  173. <xsl:with-param name="text" select="hint"/>
  174. </xsl:call-template>
  175. </td>
  176. </tr>
  177. </table>
  178. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  179. <tr>
  180. <td height="10" width="100%">
  181. <img height="10" width="1" alt="" src="{'{$webcontent}'}/images/space.gif"/>
  182. </td>
  183. </tr>
  184. </table>
  185. </xsl:if>
  186. <xsl:apply-templates select="*[not(self::title) and not(self::hint)]"/>
  187. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  188. <tr>
  189. <td height="30" width="100%">
  190. <img height="30" width="1" alt="" src="{'{$webcontent}'}/images/space.gif"/>
  191. </td>
  192. </tr>
  193. </table>
  194. <!-- first: cancel, next, ?can_finish-->
  195. <!-- middle: cancel, back, next, ?can_finish -->
  196. <!-- last: cancel, back, finish -->
  197. <out:variable name="pages" select="/root/wizard/page"/>
  198. <dp:simpleFooter>
  199. <!-- cancel -->
  200. <dp:button>
  201. <a onmouseover="window.status='';return true;" onmouseout="window.status='';return true;" href="javascript:wsrp_rewrite_doAction('cancel')">
  202. <dp:buttonText><xts:string id="IDS_PRO_CUI_BTN_CANCEL"/></dp:buttonText>
  203. </a>
  204. </dp:button>
  205. <!-- back -->
  206. <out:choose>
  207. <out:when test="$page/id != $pages[1]/id">
  208. <dp:button>
  209. <a onmouseover="window.status='';return true;" onmouseout="window.status='';return true;" href="javascript:wsrp_rewrite_doAction('back')">
  210. <dp:buttonText><xts:string id="IDS_PRO_CUI_BTN_BACK"/></dp:buttonText>
  211. </a>
  212. </dp:button>
  213. </out:when>
  214. <out:otherwise>
  215. <dp:button state="inactive">
  216. <dp:buttonText><xts:string id="IDS_PRO_CUI_BTN_BACK"/></dp:buttonText>
  217. </dp:button>
  218. </out:otherwise>
  219. </out:choose>
  220. <!-- next -->
  221. <out:choose>
  222. <out:when test="not($page/id = $pages[last()]/id)">
  223. <dp:button>
  224. <a onmouseover="window.status='';return true;" onmouseout="window.status='';return true;" href="javascript:wsrp_rewrite_doAction('next')">
  225. <dp:buttonText><xts:string id="IDS_PRO_CUI_BTN_NEXT"/></dp:buttonText>
  226. </a>
  227. </dp:button>
  228. </out:when>
  229. <out:otherwise>
  230. <dp:button state="inactive">
  231. <dp:buttonText><xts:string id="IDS_PRO_CUI_BTN_NEXT"/></dp:buttonText>
  232. </dp:button>
  233. </out:otherwise>
  234. </out:choose>
  235. <!-- finish -->
  236. <out:choose>
  237. <out:when test="$page/id = $pages[last()]/id or $page/canFinish">
  238. <dp:button>
  239. <a onmouseover="window.status='';return true;" onmouseout="window.status='';return true;" href="javascript:wsrp_rewrite_doAction('finish')">
  240. <dp:buttonText><xts:string id="IDS_PRO_CUI_BTN_FINISH"/></dp:buttonText>
  241. </a>
  242. </dp:button>
  243. </out:when>
  244. <out:otherwise>
  245. <dp:button state="inactive">
  246. <dp:buttonText><xts:string id="IDS_PRO_CUI_BTN_FINISH"/></dp:buttonText>
  247. </dp:button>
  248. </out:otherwise>
  249. </out:choose>
  250. </dp:simpleFooter>
  251. </form>
  252. <!--
  253. DEBUG
  254. <out:variable name="action" select="/root/state/action"/>
  255. <br/>Mode:<out:value-of select="$action/mode"/>
  256. <br/>Source:<out:value-of select="$action/source"/>
  257. <br/>Destin:<out:value-of select="$action/destin"/>
  258. <out:for-each select="$action/block">
  259. <br/>Block:<out:value-of select="."/>
  260. </out:for-each>
  261. <br/>pageId:<out:value-of select="$page-id"/>
  262. <out:for-each select="$params">
  263. <out:sort select="@name"/>
  264. <br/>param:<out:value-of select="@name"/>=<out:value-of select="."/>
  265. </out:for-each>
  266. -->
  267. </xsl:template>
  268. <xsl:template match="section">
  269. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  270. <xsl:if test="label">
  271. <tr>
  272. <td class="formLabel">
  273. <xsl:call-template name="output-string">
  274. <xsl:with-param name="text" select="label"/>
  275. </xsl:call-template>
  276. </td>
  277. </tr>
  278. </xsl:if>
  279. <td style="padding-left:5px;">
  280. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  281. <xsl:apply-templates select="*[not(self::label)]" mode="section"/>
  282. </table>
  283. </td>
  284. </table>
  285. </xsl:template>
  286. <xsl:template match="table">
  287. <table border="0" cellspacing="0" cellpadding="2" width="100%">
  288. <xsl:apply-templates select="row"/>
  289. </table>
  290. </xsl:template>
  291. <xsl:template match="table[@type = 'checkbox']">
  292. <table width="100%" border="0" cellpadding="2" cellspacing="0" class="cctable">
  293. <xsl:copy-of select="@*"/>
  294. <tr class="tableHeader">
  295. <xsl:for-each select="header/col">
  296. <td height="10" class="tableTitle" valign="left" nowrap="nowrap" style="padding-left:2px;padding-top:2px;">
  297. <xsl:copy-of select="@*"/>
  298. <xsl:apply-templates/>
  299. </td>
  300. <xsl:if test="position() != last()">
  301. <td height="15" width="1">
  302. <table cellpadding="0" cellspacing="0" border="0">
  303. <tr>
  304. <td class="tableHeaderDivider">
  305. <img width="1" height="15" alt="" src="{'{$webcontent}'}/images/space.gif"/>
  306. </td>
  307. </tr>
  308. </table>
  309. </td>
  310. </xsl:if>
  311. </xsl:for-each>
  312. </tr>
  313. <xsl:apply-templates select="*[not(self::header)]"/>
  314. </table>
  315. </xsl:template>
  316. <xsl:template match="*" mode="section">
  317. <tr>
  318. <td>
  319. <xsl:apply-templates select="."/>
  320. </td>
  321. </tr>
  322. <tr>
  323. <td>
  324. <img width="1" height="5" alt="" src="{'{$webcontent}'}/images/space.gif"/>
  325. </td>
  326. </tr>
  327. </xsl:template>
  328. <xsl:template match="group">
  329. <xsl:apply-templates/>
  330. </xsl:template>
  331. <xsl:template match="row">
  332. <tr>
  333. <xsl:apply-templates select="col"/>
  334. </tr>
  335. </xsl:template>
  336. <xsl:template match="col">
  337. <td>
  338. <xsl:copy-of select="@*"/>
  339. <xsl:apply-templates/>
  340. </td>
  341. <xsl:if test="ancestor::table[1][@type = 'checkbox']">
  342. <xsl:if test="position() != last()">
  343. <td/>
  344. </xsl:if>
  345. </xsl:if>
  346. </xsl:template>
  347. <xsl:template match="control">
  348. <xsl:if test="*[not(self::name or self::value)]">
  349. <xsl:apply-templates select="*[not(self::name or self::value)]"/>
  350. <br/>
  351. </xsl:if>
  352. <xsl:call-template name="output-control"/>
  353. <!--
  354. <xsl:if test="text | label">
  355. <xsl:choose>
  356. <xsl:when test="parent::section">
  357. <tr>
  358. <td>
  359. <xsl:apply-templates/>
  360. <xsl:attribute name="class">
  361. <xsl:choose>
  362. <xsl:when test="label">formLabel</xsl:when>
  363. <xsl:otherwise>formText</xsl:otherwise>
  364. </xsl:choose>
  365. </xsl:attribute>
  366. <xsl:call-template name="output-string">
  367. <xsl:with-param name="text" select="text"/>
  368. </xsl:call-template>
  369. </td>
  370. </tr>
  371. </xsl:when>
  372. <xsl:when test="parent::col">
  373. <xsl:apply-templates/>
  374. <xsl:call-template name="output-string">
  375. <xsl:with-param name="text" select="text"/>
  376. </xsl:call-template>
  377. <br/>
  378. </xsl:when>
  379. </xsl:choose>
  380. </xsl:if>
  381. <xsl:choose>
  382. <xsl:when test="parent::section">
  383. <tr>
  384. <td>
  385. <xsl:call-template name="output-control"/>
  386. </td>
  387. </tr>
  388. </xsl:when>
  389. <xsl:when test="parent::col">
  390. <xsl:call-template name="output-control"/>
  391. </xsl:when>
  392. </xsl:choose>
  393. -->
  394. </xsl:template>
  395. <xsl:template match="label">
  396. <xsl:choose>
  397. <xsl:when test="@type = 'separator'">
  398. <table border="0" cellpadding="0" cellspacing="0">
  399. <xsl:copy-of select="@*[not(@name = 'id' or @name = 'type')]"/>
  400. <tr>
  401. <!--
  402. <td height="1" width="8">
  403. <img height="1" width="8" alt="" src="{'{$webcontent}'}/images/space.gif"/>
  404. </td>
  405. -->
  406. <td valign="middle" nowrap="nowrap" class="formLabel">
  407. <xsl:call-template name="output-string"/>
  408. <xsl:text>&#160;</xsl:text>
  409. </td>
  410. <td width="100%" valign="middle" align="right">
  411. <table width="100%" height="1" border="0" cellpadding="0" cellspacing="0">
  412. <tr>
  413. <td class="dialogDivider">
  414. <img height="1" width="1" alt="" src="{'{$webcontent}'}/images/space.gif"/>
  415. </td>
  416. </tr>
  417. </table>
  418. </td>
  419. <td height="1" width="10">
  420. <img height="1" width="10" alt="" src="{'{$webcontent}'}/images/space.gif"/>
  421. </td>
  422. </tr>
  423. </table>
  424. </xsl:when>
  425. <xsl:otherwise>
  426. <span class="formLabel">
  427. <xsl:call-template name="output-string"/>
  428. </span>
  429. </xsl:otherwise>
  430. </xsl:choose>
  431. </xsl:template>
  432. <xsl:template match="text">
  433. <span class="formText">
  434. <xsl:call-template name="output-string"/>
  435. </span>
  436. </xsl:template>
  437. <xsl:template match="name"/>
  438. <xsl:template name="output-string" match="string">
  439. <xsl:param name="text" select="."/>
  440. <xsl:choose>
  441. <xsl:when test="$text/@id">
  442. <xts:string id="{ $text/@id }"/>
  443. </xsl:when>
  444. <xsl:otherwise>
  445. <xsl:apply-templates select="node()"/>
  446. <!--
  447. <xsl:value-of select="$text"/>
  448. -->
  449. </xsl:otherwise>
  450. </xsl:choose>
  451. </xsl:template>
  452. <xsl:template name="output-control">
  453. <xsl:param name="control" select="."/>
  454. <!--
  455. - get param from page
  456. - use name
  457. -->
  458. <xsl:choose>
  459. <xsl:when test="$control/@type = 'radio'">
  460. <!-- if param with same name and value, check -->
  461. <out:variable name="name" select="'{ $control/@ref }'"/>
  462. <out:variable name="value" select="'{ $control/@value }'"/>
  463. <input name="{ '{ $name }' }">
  464. <xsl:copy-of select="$control/@*[name() != 'ref' and name() != 'checked']"/>
  465. <out:variable name="param" select="$params[@name = $name]"/>
  466. <out:if test="$param = $value">
  467. <out:attribute name="checked">checked</out:attribute>
  468. </out:if>
  469. </input>
  470. </xsl:when>
  471. <xsl:when test="$control/@type = 'checkbox'">
  472. <!-- if param with same name and value, check -->
  473. <xsl:choose>
  474. <xsl:when test="$control/@prefix">
  475. <out:variable name="unique-name">
  476. <xsl:apply-templates select="name/node()"/>
  477. </out:variable>
  478. <out:variable name="name" select="concat('{ $control/@prefix }', $unique-name)"/>
  479. <out:variable name="value" select="'{ $control/@value }'"/>
  480. </xsl:when>
  481. <xsl:otherwise>
  482. <out:variable name="name" select="'{ $control/@name }'"/>
  483. <out:variable name="value" select="'{ $control/@value }'"/>
  484. </xsl:otherwise>
  485. </xsl:choose>
  486. <out:variable name="param" select="$params[@name = $name]"/>
  487. <input name="{ '{ $name }' }">
  488. <xsl:copy-of select="$control/@*[name() != 'ref' and name() != 'prefix' and name() != 'name' and name() != 'checked']"/>
  489. <!-- checked -->
  490. <!-- if default is checked, set check when no param -->
  491. <out:choose>
  492. <out:when test="$param">
  493. <out:if test="$param = $value">
  494. <out:attribute name="checked">checked</out:attribute>
  495. </out:if>
  496. </out:when>
  497. <xsl:if test="$control/@checked">
  498. <out:otherwise>
  499. <out:attribute name="checked">checked</out:attribute>
  500. </out:otherwise>
  501. </xsl:if>
  502. </out:choose>
  503. </input>
  504. </xsl:when>
  505. <xsl:when test="$control/@type = 'textarea'">
  506. <out:variable name="name" select="'{ $control/@ref }'"/>
  507. <textarea name="{ '{ $name }' }">
  508. <xsl:copy-of select="$control/@*[name() != 'ref' and name() != 'type']"/>
  509. <out:variable name="param" select="$params[@name = $name]"/>
  510. <out:choose>
  511. <out:when test="$param">
  512. <out:value-of select="$param"/>
  513. </out:when>
  514. <!-- check for authored defaults -->
  515. <xsl:choose>
  516. <xsl:when test="$control/value">
  517. <out:otherwise>
  518. <xsl:apply-templates select="$control/value/node()"/>
  519. </out:otherwise>
  520. </xsl:when>
  521. <xsl:when test="$control/@value">
  522. <out:otherwise>
  523. <xsl:value-of select="$control/@value"/>
  524. </out:otherwise>
  525. </xsl:when>
  526. </xsl:choose>
  527. </out:choose>
  528. </textarea>
  529. </xsl:when>
  530. <xsl:when test="$control/@type = 'select'">
  531. <!-- if param with same name and value, check -->
  532. <out:variable name="name" select="'{ $control/@ref }'"/>
  533. <out:variable name="value" select="'{ $control/@value }'"/>
  534. <select name="{ '{ $name }' }">
  535. <xsl:copy-of select="$control/@*[name() != 'ref']"/>
  536. <out:variable name="param" select="$params[@name = $name]"/>
  537. <out:if test="$param = $value">
  538. <out:attribute name="checked">checked</out:attribute>
  539. </out:if>
  540. </select>
  541. </xsl:when>
  542. <xsl:otherwise>
  543. <out:variable name="name" select="'{ $control/@ref }'"/>
  544. <input name="{ '{ $name }' }">
  545. <xsl:copy-of select="$control/@*[name() != 'ref' or name() != 'value']"/>
  546. <out:variable name="param" select="$params[@name = $name]"/>
  547. <out:variable name="default" select="$page/param[@name = $name]/value"/>
  548. <out:attribute name="value">
  549. <out:choose>
  550. <out:when test="$param">
  551. <out:value-of select="$param"/>
  552. </out:when>
  553. <out:when test="$default">
  554. <out:value-of select="$default"/>
  555. </out:when>
  556. <!-- check for authored defaults -->
  557. <xsl:choose>
  558. <xsl:when test="$control/value">
  559. <out:otherwise>
  560. <xsl:apply-templates select="$control/value/node()"/>
  561. </out:otherwise>
  562. </xsl:when>
  563. <xsl:when test="$control/@value">
  564. <out:otherwise>
  565. <xsl:value-of select="$control/@value"/>
  566. </out:otherwise>
  567. </xsl:when>
  568. </xsl:choose>
  569. </out:choose>
  570. </out:attribute>
  571. </input>
  572. </xsl:otherwise>
  573. </xsl:choose>
  574. </xsl:template>
  575. <xsl:template match="separator">
  576. <img alt="" src="{'{$webcontent}'}/images/space.gif">
  577. <xsl:copy-of select="@*"/>
  578. </img>
  579. </xsl:template>
  580. <xsl:template match="*|@*|text()|processing-instruction()" priority="-1">
  581. <xsl:copy>
  582. <xsl:apply-templates select="* | @* | text() | processing-instruction()"/>
  583. </xsl:copy>
  584. </xsl:template>
  585. </xsl:stylesheet>