formlogic_lite.xslt 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2022
  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:out="dummy-uri"
  15. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/">
  16. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  17. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  18. <xsl:variable name="utml-namespace-uri" select="'http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/'"/>
  19. <!--
  20. utml:form
  21. utml:input
  22. utml:checkbox
  23. utml:radio
  24. utml:password
  25. utml:hidden
  26. utml:textarea
  27. utml:select
  28. utml:option
  29. -->
  30. <!-- =========================================================== -->
  31. <!-- ========================= form ============================ -->
  32. <!-- =========================================================== -->
  33. <!--
  34. Just like formlogic formlogic lite will add evironment variables as
  35. that aren't in the current page as utml fields as hidden inputs
  36. - you can have fields not add a hidden input by defining an exclude or exclude prefix
  37. <utml:form ...
  38. <utml:exclude>excludefieldname</utml:exclude>
  39. <utml:exclude-prefix>excludeprefix</utml:excludeprefix>
  40. -->
  41. <xsl:template match="utml:form[namespace-uri() = $utml-namespace-uri]" priority="1">
  42. <form>
  43. <!-- copy non-utml attributes... -->
  44. <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
  45. <!-- define the delimiter so we know how tot get the tarked from the stack string -->
  46. <xsl:variable name="nav-stack-delimiter" select="'*'"/>
  47. <out:variable name="stack-down-target">
  48. <out:choose>
  49. <out:when test="contains(/root/env/param[@name='ps_nav_stack'], '{$nav-stack-delimiter}')">
  50. <out:value-of select="substring-before( /root/env/param[@name='ps_nav_stack'], '{$nav-stack-delimiter}' )"/>
  51. </out:when>
  52. <out:otherwise>
  53. <out:value-of select="/root/env/param[@name='ps_nav_stack']"/>
  54. </out:otherwise>
  55. </out:choose>
  56. </out:variable>
  57. <xsl:variable name="formName"><xsl:value-of select="@name"/></xsl:variable>
  58. <out:variable name="{$formName}form">
  59. <xsl:copy-of select="utml:read-only/child::node()"/>
  60. </out:variable>
  61. <!-- Output the JS snippet for the anchor -->
  62. <script language="JavaScript">
  63. <![CDATA[
  64. function needCustomHeader(formName)
  65. {
  66. var mPNotificationEMail = formName.m_p_notificationEMail;
  67. var m = formName.m;
  68. var psNavSource = formName.ps_nav_source;
  69. var prevPsNavSource = formName.prev_ps_nav_src;
  70. if ( mPNotificationEMail != undefined &&
  71. m != undefined && m.value.slice(-"submit.xts".length) === "submit.xts" &&
  72. psNavSource != undefined && psNavSource.value.slice(-"personal.xts".length) === "personal.xts" &&
  73. prevPsNavSource != undefined && prevPsNavSource.value.slice(-"general.xts".length) === "general.xts" ) {
  74. return true;
  75. }
  76. return false;
  77. }
  78. function getFormDataQueryString(form)
  79. {
  80. var keyValuePairs = [];
  81. for (var i = 0; i < form.elements.length; i++)
  82. {
  83. var element = form.elements[i];
  84. keyValuePairs.push(encodeURIComponent(element.name) + "=" + encodeURIComponent(element.value));
  85. }
  86. return queryString = keyValuePairs.join("&");
  87. }
  88. ]]>
  89. function utmlSubmitForm(formName, targetPage, operation, dovalid)
  90. {
  91. if( dovalid != '' &amp;&amp; window.validate )
  92. {
  93. if( !validate() )
  94. return;
  95. }
  96. formName.ps_nav_op.value = operation;
  97. if (targetPage != '')
  98. formName.m.value = targetPage;
  99. else if (operation == 'pop' || operation == 'drop')
  100. formName.m.value = '<out:value-of select="xtsext:javascriptencode(string($stack-down-target))"/>';
  101. var isBidiEnabled = <out:value-of select="boolean($isBidiEnabled='true')"/>;
  102. if (isBidiEnabled){
  103. bidi.onsubmit(formName);
  104. }
  105. <!-- XSRF-TOKEN cookie is null when disableXSRFCheck=true in bootstrap.properties. -->
  106. var xsrfTokenCookie = getCookie("XSRF-TOKEN");
  107. if (xsrfTokenCookie &amp;&amp; operation == "submit" &amp;&amp; needCustomHeader(formName))
  108. {
  109. <!--
  110. CAPSIRTS-412 / MANAGECA-9864
  111. 1. Go to "Personal menu" > "My Watch Items" > "My Preferences" and "Personal".
  112. 2. Enter or change email address and click "OK".
  113. m_p_notificationEMail=...
  114. m=portal/submit.xts
  115. ps_nav_source=portal/preferences/personal.xts
  116. prev_ps_nav_src=portal/preferences/general.xts
  117. -->
  118. var xhr = new XMLHttpRequest();
  119. xhr.onreadystatechange = function()
  120. {
  121. if (xhr.readyState === 4)
  122. {
  123. document.write(xhr.responseText);
  124. document.close();
  125. }
  126. }
  127. xhr.open(formName.method, formName.action, false);
  128. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  129. xhr.setRequestHeader("X-XSRF-TOKEN", xsrfTokenCookie);
  130. xhr.send(getFormDataQueryString(formName));
  131. }
  132. else
  133. {
  134. formName.submit();
  135. }
  136. }
  137. </script>
  138. <!-- handle children... -->
  139. <xsl:apply-templates/>
  140. <!-- this will get all the current utml inputs -->
  141. <xsl:variable name="existence-test-string">
  142. <xsl:for-each select="//utml:input[not(@type = 'button' or type = 'button') and not( (@type = 'radio' or type = 'radio') and ancestor::*[name() = 'utml:radio-group'] )] | //utml:textarea | //utml:select | //utml:radio-group | //utml:change">
  143. <xsl:text/> and @name != '<xsl:value-of select="./@name"/>' <xsl:text/>
  144. </xsl:for-each>
  145. </xsl:variable>
  146. <out:variable name="other-excludes">
  147. <xsl:for-each select="//utml:form/utml:excludes">
  148. <xsl:value-of select="concat(' ', normalize-space(.), ' ')"/>
  149. </xsl:for-each>
  150. </out:variable>
  151. <!-- this will allow you to specigy a prefix to exclude hidden inputs for -->
  152. <xsl:variable name="exclude-prefix">
  153. <xsl:choose>
  154. <xsl:when test="utml:exclude-prefix">
  155. <xsl:copy-of select="utml:exclude-prefix"/>
  156. </xsl:when>
  157. <xsl:otherwise>
  158. <xsl:value-of select="'do_not_include_this_entry_'"/>
  159. </xsl:otherwise>
  160. </xsl:choose>
  161. </xsl:variable>
  162. <!-- loop through the environment and add hidden inputs for unused info to be passed along -->
  163. <out:for-each select="/root/env/param[not(starts-with( @name, '{$exclude-prefix}' ))]">
  164. <out:if test="@name != '' {$existence-test-string} and not(contains($other-excludes, concat(' ', @name, ' ')))">
  165. <input type="hidden">
  166. <xsl:attribute name="name"><xsl:value-of select="'{@name}'"/></xsl:attribute>
  167. <xsl:attribute name="value"><xsl:value-of select="'{.}'"/></xsl:attribute>
  168. </input>
  169. </out:if>
  170. </out:for-each>
  171. <!-- UTML navigation control fields: Add those to the page if they do not exist already. -->
  172. <!-- Navigation instruction for stacked dialogs. -->
  173. <xsl:if test="not(//utml:input[@name = 'ps_nav_op' or name = 'ps_nav_op']) ">
  174. <out:if test="not( /root/env/param[@name = 'ps_nav_op'] )">
  175. <input type="hidden" name="ps_nav_op" value=""/>
  176. </out:if>
  177. </xsl:if>
  178. <!-- Comma-delimited list of template names representing a set of stacked dialogs resulting from a "push" or a "stack-up" navigation operations. -->
  179. <xsl:if test="not(//utml:input[@name = 'ps_nav_stack' or name = 'ps_nav_stack']) ">
  180. <out:if test="not( /root/env/param[@name = 'ps_nav_stack'] )">
  181. <input type="hidden" name="ps_nav_stack" value=""/>
  182. </out:if>
  183. </xsl:if>
  184. <!-- The name of the current template. This is used by formlogic-init to determine where we came from to update the navigation stack. -->
  185. <xsl:if test="not(//utml:input[@name = 'ps_nav_source' or name = 'ps_nav_source']) ">
  186. <out:if test="not( /root/env/param[@name = 'ps_nav_source'] )">
  187. <input type="hidden" name="ps_nav_source">
  188. <xsl:attribute name="value">{/root/env/param[@name = 'm']}</xsl:attribute>
  189. </input>
  190. </out:if>
  191. </xsl:if>
  192. <xsl:if test="not(//utml:input[@name = 'prev_ps_nav_src' or name = 'prev_ps_nav_src']) ">
  193. <out:if test="not( /root/env/param[@name = 'prev_ps_nav_src'] )">
  194. <input type="hidden" name="prev_ps_nav_src">
  195. <xsl:attribute name="value">{/root/env/param[@name = 'm']}</xsl:attribute>
  196. </input>
  197. </out:if>
  198. </xsl:if>
  199. </form>
  200. </xsl:template>
  201. <!-- ========================================================== -->
  202. <!-- ======================= Input ============================ -->
  203. <!-- ========================================================== -->
  204. <!--
  205. <utml:input type="text|password|hidden" name="fieldname" (value="fieldvalue") utml:update="false|true">
  206. <utml:read-only>....</utml:read-only>
  207. (<utml:value>....</utml:value>) - other place for value
  208. </utml:input>
  209. Notes:
  210. -not having a readonly node will cut a lot of code out during the compile
  211. -value can be listed as an attribute or a child node
  212. -update will make the code smaller when set to false, this will not grab
  213. the environment value for the variable if found
  214. -->
  215. <xsl:template match="utml:input[(@type = 'text') or (@type = 'password') or (@type = 'hidden')]" priority="1">
  216. <!-- if there isn't a readonly node don't include the extra logic into the stylesheet -->
  217. <xsl:choose>
  218. <xsl:when test="((utml:read-only) or (ancestor::*[name() = 'utml:form']/utml:read-only) or (ancestor::*[name() = 'utml:group']/utml:read-only)) and not (@type = 'hidden')">
  219. <out:variable name="{@name}read-only">
  220. <xsl:choose>
  221. <xsl:when test="(utml:read-only)">
  222. <xsl:copy-of select="utml:read-only/child::node()"/>
  223. </xsl:when>
  224. <xsl:when test="(ancestor::*[name() = 'utml:group']/utml:read-only/child::node())">
  225. <xsl:copy-of select="ancestor::*[name() = 'utml:group']/utml:read-only/child::node()"/>
  226. </xsl:when>
  227. <xsl:otherwise>
  228. <xsl:copy-of select="ancestor::*[name() = 'utml:form']/utml:read-only/child::node()"/>
  229. </xsl:otherwise>
  230. </xsl:choose>
  231. </out:variable>
  232. <out:choose>
  233. <out:when test="${@name}read-only = 'true'">
  234. <xsl:choose>
  235. <xsl:when test="@type = 'password'">********</xsl:when>
  236. <xsl:otherwise>
  237. <xsl:call-template name="input-value">
  238. <xsl:with-param name="node" select="."/>
  239. </xsl:call-template>
  240. </xsl:otherwise>
  241. </xsl:choose>
  242. </out:when>
  243. <out:otherwise>
  244. <xsl:call-template name="render-input">
  245. <xsl:with-param name="node" select="."/>
  246. </xsl:call-template>
  247. </out:otherwise>
  248. </out:choose>
  249. </xsl:when>
  250. <xsl:otherwise>
  251. <xsl:call-template name="render-input">
  252. <xsl:with-param name="node" select="."/>
  253. </xsl:call-template>
  254. </xsl:otherwise>
  255. </xsl:choose>
  256. </xsl:template>
  257. <!-- render the input field again using all the original attributes -->
  258. <xsl:template name="render-input">
  259. <xsl:param name="node"/>
  260. <input>
  261. <xsl:copy-of select="@*[(local-name() != 'value') and namespace-uri() != $utml-namespace-uri]"/>
  262. <!-- bidi -->
  263. <out:variable name="updatedValue">
  264. <xsl:choose>
  265. <xsl:when test="@utml:update='false'">
  266. <xsl:call-template name="get-value">
  267. <xsl:with-param name="node" select="$node"/>
  268. </xsl:call-template>
  269. </xsl:when>
  270. <xsl:otherwise>
  271. <xsl:call-template name="input-value">
  272. <xsl:with-param name="node" select="$node"/>
  273. </xsl:call-template>
  274. </xsl:otherwise>
  275. </xsl:choose>
  276. </out:variable>
  277. <out:attribute name="value">
  278. <out:value-of select="$updatedValue"/>
  279. </out:attribute>
  280. <out:variable name="textDirection">
  281. <out:choose>
  282. <out:when test="$isBidiEnabled != 'true'"></out:when>
  283. <out:otherwise>
  284. <xsl:choose>
  285. <xsl:when test="$node[@dir]"></xsl:when>
  286. <xsl:when test="$node[@stttype]">stt</xsl:when>
  287. <xsl:otherwise>
  288. <out:value-of select="xtsext:getBTD(string($updatedValue), $baseTextDirection, $productLocale)"/>
  289. </xsl:otherwise>
  290. </xsl:choose>
  291. </out:otherwise>
  292. </out:choose>
  293. </out:variable>
  294. <xsl:if test="$node[@type = 'text']">
  295. <out:if test="$textDirection != ''">
  296. <out:choose>
  297. <out:when test="$textDirection = 'stt'">
  298. <out:attribute name="dir">ltr</out:attribute>
  299. </out:when>
  300. <out:otherwise>
  301. <out:attribute name="dir">
  302. <out:value-of select="$textDirection"/>
  303. </out:attribute>
  304. </out:otherwise>
  305. </out:choose>
  306. <out:if test="$textDirection = 'stt' or $baseTextDirection = 'auto'">
  307. <xsl:choose>
  308. <xsl:when test="$node[@onfocus]">
  309. <out:attribute name="onfocus">
  310. <xsl:value-of select="concat('bidi.onfocus(this);',$node[@onfocus])"/>
  311. </out:attribute>
  312. </xsl:when>
  313. <xsl:otherwise>
  314. <out:attribute name="onfocus">
  315. <out:text>bidi.onfocus(this)</out:text>
  316. </out:attribute>
  317. </xsl:otherwise>
  318. </xsl:choose>
  319. </out:if>
  320. </out:if>
  321. </xsl:if>
  322. <xsl:apply-templates/>
  323. </input>
  324. </xsl:template>
  325. <!-- render the input field again using all the original attributes -->
  326. <xsl:template name="render-textarea">
  327. <xsl:param name="node"/>
  328. <textarea>
  329. <xsl:copy-of select="@*[(local-name() != 'value') and namespace-uri() != $utml-namespace-uri]"/>
  330. <out:variable name="updatedValue">
  331. <xsl:choose>
  332. <xsl:when test="@utml:update='false'">
  333. <xsl:call-template name="get-value">
  334. <xsl:with-param name="node" select="$node"/>
  335. </xsl:call-template>
  336. </xsl:when>
  337. <xsl:otherwise>
  338. <xsl:call-template name="input-value">
  339. <xsl:with-param name="node" select="$node"/>
  340. </xsl:call-template>
  341. </xsl:otherwise>
  342. </xsl:choose>
  343. </out:variable>
  344. <out:variable name="textDirection">
  345. <out:choose>
  346. <out:when test="$isBidiEnabled != 'true'"></out:when>
  347. <out:otherwise>
  348. <xsl:choose>
  349. <xsl:when test="$node[@dir]"></xsl:when>
  350. <xsl:when test="$node[@stttype]">stt</xsl:when>
  351. <xsl:otherwise>
  352. <out:value-of select="xtsext:getBTD(string($updatedValue), $baseTextDirection, $productLocale)"/>
  353. </xsl:otherwise>
  354. </xsl:choose>
  355. </out:otherwise>
  356. </out:choose>
  357. </out:variable>
  358. <out:if test="$textDirection != ''">
  359. <out:choose>
  360. <out:when test="$textDirection = 'stt'">
  361. <out:attribute name="dir">ltr</out:attribute>
  362. </out:when>
  363. <out:otherwise>
  364. <out:attribute name="dir">
  365. <out:value-of select="$textDirection"/>
  366. </out:attribute>
  367. </out:otherwise>
  368. </out:choose>
  369. <out:if test="$textDirection = 'stt' or $baseTextDirection = 'auto'">
  370. <xsl:choose>
  371. <xsl:when test="$node[@onfocus]">
  372. <out:attribute name="onfocus">
  373. <xsl:value-of select="concat('bidi.onfocus(this);',$node[@onfocus])"/>
  374. </out:attribute>
  375. </xsl:when>
  376. <xsl:otherwise>
  377. <out:attribute name="onfocus">
  378. <out:text>bidi.onfocus(this)</out:text>
  379. </out:attribute>
  380. </xsl:otherwise>
  381. </xsl:choose>
  382. </out:if>
  383. </out:if>
  384. <out:value-of select="$updatedValue"/>
  385. <xsl:apply-templates/>
  386. </textarea>
  387. </xsl:template>
  388. <!-- find out where you should get the value from -->
  389. <xsl:template name="input-value">
  390. <xsl:param name="node"/>
  391. <out:choose>
  392. <out:when test="/root/env/param[@name = '{$node/@name}']">
  393. <out:value-of select="/root/env/param[@name = '{$node/@name}']"/>
  394. </out:when>
  395. <out:otherwise>
  396. <xsl:call-template name="get-value">
  397. <xsl:with-param name="node" select="$node"/>
  398. </xsl:call-template>
  399. </out:otherwise>
  400. </out:choose>
  401. </xsl:template>
  402. <!-- is compile time code to find out where you put the value -->
  403. <xsl:template name="get-value">
  404. <xsl:param name="node"/>
  405. <xsl:choose>
  406. <xsl:when test="$node/@value">
  407. <xsl:value-of select="$node/@value"/>
  408. </xsl:when>
  409. <xsl:when test="$node/@utml:value">
  410. <out:value-of select="{$node/@utml:value}"/>
  411. </xsl:when>
  412. <xsl:when test="$node/utml:value">
  413. <xsl:copy-of select="$node/utml:value/child::node()"/>
  414. </xsl:when>
  415. <xsl:otherwise>
  416. <xsl:apply-templates/>
  417. </xsl:otherwise>
  418. </xsl:choose>
  419. </xsl:template>
  420. <!-- ============================================================== -->
  421. <!-- ========================= Textarea =========================== -->
  422. <!-- ============================================================== -->
  423. <!--
  424. <utml:textarea name="fieldname" (value="fieldvalue") utml:update="false|true">
  425. <utml:read-only>....</utml:read-only>
  426. (<utml:value>....</utml:value>) - other place for value
  427. </utml:input>
  428. Notes:
  429. -not having a readonly node will cut a lot of code out during the compile
  430. -value can be listed as an attribute or a child node
  431. -update will make the code smaller when set to false, this will not grab
  432. the environment value for the variable if found
  433. -->
  434. <xsl:template match="utml:textarea[namespace-uri() = $utml-namespace-uri]" priority="1">
  435. <!-- if there isn't a readonly node don't include the extra logic into the stylesheet -->
  436. <xsl:choose>
  437. <xsl:when test="(utml:read-only) or (ancestor::*[name() = 'utml:form']/utml:read-only) or (ancestor::*[name() = 'utml:group']/utml:read-only)">
  438. <out:variable name="{@name}read-only">
  439. <xsl:choose>
  440. <xsl:when test="(utml:read-only)">
  441. <xsl:copy-of select="utml:read-only/child::node()"/>
  442. </xsl:when>
  443. <xsl:when test="(ancestor::*[name() = 'utml:group']/utml:read-only/child::node())">
  444. <xsl:copy-of select="ancestor::*[name() = 'utml:group']/utml:read-only/child::node()"/>
  445. </xsl:when>
  446. <xsl:otherwise>
  447. <xsl:copy-of select="ancestor::*[name() = 'utml:form']/utml:read-only/child::node()"/>
  448. </xsl:otherwise>
  449. </xsl:choose>
  450. </out:variable>
  451. <out:choose>
  452. <out:when test="${@name}read-only = 'true'">
  453. <xsl:call-template name="input-value">
  454. <xsl:with-param name="node" select="."/>
  455. </xsl:call-template>
  456. </out:when>
  457. <out:otherwise>
  458. <xsl:call-template name="render-textarea">
  459. <xsl:with-param name="node" select="."/>
  460. </xsl:call-template>
  461. </out:otherwise>
  462. </out:choose>
  463. </xsl:when>
  464. <xsl:otherwise>
  465. <xsl:call-template name="render-textarea">
  466. <xsl:with-param name="node" select="."/>
  467. </xsl:call-template>
  468. </xsl:otherwise>
  469. </xsl:choose>
  470. </xsl:template>
  471. <!-- =============================================== -->
  472. <!-- ================= Radio Group ================= -->
  473. <!-- =============================================== -->
  474. <!--
  475. <utml:radio-group name="radiobuttonsfieldname">
  476. <utml:read-only>....</utml:read-only>
  477. <utml:default-value>....</utml:default-value>
  478. ...
  479. </utml:radio-group>
  480. Notes:
  481. -the variables created for this will use the name of the group as a prefix
  482. -default-value allows you to specify the default selected value
  483. -readonly can be set for the entire group of individual buttons
  484. -->
  485. <xsl:template match="utml:radio-group" priority="1">
  486. <!-- this will prefix all the radio group variable so they have unique names -->
  487. <xsl:variable name="group-prefix">
  488. <xsl:choose>
  489. <xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when>
  490. <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
  491. </xsl:choose>
  492. </xsl:variable>
  493. <out:variable name="{$group-prefix}read-only">
  494. <xsl:choose>
  495. <xsl:when test="(utml:read-only)">
  496. <xsl:copy-of select="utml:read-only/child::node()"/>
  497. </xsl:when>
  498. <xsl:when test="(ancestor::*[name() = 'utml:group']/utml:read-only/child::node())">
  499. <xsl:copy-of select="ancestor::*[name() = 'utml:group']/utml:read-only/child::node()"/>
  500. </xsl:when>
  501. <xsl:otherwise>
  502. <xsl:copy-of select="ancestor::*[name() = 'utml:form']/utml:read-only/child::node()"/>
  503. </xsl:otherwise>
  504. </xsl:choose>
  505. </out:variable>
  506. <out:variable name="{$group-prefix}checked-value">
  507. <out:choose>
  508. <out:when test="key('env-param', '{@name}')"><out:value-of select="key('env-param', '{@name}')"/></out:when>
  509. <out:otherwise><xsl:copy-of select="utml:default-value/child::node()"/></out:otherwise>
  510. </out:choose>
  511. </out:variable>
  512. <xsl:apply-templates/>
  513. </xsl:template>
  514. <!-- =============================================== -->
  515. <!-- ===================== Radio =================== -->
  516. <!-- =============================================== -->
  517. <!--
  518. <utml:input type="radio" (value="fieldvalue") *name="radiobuttonsfieldname"> *- if named make if the same as the group
  519. <utml:read-only>....</utml:read-only>
  520. (<utml:value>....</utml:value>) - other place for the value
  521. ...
  522. </utml:radio-group>
  523. Notes:
  524. -if the value of the radio button isn't dynamic use the attribute and the code becomes smaller
  525. -->
  526. <xsl:template match="utml:input[(@type = 'radio')]" priority="1">
  527. <!-- the button names should match that of the group so all group variables will need this prefix -->
  528. <xsl:variable name="group-prefix">
  529. <xsl:choose>
  530. <xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when>
  531. <xsl:otherwise><xsl:value-of select="ancestor::*[name() = 'utml:radio-group']/@name"/></xsl:otherwise>
  532. </xsl:choose>
  533. </xsl:variable>
  534. <!-- if it isn't readonly and the value is hardcoded don't add extra logic -->
  535. <xsl:choose>
  536. <xsl:when test="@value and not((ancestor::*[name() = 'utml:radio-group']/utml:read-only) or (ancestor::*[name() = 'utml:form']/utml:read-only))">
  537. <input name="{$group-prefix}">
  538. <xsl:copy-of select="@*[(local-name() != 'checked') and (local-name() != 'name') and namespace-uri() != $utml-namespace-uri]"/>
  539. <out:if test="'{@value}' = ${$group-prefix}checked-value"><out:attribute name="checked">checked</out:attribute></out:if>
  540. <xsl:apply-templates/>
  541. </input>
  542. </xsl:when>
  543. <xsl:otherwise>
  544. <xsl:variable name="radio-prefix">
  545. <xsl:value-of select="concat($group-prefix, position())"/>
  546. </xsl:variable>
  547. <out:variable name="{$radio-prefix}value">
  548. <xsl:call-template name="get-value">
  549. <xsl:with-param name="node" select="."/>
  550. </xsl:call-template>
  551. </out:variable>
  552. <xsl:choose>
  553. <xsl:when test="(ancestor::*[name() = 'utml:radio-group']/utml:read-only) or (ancestor::*[name() = 'utml:form']/utml:read-only) or (ancestor::*[name() = 'utml:group']/utml:read-only)">
  554. <out:choose>
  555. <out:when test="${$group-prefix}read-only = 'true'">
  556. <img>
  557. <out:attribute name="src">
  558. <out:value-of select="$image_root"/>icon_disabled_radio_<out:if test="${$radio-prefix}value != ${$group-prefix}checked-value">un</out:if>checked.gif</out:attribute>
  559. </img>
  560. </out:when>
  561. <out:otherwise>
  562. <input name="{$group-prefix}">
  563. <xsl:copy-of select="@*[(local-name() != 'value') and (local-name() != 'name') and (local-name() != 'checked') and namespace-uri() != $utml-namespace-uri]"/>
  564. <out:attribute name="value">
  565. <xsl:call-template name="input-value">
  566. <xsl:with-param name="node" select="."/>
  567. </xsl:call-template>
  568. </out:attribute>
  569. <out:if test="${$radio-prefix}value = ${$group-prefix}checked-value"><out:attribute name="checked">checked</out:attribute></out:if>
  570. <xsl:apply-templates/>
  571. </input>
  572. </out:otherwise>
  573. </out:choose>
  574. </xsl:when>
  575. <xsl:otherwise>
  576. <input name="{$group-prefix}">
  577. <xsl:copy-of select="@*[(local-name() != 'value') and (local-name() != 'name') and (local-name() != 'checked') and namespace-uri() != $utml-namespace-uri]"/>
  578. <out:attribute name="value">
  579. <xsl:call-template name="input-value">
  580. <xsl:with-param name="node" select="."/>
  581. </xsl:call-template>
  582. </out:attribute>
  583. <out:if test="${$radio-prefix}value = ${$group-prefix}checked-value"><out:attribute name="checked">checked</out:attribute></out:if>
  584. <xsl:apply-templates/>
  585. </input>
  586. </xsl:otherwise>
  587. </xsl:choose>
  588. </xsl:otherwise>
  589. </xsl:choose>
  590. </xsl:template>
  591. <!-- =============================================== -->
  592. <!-- ================== Checkbox =================== -->
  593. <!-- =============================================== -->
  594. <!--
  595. <utml:input type="checkbox" name="fieldname" (value="fieldvalue")>
  596. <utml:read-only>....</utml:read-only>
  597. (<utml:value>....</utml:value>) - other place for value
  598. </utml:input>
  599. Notes:
  600. -if the value of the checkbox isn't dynamic use the attribute and the code becomes smaller
  601. -->
  602. <xsl:template match="utml:input[(@type = 'checkbox')]" priority="1">
  603. <xsl:variable name="checkbox-prefix">
  604. <xsl:value-of select="concat(@name, '-')"/>
  605. </xsl:variable>
  606. <out:variable name="{$checkbox-prefix}checked-value">
  607. <out:choose>
  608. <out:when test="key('env-param', '{@name}')"><out:value-of select="key('env-param', '{@name}')"/></out:when>
  609. <out:otherwise><xsl:copy-of select="utml:default-value/child::node()"/></out:otherwise>
  610. </out:choose>
  611. </out:variable>
  612. <!-- if it isn't readonly and the value is hardcoded don't add extra logic -->
  613. <xsl:choose>
  614. <xsl:when test="@value and not((utml:read-only) or (ancestor::*[name() = 'utml:form']/utml:read-only) or (ancestor::*[name() = 'utml:group']/utml:read-only))">
  615. <input>
  616. <xsl:copy-of select="@*[(local-name() != 'checked') and namespace-uri() != $utml-namespace-uri]"/>
  617. <out:if test="'{@value}' = ${$checkbox-prefix}checked-value"><out:attribute name="checked">checked</out:attribute></out:if>
  618. <xsl:apply-templates/>
  619. </input>
  620. </xsl:when>
  621. <xsl:otherwise>
  622. <out:variable name="{$checkbox-prefix}value">
  623. <xsl:call-template name="get-value">
  624. <xsl:with-param name="node" select="."/>
  625. </xsl:call-template>
  626. </out:variable>
  627. <xsl:choose>
  628. <xsl:when test="(utml:read-only) or (ancestor::*[name() = 'utml:form']/utml:read-only) or (ancestor::*[name() = 'utml:group']/utml:read-only)">
  629. <out:variable name="{$checkbox-prefix}read-only">
  630. <xsl:choose>
  631. <xsl:when test="(utml:read-only)">
  632. <xsl:copy-of select="utml:read-only/child::node()"/>
  633. </xsl:when>
  634. <xsl:when test="(ancestor::*[name() = 'utml:group']/utml:read-only/child::node())">
  635. <xsl:copy-of select="ancestor::*[name() = 'utml:group']/utml:read-only/child::node()"/>
  636. </xsl:when>
  637. <xsl:otherwise>
  638. <xsl:copy-of select="ancestor::*[name() = 'utml:form']/utml:read-only/child::node()"/>
  639. </xsl:otherwise>
  640. </xsl:choose>
  641. </out:variable>
  642. <out:choose>
  643. <out:when test="${$checkbox-prefix}read-only = 'true'">
  644. <img>
  645. <out:attribute name="src">
  646. <out:value-of select="$image_root"/>icon_disabled_checkbox_<out:if test="${$checkbox-prefix}checked-value != ${$checkbox-prefix}value">un</out:if>checked.gif</out:attribute>
  647. </img>
  648. </out:when>
  649. <out:otherwise>
  650. <input>
  651. <xsl:copy-of select="@*[(local-name() != 'value') and (local-name() != 'checked') and namespace-uri() != $utml-namespace-uri]"/>
  652. <out:attribute name="value">
  653. <xsl:call-template name="input-value">
  654. <xsl:with-param name="node" select="."/>
  655. </xsl:call-template>
  656. </out:attribute>
  657. <out:if test="${$checkbox-prefix}checked-value = ${$checkbox-prefix}value"><out:attribute name="checked">checked</out:attribute></out:if>
  658. <xsl:apply-templates/>
  659. </input>
  660. </out:otherwise>
  661. </out:choose>
  662. </xsl:when>
  663. <xsl:otherwise>
  664. <input>
  665. <xsl:copy-of select="@*[(local-name() != 'value') and (local-name() != 'checked') and namespace-uri() != $utml-namespace-uri]"/>
  666. <out:attribute name="value">
  667. <xsl:call-template name="input-value">
  668. <xsl:with-param name="node" select="."/>
  669. </xsl:call-template>
  670. </out:attribute>
  671. <out:if test="string(${$checkbox-prefix}value) = ${$checkbox-prefix}checked-value"><out:attribute name="checked">checked</out:attribute></out:if>
  672. <xsl:apply-templates/>
  673. </input>
  674. </xsl:otherwise>
  675. </xsl:choose>
  676. </xsl:otherwise>
  677. </xsl:choose>
  678. </xsl:template>
  679. <!-- ================================================ -->
  680. <!-- ===================== Select =================== -->
  681. <!-- ================================================ -->
  682. <!--
  683. <utml:select name="fieldname">
  684. <utml:read-only>....</utml:read-only>
  685. <utml:default-value>....</utml:default-value>
  686. ...
  687. </utml:select>
  688. Notes:
  689. -the variables created for this will use the name as a prefix
  690. -default-value allows you to specify the default selected value
  691. -->
  692. <xsl:template match="utml:select" priority="1">
  693. <xsl:variable name="group-prefix">
  694. <xsl:choose>
  695. <xsl:when test="@name"><xsl:value-of select="concat(@name, '-')"/></xsl:when>
  696. <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
  697. </xsl:choose>
  698. </xsl:variable>
  699. <out:variable name="{$group-prefix}read-only">
  700. <xsl:choose>
  701. <xsl:when test="(utml:read-only)">
  702. <xsl:copy-of select="utml:read-only/child::node()"/>
  703. </xsl:when>
  704. <xsl:when test="(ancestor::*[name() = 'utml:group']/utml:read-only/child::node())">
  705. <xsl:copy-of select="ancestor::*[name() = 'utml:group']/utml:read-only/child::node()"/>
  706. </xsl:when>
  707. <xsl:otherwise>
  708. <xsl:copy-of select="ancestor::*[name() = 'utml:form']/utml:read-only/child::node()"/>
  709. </xsl:otherwise>
  710. </xsl:choose>
  711. </out:variable>
  712. <out:variable name="{$group-prefix}selected-value">
  713. <out:choose>
  714. <out:when test="key('env-param', '{@name}')"><out:value-of select="key('env-param', '{@name}')"/></out:when>
  715. <out:otherwise><xsl:copy-of select="utml:default-value/child::node()"/></out:otherwise>
  716. </out:choose>
  717. </out:variable>
  718. <xsl:choose>
  719. <xsl:when test="(utml:read-only) or (ancestor::*[name() = 'utml:form']/utml:read-only) or (ancestor::*[name() = 'utml:group']/utml:read-only)">
  720. <out:choose>
  721. <out:when test="${$group-prefix}read-only = 'true'">
  722. <xsl:apply-templates/>
  723. </out:when>
  724. <out:otherwise>
  725. <select>
  726. <xsl:copy-of select="@*[(local-name() != 'default-value') and (local-name() != 'readonly') and namespace-uri() != $utml-namespace-uri]"/>
  727. <xsl:apply-templates/>
  728. </select>
  729. </out:otherwise>
  730. </out:choose>
  731. </xsl:when>
  732. <xsl:otherwise>
  733. <select>
  734. <xsl:copy-of select="@*[(local-name() != 'default-value') and (local-name() != 'readonly') and namespace-uri() != $utml-namespace-uri]"/>
  735. <xsl:apply-templates/>
  736. </select>
  737. </xsl:otherwise>
  738. </xsl:choose>
  739. </xsl:template>
  740. <!-- ================================================ -->
  741. <!-- ===================== Option =================== -->
  742. <!-- ================================================ -->
  743. <!--
  744. <utml:option (value="fieldvalue")>
  745. (<utml:value>....</utml:value>) - other place for value
  746. </utml:input>
  747. Notes:
  748. -if the value of the option isn't dynamic use the attribute and the code becomes smaller
  749. -->
  750. <xsl:template match="utml:option" priority="1">
  751. <xsl:variable name="group-prefix">
  752. <xsl:value-of select="concat(ancestor::*[name() = 'utml:select']/@name, '-')"/>
  753. </xsl:variable>
  754. <!-- out:value-of select="'test124'"/>
  755. <out:value-of select="${$group-prefix}selected-value"/>
  756. <out:value-of select="'{@value}'"/ -->
  757. <!-- this will try and streamline the code for when the value is hardcoded and not generated -->
  758. <xsl:choose>
  759. <xsl:when test="(ancestor::*[name() = 'utml:select']/utml:read-only) or (ancestor::*[name() = 'utml:form']/utml:read-only) or (ancestor::*[name() = 'utml:group']/utml:read-only)">
  760. <out:choose>
  761. <out:when test="${$group-prefix}read-only = 'true'">
  762. <xsl:choose>
  763. <xsl:when test="@value">
  764. <out:if test="'{@value}' = ${$group-prefix}selected-value">
  765. <xsl:apply-templates/>
  766. </out:if>
  767. </xsl:when>
  768. <xsl:otherwise>
  769. <xsl:variable name="option-prefix">
  770. <xsl:value-of select="concat($group-prefix, position())"/>
  771. </xsl:variable>
  772. <out:variable name="{$option-prefix}value">
  773. <xsl:call-template name="get-value">
  774. <xsl:with-param name="node" select="."/>
  775. </xsl:call-template>
  776. </out:variable>
  777. <out:if test="${$option-prefix}value = ${$group-prefix}selected-value">
  778. <xsl:apply-templates/>
  779. </out:if>
  780. </xsl:otherwise>
  781. </xsl:choose>
  782. </out:when>
  783. <out:otherwise>
  784. <xsl:choose>
  785. <xsl:when test="@value">
  786. <option>
  787. <xsl:copy-of select="@*[(local-name() != 'selected') and namespace-uri() != $utml-namespace-uri]"/>
  788. <out:if test="'{@value}' = ${$group-prefix}selected-value"><out:attribute name="selected">true</out:attribute></out:if>
  789. <xsl:apply-templates/>
  790. </option>
  791. </xsl:when>
  792. <xsl:otherwise>
  793. <xsl:variable name="option-prefix">
  794. <xsl:value-of select="concat($group-prefix, position())"/>
  795. </xsl:variable>
  796. <out:variable name="{$option-prefix}value">
  797. <xsl:call-template name="get-value">
  798. <xsl:with-param name="node" select="."/>
  799. </xsl:call-template>
  800. </out:variable>
  801. <option>
  802. <xsl:copy-of select="@*[(local-name() != 'selected') and (local-name() != 'value') and namespace-uri() != $utml-namespace-uri]"/>
  803. <out:attribute name="value"><out:value-of select="${$option-prefix}value"/></out:attribute>
  804. <out:if test="${$option-prefix}value = ${$group-prefix}selected-value"><out:attribute name="selected">true</out:attribute></out:if>
  805. <xsl:apply-templates/>
  806. </option>
  807. </xsl:otherwise>
  808. </xsl:choose>
  809. </out:otherwise>
  810. </out:choose>
  811. </xsl:when>
  812. <xsl:otherwise>
  813. <xsl:choose>
  814. <xsl:when test="@value">
  815. <option>
  816. <xsl:copy-of select="@*[(local-name() != 'selected') and namespace-uri() != $utml-namespace-uri]"/>
  817. <out:if test="'{@value}' = ${$group-prefix}selected-value"><out:attribute name="selected">true</out:attribute></out:if>
  818. <xsl:apply-templates/>
  819. </option>
  820. </xsl:when>
  821. <xsl:otherwise>
  822. <xsl:variable name="option-prefix">
  823. <xsl:value-of select="concat($group-prefix, position())"/>
  824. </xsl:variable>
  825. <out:variable name="{$option-prefix}value">
  826. <xsl:call-template name="get-value">
  827. <xsl:with-param name="node" select="."/>
  828. </xsl:call-template>
  829. </out:variable>
  830. <option>
  831. <xsl:copy-of select="@*[(local-name() != 'selected') and (local-name() != 'value') and namespace-uri() != $utml-namespace-uri]"/>
  832. <out:attribute name="value"><out:value-of select="${$option-prefix}value"/></out:attribute>
  833. <out:if test="${$option-prefix}value = ${$group-prefix}selected-value"><out:attribute name="selected">true</out:attribute></out:if>
  834. <xsl:apply-templates/>
  835. </option>
  836. </xsl:otherwise>
  837. </xsl:choose>
  838. </xsl:otherwise>
  839. </xsl:choose>
  840. </xsl:template>
  841. <!-- ================================================ -->
  842. <!-- ===================== A:HREF =================== -->
  843. <!-- ================================================ -->
  844. <!--
  845. <utml:a (href="javascriptfunction") (utml:op="operation") *utml:formName="pform"> * - not needed when in a utml:form
  846. (<utml:href>....</utml:href>) - other place for href
  847. (<utml:op>....</utml:op>) - other place for operation
  848. </utml:input>
  849. Notes:
  850. -default operation is maintain
  851. -if you aren't directly inside a form use utml:formName to define the name - if you are it isn't needed
  852. -the href has to be a valid javascript call with ; at the end
  853. -->
  854. <xsl:template match="utml:a[namespace-uri() = $utml-namespace-uri]" priority="1">
  855. <!-- get the utml:op value, currently it can only be plain text... -->
  856. <xsl:variable name="op">
  857. <xsl:choose>
  858. <xsl:when test="./@utml:op = 'push' or ./@utml:op = 'stack-up'">
  859. <xsl:value-of select="'push'"/>
  860. </xsl:when>
  861. <xsl:when test="./@utml:op = 'pop' or ./@utml:op = 'stack-down'">
  862. <xsl:value-of select="'pop'"/>
  863. </xsl:when>
  864. <xsl:when test="./@utml:op = 'drop' or ./@utml:op = 'stack-down-save'">
  865. <xsl:value-of select="'drop'"/>
  866. </xsl:when>
  867. <xsl:when test="./@utml:op = 'submit'">
  868. <xsl:value-of select="'submit'"/>
  869. </xsl:when>
  870. <xsl:otherwise>
  871. <xsl:value-of select="'maintain'"/>
  872. </xsl:otherwise>
  873. </xsl:choose>
  874. </xsl:variable>
  875. <!-- get the defaultKey -->
  876. <xsl:variable name="utml-defaultKey">
  877. <xsl:if test="utml:defaultKey">
  878. <xsl:value-of select="utml:defaultKey"/>
  879. </xsl:if>
  880. </xsl:variable>
  881. <xsl:variable name="utml-defaultAct">
  882. <xsl:if test="utml:defaultAct">
  883. <xsl:value-of select="utml:defaultAct"/>
  884. </xsl:if>
  885. </xsl:variable>
  886. <!-- add key handlers for the link -->
  887. <xsl:variable name="utml-kbA11y">
  888. <xsl:if test="@utml:kbA11y">
  889. <xsl:value-of select="@utml:kbA11y"/>
  890. </xsl:if>
  891. </xsl:variable>
  892. <!-- get the target -->
  893. <xsl:variable name="utml-target">
  894. <xsl:choose>
  895. <xsl:when test="@utml:target"><xsl:value-of select="@utml:target"/></xsl:when>
  896. <xsl:when test="utml:target"><xsl:copy-of select="utml:target/child::node()"/></xsl:when>
  897. </xsl:choose>
  898. </xsl:variable>
  899. <!-- get the validate -->
  900. <xsl:variable name="utml-validate">
  901. <xsl:choose>
  902. <xsl:when test="@utml:validate"><xsl:value-of select="@utml:validate"/></xsl:when>
  903. <xsl:when test="utml:validate"><xsl:copy-of select="utml:validate/child::node()"/></xsl:when>
  904. </xsl:choose>
  905. </xsl:variable>
  906. <!-- get the href -->
  907. <xsl:variable name="utml-href">
  908. <xsl:choose>
  909. <xsl:when test="@utml:href"><xsl:value-of select="@utml:href"/></xsl:when>
  910. <xsl:when test="utml:href"><xsl:copy-of select="utml:href/child::node()"/></xsl:when>
  911. </xsl:choose>
  912. </xsl:variable>
  913. <!-- get the name of the parent form, necessary for setting form variables via JS -->
  914. <xsl:variable name="parent-form-name">
  915. <xsl:choose>
  916. <xsl:when test="ancestor::*[name() = 'utml:form' and namespace-uri() = $utml-namespace-uri]">
  917. <xsl:value-of select="ancestor::*[name() = 'utml:form' and namespace-uri() = $utml-namespace-uri]/@name"/>
  918. </xsl:when>
  919. <xsl:otherwise>
  920. <xsl:value-of select="@utml:formName"/>
  921. </xsl:otherwise>
  922. </xsl:choose>
  923. </xsl:variable>
  924. <xsl:if test="$utml-defaultKey='active'">
  925. <script language="JavaScript">
  926. function enterdfaultact()
  927. {
  928. var currentFocusEl = document.activeElement;
  929. if (currentFocusEl.tagName.toLowerCase()=='a' &amp;&amp; currentFocusEl.getAttribute("class") == 'showOnFocus'){
  930. return true;
  931. }
  932. <xsl:if test="$utml-defaultAct != ''"><out:value-of select="$utml-defaultAct"/></xsl:if>
  933. <xsl:text/><xsl:copy-of select="$utml-href"/><xsl:text/>
  934. utmlSubmitForm(document.<xsl:value-of select="$parent-form-name"/>,'<xsl:copy-of select="$utml-target"/>','<xsl:value-of select="$op"/>','<xsl:copy-of select="$utml-validate"/>');
  935. return false;
  936. }
  937. </script>
  938. </xsl:if>
  939. <!-- Output the HTML anchor -->
  940. <xsl:choose>
  941. <xsl:when test="string($utml-kbA11y)='true'">
  942. <a href="#">
  943. <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
  944. <out:attribute name="onclick">javascript:<xsl:copy-of select="$utml-href"/>utmlSubmitForm(document.<xsl:value-of select="$parent-form-name"/>,'<xsl:copy-of select="$utml-target"/>','<xsl:value-of select="$op"/>','<xsl:copy-of select="$utml-validate"/>');</out:attribute>
  945. <out:attribute name="onkeypress">javascript:if( event.keyCode==13 || event.keyCode==32 || event.charCode==32 )<xsl:text>{</xsl:text>this.onclick(); return false; <xsl:text>}</xsl:text> return true;</out:attribute>
  946. <xsl:apply-templates/>
  947. </a>
  948. </xsl:when>
  949. <xsl:otherwise>
  950. <!-- copy all non-utml attributes... -->
  951. <a>
  952. <xsl:if test="count(ancestor::*[@role='tablist'])">
  953. <out:attribute name="role">tab</out:attribute>
  954. <out:attribute name="aria-selected"><out:value-of select="$isTabSelected"/></out:attribute>
  955. </xsl:if>
  956. <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
  957. <out:attribute name="href">
  958. <out:text/>javascript:<xsl:copy-of select="$utml-href"/>utmlSubmitForm(document.<xsl:value-of select="$parent-form-name"/>,'<xsl:copy-of select="$utml-target"/>','<xsl:value-of select="$op"/>','<xsl:copy-of select="$utml-validate"/>');
  959. </out:attribute>
  960. <!--copy all non-utml child elements... -->
  961. <xsl:apply-templates/>
  962. </a>
  963. </xsl:otherwise>
  964. </xsl:choose>
  965. </xsl:template>
  966. <xsl:template match="utml:group[namespace-uri() = $utml-namespace-uri]" priority="1">
  967. <xsl:apply-templates/>
  968. </xsl:template>
  969. <!-- the main engine -->
  970. <xsl:template match="*[namespace-uri() = $utml-namespace-uri]" priority="0"/>
  971. <xsl:template match="*">
  972. <xsl:copy>
  973. <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
  974. <xsl:apply-templates/>
  975. </xsl:copy>
  976. </xsl:template>
  977. </xsl:stylesheet>