12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2022
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <xsl:stylesheet version="1.0" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:out="dummy-uri" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <xsl:variable name="utml-namespace-uri" select="'http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/'"/>
- <xsl:template match="/">
- <xsl:apply-templates/>
- </xsl:template>
- <!--
- eXtensible Form Markup Logicsheet 1.0
- Upfront Template Markup Language 3.0
- Copyright (c) 1998 - 2008 Cognos Inc.
-
- utml:form
- utml:input
- utml:textbox
- utml:checkbox
- utml:radio
- utml:password
- utml:hidden
- utml:textarea
- utml:select
- utml:option
-
- attributes
- utml:name
- utml:value
- utml:default-value
- utml:update
- utml:prefix
- utml:generate-cancel-form
-
- helper functions
- utml:subst
- utml:comment
- utml:dump-state
- -->
- <!--
- utml:form
- name
- method
- target
- action
- -->
- <xsl:template match="utml:form[namespace-uri() = $utml-namespace-uri]" priority="1">
- <!-- get the form name... -->
- <out:variable name="utml-form-name">
- <xsl:call-template name="get-utml-name">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <form>
- <!-- copy non-utml attributes... -->
- <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
- <!-- set the name... -->
- <out:attribute name="name">
- <out:value-of select="$utml-form-name"/>
- </out:attribute>
- <!-- determine if this ontrol needs to be rendered in read-only mode -->
- <out:variable name="form-read-only">
- <xsl:call-template name="get-utml-read-only">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- handle children... -->
- <xsl:apply-templates/>
- <!--
- the only constraint with prefixes is that if a relative path is given in any XPath expression the value will
- not be substituted. we have to define variables here so that they will be generated, and referencable below
- in the generated XSLT...this is necessary b/c the prefix could contain an XPath expression inside an xslt
- element, such as:
-
- <utml:input type="input" value="xxx">
- <utml:prefix>
- <xsl:text/>prefix1<xsl:text/>
- <xsl:value-of select="/root/env/param[@name = 'zzz']"/>
- </utml:prefix>
- </utml:input>
-
- if we don't define a variable and make its contents a copy of the original contents of the utml:prefix information
- will be lost.
- -->
- <xsl:for-each select="//utml:input[@utml:prefix or utml:prefix] | //utml:textarea[@utml:prefix or utml:prefix] | //utml:select[@utml:prefix or utml:prefix] | //utml:radio-group[@utml:prefix or utml:prefix]">
- <out:variable name="{concat( 'generated-id-', generate-id(.) )}">
- <xsl:call-template name="get-utml-prefix">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- </xsl:for-each>
- <!--
- build up the existence test string, this will be used to determine what query-values to create hidden inputs for,
- utml:prefix's take precedence over name, when doing the comparison. name can only be used when
- it is given as an attribute.
- -->
- <xsl:variable name="is-utml-exclusion-list" select="utml:exclusion-list"/>
-
- <xsl:variable name="existence-test-string">
-
- <xsl:variable name="test-string">
- <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">
- <xsl:if test="position() = 1">
- <xsl:text>not(</xsl:text>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="./@utml:prefix or ./utml:prefix">
- <xsl:text/>starts-with(@name, <xsl:value-of select="concat( '$generated-id-', generate-id(.) )"/>) or <xsl:text/>
- </xsl:when>
- <xsl:when test="./@name">
- <xsl:text/>( @name = '<xsl:value-of select="./@name"/>' or @name = '<xsl:value-of select="concat( 'tmp_chkbox_', ./@name )"/>' or @name = '<xsl:value-of select="concat( 'changed_', ./@name )"/>' ) or <xsl:text/>
- </xsl:when>
- </xsl:choose>
- <xsl:if test="position() = last()">
- <xsl:if test="$is-utml-exclusion-list">
- <xsl:text/>contains($utml-exclusion-list, concat(' ', @name, ' ')) or <xsl:text/>
- </xsl:if>
- <xsl:text/>starts-with(@name, 'h_CAM'))<xsl:text/>
- </xsl:if>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="$test-string = ''">
- <xsl:text/>true()<xsl:text/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$test-string"/>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:variable>
-
- <!-- copy all unused query-values into the form as hidden inputs... -->
- <xsl:if test="utml:exclusion-list">
- <out:variable name="utml-exclusion-list">
- <out:value-of select="' '"/>
- <xsl:copy-of select="utml:exclusion-list/child::node()"/>
- <out:value-of select="' '"/>
- </out:variable>
- </xsl:if>
-
- <!-- this will allow you to specify other fields to exclude in the automatic building of the hidden inputs -->
- <out:variable name="other-excludes">
- <xsl:for-each select="//utml:form/utml:excludes">
- <xsl:value-of select="concat(' ', normalize-space(.), ' ')"/>
- </xsl:for-each>
- </out:variable>
-
- <!-- this will allow you to specigy a prefix to exclude hidden inputs for -->
- <out:variable name="exclude-prefix">
- <xsl:choose>
- <xsl:when test="//utml:form/utml:exclude-prefix">
- <xsl:copy-of select="//utml:form/utml:exclude-prefix"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'do_not_include_this_entry_'"/>
- </xsl:otherwise>
- </xsl:choose>
- </out:variable>
-
- <out:for-each select="/root/env/param[not(starts-with( @name, $exclude-prefix ))]">
- <out:if test="{$existence-test-string} and not(contains($other-excludes, concat(' ', @name, ' ')))">
- <!--
- TODO: if we don't add the space ( ) below, the carriage return and tab will be lost...I don't
- think Xalan is handling whitespace correctly when the xsl:output method is 'HTML'. however, adding
- the space (which will be rendered as by Xalan may cause some formatting head aches...
- No one is quite sure why this was put into the code. We'll comment it out for now, and remove it later.
- <xsl:text/> 	 <xsl:text/>
- -->
- <!-- the default operation (if the control was not explicitly given on the page) is "maintain" -->
- <out:choose>
- <out:when test="@name = 'ps_nav_op'">
- <input type="hidden" name="{'{@name}'}" value="'maintain'"/>
- </out:when>
- <out:otherwise>
- <input type="hidden" name="{'{@name}'}" value="{'{.}'}"/>
- </out:otherwise>
- </out:choose>
- </out:if>
- </out:for-each>
-
- <!-- UTML navigation control fields: Add those to the page if they do not exist already. -->
- <!-- Navigation instruction for stacked dialogs. -->
- <xsl:if test="not(//utml:input[@name = 'ps_nav_op' or name = 'ps_nav_op']) ">
- <out:if test="not( /root/env/param[@name = 'ps_nav_op'] )">
- <!--xsl:text/> 	 <xsl:text/-->
- <input type="hidden" name="ps_nav_op" value=""/>
- </out:if>
- </xsl:if>
- <!-- Comma-delimited list of template names representing a set of stacked dialogs resulting from a "push" or a "stack-up" navigation operations. -->
- <xsl:if test="not(//utml:input[@name = 'ps_nav_stack' or name = 'ps_nav_stack']) ">
- <out:if test="not( /root/env/param[@name = 'ps_nav_stack'] )">
- <!--xsl:text/> 	 <xsl:text/-->
- <input type="hidden" name="ps_nav_stack" value=""/>
- </out:if>
- </xsl:if>
- <!-- The name of the current template. This is used by formlogic-init to determine where we came from to update the navigation stack. -->
- <xsl:if test="not(//utml:input[@name = 'ps_nav_source' or name = 'ps_nav_source']) ">
- <out:if test="not( /root/env/param[@name = 'ps_nav_source'] )">
- <!--xsl:text/> 	 <xsl:text/-->
- <input type="hidden" name="ps_nav_source">
- <xsl:attribute name="value">{/root/env/param[@name = 'm']}</xsl:attribute>
- </input>
- </out:if>
- </xsl:if>
- </form>
- </xsl:template>
-
- <xsl:template match="utml:a[namespace-uri() = $utml-namespace-uri]" priority="1">
- <!-- Temporary work-around for XSLTC bug #6819 - variable scoping problem with literal result elements -->
- <out:if test="true()">
- <!-- get the href value, it can only contain JS, but we won't check for it... ... -->
- <xsl:variable name="hide-when-read-only">
- <xsl:call-template name="get-utml-hide-when-read-only">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <out:variable name="read-only">
- <xsl:call-template name="get-utml-read-only">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <out:variable name="hide">
- <xsl:choose>
- <xsl:when test=" $hide-when-read-only = 'true' ">
- <out:value-of select="read-only"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select=" 'false' "/>
- </xsl:otherwise>
- </xsl:choose>
- </out:variable>
- <out:variable name="unique-id">
- <xsl:call-template name="get-utml-unique-id">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <out:if test="($hide = 'false') or ($read-only = 'false' and $form-read-only = 'false')">
- <out:variable name="href">
- <xsl:call-template name="get-utml-href">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the utml:target... -->
- <out:variable name="target">
- <xsl:call-template name="get-utml-target">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <out:variable name="defaultKey">
- <xsl:call-template name="get-utml-defaultKey">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <out:variable name="defaultAct">
- <xsl:call-template name="get-utml-defaultAct">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the utml:op value, currently it can only be plain text... -->
- <xsl:variable name="op">
- <xsl:choose>
- <xsl:when test="./@utml:op = 'push' or ./@utml:op = 'stack-up'">
- <xsl:value-of select="'push'"/>
- </xsl:when>
- <xsl:when test="./@utml:op = 'pop' or ./@utml:op = 'stack-down'">
- <xsl:value-of select="'pop'"/>
- </xsl:when>
- <xsl:when test="./@utml:op = 'drop' or ./@utml:op = 'stack-down-save'">
- <xsl:value-of select="'drop'"/>
- </xsl:when>
- <xsl:when test="./@utml:op = 'submit'">
- <xsl:value-of select="'submit'"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'maintain'"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- get the name of the parent form, necessary for setting form variables via JS -->
- <out:variable name="parent-form-name">
- <xsl:choose>
- <xsl:when test="ancestor::*[name() = 'utml:form' and namespace-uri() = $utml-namespace-uri]">
- <xsl:call-template name="get-utml-name">
- <xsl:with-param name="node" select="ancestor::*[name() = 'utml:form' and namespace-uri() = $utml-namespace-uri]"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="@utml:formName">
- <xsl:value-of select="@utml:formName"/>
- </xsl:when>
- <xsl:when test="utml:formName">
- <xsl:copy-of select="utml:formName/child::node()"/>
- </xsl:when>
- <xsl:otherwise>
- <out:value-of select="$utml-form-name"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </out:variable>
- <!-- determine whether we're to call a JS validate function or not. -->
- <out:variable name="validate">
- <xsl:call-template name="get-utml-validate">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!--
- Use this to delimit template names in the navigation stack. Use * since it is the least likely char to be used in a folder or file name.
- This is also defined in formlogic_init.xslt
- -->
- <out:variable name="nav-stack-delimiter" select="'*'"/>
- <out:variable name="js-logic">
- <!-- propogate the navigation operation...-->
- document.<out:value-of select="$parent-form-name"/>.ps_nav_op.value = '<xsl:value-of select="$op"/>';
- <!-- calculate the target morphlet... -->
- <out:choose>
- <out:when test="$target">
- document.<out:value-of select="$parent-form-name"/>.m.value = '<out:value-of select="$target"/>';
- </out:when>
- <!-- if the user gave one of the operations: stack-up, submit, or no operation, they would have been required to give a target, in which case we won't be here, however don't currently have
- the ability to validate(!), so we'll just use a conditional test... -->
- <out:otherwise>
- <xsl:if test="$op = 'pop' or $op = 'drop'">
- <!-- Determine the new target from the existing stack. If the current template is A then the current stack could be somthing like A,B,C. we want to extract B. -->
- <out:variable name="new-target">
- <out:choose>
- <out:when test="contains(/root/env/param[@name='ps_nav_stack'], $nav-stack-delimiter)">
- <out:value-of select="substring-before( /root/env/param[@name='ps_nav_stack'], $nav-stack-delimiter )"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="/root/env/param[@name='ps_nav_stack']"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- document.<out:value-of select="$parent-form-name"/>.m.value = "<out:value-of select="xtsext:javascriptencode($new-target)"/>";
- </xsl:if>
- </out:otherwise>
- </out:choose>
-
- <!-- insert any user specified href info... -->
- <out:value-of select="$href"/>
-
- <!-- form submission... -->
- <out:variable name="submit">
- <xsl:call-template name="get-utml-submit">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
-
- <out:if test="$submit != 'false'">
- <script language="JavaScript">
- <![CDATA[
- function needCustomHeader(formName)
- {
- var needed = false;
- var iFrmCmd = formName.ifrmcmd;
- var psNavOp = formName.ps_nav_op;
- var mClass = formName.m_class;
- var psNavSource = formName.ps_nav_source;
- var mNewClass = formName.m_new_class;
- if ( iFrmCmd != undefined && iFrmCmd.value === "create" &&
- psNavOp != undefined && psNavOp.value === "submit" )
- {
- if ( mClass != undefined && mClass.value === "subscriptionFolder" &&
- psNavSource != undefined && psNavSource.value.slice(-"new_general.xts".length) === "new_general.xts" ) {
- needed = true;
- }
- else if ( mNewClass != undefined && mNewClass.value === "subscriptionFolder" &&
- psNavSource != undefined && psNavSource.value.slice(-"new_actions.xts".length) === "new_actions.xts" ) {
- needed = true;
- }
- }
- return needed;
- }
- function getFormDataQueryString(form)
- {
- var keyValuePairs = [];
- for (var i = 0; i < form.elements.length; i++)
- {
- var element = form.elements[i];
- keyValuePairs.push(encodeURIComponent(element.name) + "=" + encodeURIComponent(element.value));
- }
- return queryString = keyValuePairs.join("&");
- }
- ]]>
- </script>
- <!-- XSRF-TOKEN cookie is null when disableXSRFCheck=true in bootstrap.properties. -->
- var xsrfTokenCookie = getCookie("XSRF-TOKEN");
- var formName= document.<out:value-of select="$parent-form-name"/>;
- if (xsrfTokenCookie && needCustomHeader(formName))
- {
- <!--
- CAPSIRTS-412 / MANAGECA-9957
-
- Case A:
- 1. Go to "Personal menu" > "My Watch Items" and "Rules".
- 2. Click "New Folder", enter a name, etc., and click "Finish".
-
- ifrmcmd=create
- ps_nav_op=submit
- m_class=subscriptionFolder
- ps_nav_source=portal/new_general.xts
-
- Case B
- 1. Go to "Personal menu" > "My Watch Items" and "Rules".
- 2. Click "New Folder" and click "Select another location...".
- 3. Click "New Folder...", enter a name, etc., and click "Finish".
- ...
-
- ifrmcmd=create
- ps_nav_op=submit
- m_new_class=subscriptionFolder
- ps_nav_source=portal/select/new_actions.xts
- -->
- var xhr = new XMLHttpRequest();
- xhr.onreadystatechange = function()
- {
- if (xhr.readyState === 4)
- {
- document.write(xhr.responseText);
- document.close();
- }
- }
- xhr.open(formName.method, formName.action, false);
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- xhr.setRequestHeader("X-XSRF-TOKEN", xsrfTokenCookie);
- xhr.send(getFormDataQueryString(formName));
- }
- else
- {
- formName.submit();
- }
- </out:if>
- </out:variable>
-
- <!-- Generate a unique id to use for calling a function. Use the unique-id the caller passed it in if it exists. We need this so that we do not have name collisions when more than one <utml:a> exist on a page. -->
- <out:variable name="node_id">
- <out:choose>
- <out:when test="$unique-id!=''"><out:value-of select="$unique-id"/></out:when>
- <out:otherwise><xsl:value-of select="generate-id(.)"/></out:otherwise>
- </out:choose>
- </out:variable>
- <!-- Output the JS snippet for the anchor -->
- <script language="JavaScript">
- <out:if test="$defaultKey = 'active'">
- function enterdfaultact()
- {
- var currentFocusEl = document.activeElement;
- if (currentFocusEl.tagName.toLowerCase() =='a' || currentFocusEl.getAttribute("role") == 'button' || currentFocusEl.getAttribute("role") == 'link'){
- return true;
- }
- <out:if test="$defaultAct!=''">
- <out:value-of select="$defaultAct"/>
- </out:if>
- utmlA_<out:value-of select="$node_id"/>();
- return false;
- }
- </out:if>
- function utmlA_<out:value-of select="$node_id"/>()
- {
- <out:choose>
- <!--out:when test="$validate = 'true'" -->
- <!-- If the morphlet writer provided a validate() function on the page then make sure to call it before execution. -->
- <!-- if (window.validate)
- {
- if (validate())
- {
- <out:value-of select="$js-logic"/>
- }
- } -->
- <!-- If the morphlet writer did NOT provide a validate() function then politely execute the command (may be this is bad!!) -->
- <!-- else
- {
- <out:value-of select="$js-logic"/>
- }
- </out:when -->
- <out:when test="$validate != '' and $validate != 'false' ">
- <out:variable name="validateName">
- <out:choose>
- <out:when test="$validate='true'"><out:value-of select="'validate'"/></out:when>
- <out:otherwise><out:value-of select="$validate"/></out:otherwise>
- </out:choose>
- </out:variable>
- <!-- If the morphlet writer provided a validate() function on the page then make sure to call it before execution. -->
- if (window.<out:value-of select="$validateName"/>)
- {
- if (<out:value-of select="$validateName"/>())
- {
- <out:value-of select="$js-logic"/>
- }
- }
- <!-- If the morphlet writer did NOT provide a validate() function then politely execute the command (may be this is bad!!) -->
- else
- {
- <out:value-of select="$js-logic"/>
- }
- </out:when>
- <out:otherwise>
- <out:value-of select="$js-logic"/>
- </out:otherwise>
- </out:choose>
- }
- </script>
- <!-- Output the HTML anchor -->
- <a>
- <xsl:if test="count(ancestor::*[@role='tablist'])">
- <xsl:attribute name="role">tab</xsl:attribute>
- <xsl:attribute name="aria-selected"><out:value-of select="$isTabSelected"/></xsl:attribute>
- </xsl:if>
-
- <!-- copy all non-utml attributes... -->
- <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
- <out:attribute name="href">javascript:utmlA_<out:value-of select="$node_id"/>()</out:attribute>
- <!-- copy all non-utml child elements... -->
- <xsl:apply-templates/>
- </a>
- </out:if>
- </out:if>
- </xsl:template>
-
-
- <xsl:template match="utml:static[namespace-uri() = $utml-namespace-uri]" priority="1">
- <!-- calculate the control name, this includes all dynamically generated name information... -->
- <out:variable name="control-name">
- <xsl:call-template name="get-utml-prefix">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- <xsl:call-template name="get-utml-name">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the value ... -->
- <out:variable name="value">
- <xsl:call-template name="get-utml-value">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the update flag, this can only be text... -->
- <xsl:variable name="update">
- <xsl:call-template name="get-utml-update">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <!-- update the control value, either from the query value, or the default... -->
- <xsl:choose>
- <xsl:when test="$update = 'false'">
- <out:value-of select="$value"/>
- </xsl:when>
- <xsl:otherwise>
- <out:choose>
- <out:when test="/root/env/param[@name = $control-name]">
- <!-- TEMPORARY HACK TO DEAL WITH CM ENCODING ISSUES FOR 0.1 RELEASE. -->
- <xsl:choose>
- <xsl:when test="@cmdecode = 'true'">
- <out:value-of select="/root/env/param[@name = $control-name]"/>
- </xsl:when>
- <xsl:otherwise>
- <out:value-of select="/root/env/param[@name = $control-name]"/>
- </xsl:otherwise>
- </xsl:choose>
- </out:when>
- <out:otherwise>
- <out:value-of select="$value"/>
- </out:otherwise>
- </out:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <!-- ============================================================ -->
- <!-- == Text Lite - only keeps track of the variable no extras == -->
- <!-- ============================================================ -->
- <xsl:template match="utml:input[(@type = 'text-lite')]" priority="1">
- <input type="text">
- <xsl:copy-of select="@*[(local-name() != 'type') and (local-name() != 'value')]"/>
- <out:attribute name="value">
- <out:choose>
- <out:when test="/root/env/param[@name = '{@name}']">
- <out:value-of select="/root/env/param[@name = '{@name}']"/>
- </out:when>
- <out:otherwise>
- <xsl:copy-of select="utml:value/child::node()"/>
- </out:otherwise>
- </out:choose>
- </out:attribute>
- </input>
- </xsl:template>
-
- <!-- ===================================================================== -->
- <!-- ============== Text - Password - Hidden =================== -->
- <xsl:template match="utml:input[((@type = 'text' or type = 'text') or (@type = 'password' or type = 'password') or (@type = 'hidden' or type = 'hidden')) and (namespace-uri() = $utml-namespace-uri)]" priority="1">
- <out:if test="true()">
- <!-- add this here to define unique context for the variables below -->
- <!-- determine if this ontrol needs to be rendered in read-only mode -->
- <out:variable name="read-only">
- <xsl:call-template name="get-utml-read-only">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- calculate the control name, this includes all dynamically generated name information... -->
- <out:variable name="control-name">
- <xsl:call-template name="get-utml-prefix">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- <xsl:call-template name="get-utml-name">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the value ... -->
- <out:variable name="value">
- <xsl:call-template name="get-utml-value">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the update flag, this can only be text... -->
- <xsl:variable name="update">
- <xsl:call-template name="get-utml-update">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <!-- get the type... -->
- <out:variable name="type">
- <xsl:call-template name="get-utml-type">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the state of the tracking feature... -->
- <xsl:variable name="track-changes">
- <xsl:call-template name="get-utml-track">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <out:choose>
- <out:when test="($read-only = 'true' or $form-read-only = 'true') and (not($type = 'hidden'))">
- <out:value-of select = "xtsext:enforceBTD($value, $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/>
- </out:when>
- <out:otherwise>
- <xsl:if test="$track-changes = 'true'">
- <script language="JavaScript">
- function on_<out:value-of select="$control-name"/>_changed() {
- document.<out:value-of select="$utml-form-name"/>.changed_<out:value-of select="$control-name"/>.value="1";
- }
- </script>
- <out:variable name="hidden-control-name">
- <out:value-of select="concat( 'changed_', $control-name )"/>
- </out:variable>
- <input type="hidden">
- <out:attribute name="name">
- <out:value-of select="$hidden-control-name"/>
- </out:attribute>
- <out:choose>
- <out:when test="/root/env/param[@name = $hidden-control-name]">
- <out:attribute name="value">
- <out:value-of select="/root/env/param[@name = $hidden-control-name]"/>
- </out:attribute>
- </out:when>
- <out:otherwise>
- <out:attribute name="value">0</out:attribute>
- </out:otherwise>
- </out:choose>
- </input>
- </xsl:if>
- <input>
- <!-- copy all non-utml attributes... -->
- <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
- <!-- add the name attribute... -->
- <out:attribute name="name">
- <out:value-of select="$control-name"/>
- </out:attribute>
- <!-- add the type... -->
- <out:attribute name="type">
- <xsl:call-template name="get-utml-type">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:attribute>
- <!-- add the onchange attribute... -->
- <xsl:if test="$track-changes = 'true'">
- <out:attribute name="onchange">
- <out:text/>if(window.on_<out:value-of select="$control-name"/>_changed)window.on_<out:value-of select="$control-name"/>_changed();<out:text/>
- <xsl:if test="@onchange">
- <out:text/>
- <xsl:value-of select="@onchange"/>
- <out:text/>
- </xsl:if>
- </out:attribute>
- </xsl:if>
- <!-- update the control value, either from the query value, or the default... -->
- <!-- bidi -->
- <out:variable name="updatedValue">
- <xsl:choose>
- <xsl:when test="$update = 'false'"><out:value-of select="$value"/></xsl:when>
- <xsl:otherwise>
- <out:choose>
- <out:when test="/root/env/param[@name = $control-name]">
- <out:value-of select="/root/env/param[@name = $control-name]"/>
- </out:when>
- <out:otherwise><out:value-of select="$value"/></out:otherwise>
- </out:choose>
- </xsl:otherwise>
- </xsl:choose>
- </out:variable>
- <out:attribute name="value">
- <out:value-of select="$updatedValue"/>
- </out:attribute>
- <out:variable name="textDirection">
- <out:choose>
- <out:when test="$isBidiEnabled != 'true'"></out:when>
- <out:otherwise>
- <xsl:choose>
- <xsl:when test="@dir"></xsl:when>
- <xsl:when test="@stttype">stt</xsl:when>
- <xsl:otherwise>
- <out:value-of select="xtsext:getBTD(string($updatedValue), $baseTextDirection, $productLocale)"/>
- </xsl:otherwise>
- </xsl:choose>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <out:if test="$type = 'text' and $textDirection != ''">
- <out:choose>
- <out:when test="$textDirection = 'stt'">
- <out:attribute name="dir">ltr</out:attribute>
- </out:when>
- <out:otherwise>
- <out:attribute name="dir">
- <out:value-of select="$textDirection"/>
- </out:attribute>
- </out:otherwise>
- </out:choose>
- <out:if test="$textDirection = 'stt' or $baseTextDirection = 'auto'">
- <xsl:choose>
- <xsl:when test="@onfocus">
- <out:attribute name="onfocus">
- <xsl:value-of select="concat('bidi.onfocus(this);',@onfocus)"/>
- </out:attribute>
- </xsl:when>
- <xsl:otherwise>
- <out:attribute name="onfocus">
- <out:text>bidi.onfocus(this)</out:text>
- </out:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </out:if>
- </out:if>
- <!-- handle children... -->
- <xsl:apply-templates/>
- </input>
- </out:otherwise>
- </out:choose>
- </out:if>
- </xsl:template>
-
- <!-- ==================================================================== -->
- <!-- ============== Checkbox =================== -->
- <xsl:template match="utml:input[(@type = 'checkbox' or type = 'checkbox') and (namespace-uri() = $utml-namespace-uri)]" priority="1">
- <out:if test="true()">
- <!-- add this here to define unique context for the variables below -->
- <!-- calculate the control name, this includes all dynamically generated name information... -->
- <out:variable name="control-name">
- <xsl:call-template name="get-utml-prefix">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- <xsl:call-template name="get-utml-name">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- determine if this ontrol needs to be rendered in read-only mode -->
- <out:variable name="read-only">
- <xsl:call-template name="get-utml-read-only">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the value ... -->
- <out:variable name="value">
- <xsl:call-template name="get-utml-value">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the update flag, this can only be text... -->
- <xsl:variable name="update">
- <xsl:call-template name="get-utml-update">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <!-- get the default condition that will be evaluated when the queryvalue isn't present... -->
- <xsl:variable name="default-condition">
- <xsl:call-template name="get-utml-default-condition">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <!-- get the state of the tracking feature... -->
- <xsl:variable name="track-changes">
- <xsl:call-template name="get-utml-track">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <!-- get the state of the unchecked value feature -->
- <xsl:variable name="unchecked-value">
- <xsl:call-template name="get-utml-unchecked-value">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <!-- get the default condition that will be evaluated when the queryvalue isn't present... -->
- <out:variable name="checked">
- <xsl:call-template name="get-checked-state">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <out:choose>
- <out:when test="$read-only = 'true' or $form-read-only = 'true'">
- <img role="checkbox" aria-disabled="true">
- <xsl:copy-of select="@id"/>
- <out:choose>
- <out:when test="/root/env/param[@name = $control-name] = $value or $checked = 'true'">
- <out:attribute name="src"><out:value-of select="$image_root"/>icon_disabled_checkbox_checked.gif</out:attribute>
- <out:attribute name="aria-checked">true</out:attribute>
- </out:when>
- <xsl:if test="$default-condition != ''">
- <out:when>
- <xsl:attribute name="test"><xsl:value-of select="$default-condition"/></xsl:attribute>
- <out:attribute name="src"><out:value-of select="$image_root"/>icon_disabled_checkbox_checked.gif</out:attribute>
- <out:attribute name="aria-checked">true</out:attribute>
- </out:when>
- </xsl:if>
- <out:otherwise>
- <out:attribute name="src"><out:value-of select="$image_root"/>icon_disabled_checkbox_unchecked.gif</out:attribute>
- <out:attribute name="aria-checked">false</out:attribute>
- </out:otherwise>
- </out:choose>
- </img>
- </out:when>
- <out:otherwise>
- <xsl:if test="$track-changes = 'true'">
- <script language="JavaScript">
- function on_<out:value-of select="$control-name"/>_changed() {
- document.<out:value-of select="$utml-form-name"/>.changed_<out:value-of select="$control-name"/>.value="1";
- }
- </script>
- <out:variable name="hidden-control-name">
- <out:value-of select="concat( 'changed_', $control-name )"/>
- </out:variable>
- <input type="hidden">
- <out:attribute name="name">
- <out:value-of select="$hidden-control-name"/>
- </out:attribute>
- <out:choose>
- <out:when test="/root/env/param[@name = $hidden-control-name]">
- <out:attribute name="value">
- <out:value-of select="/root/env/param[@name = $hidden-control-name]"/>
- </out:attribute>
- </out:when>
- <out:otherwise>
- <out:attribute name="value">0</out:attribute>
- </out:otherwise>
- </out:choose>
- </input>
- </xsl:if>
- <xsl:if test="$unchecked-value != ''">
- <input type="hidden">
- <!-- add the name attribute... -->
- <out:attribute name="name">
- <out:value-of select="$control-name"/>
- </out:attribute>
-
- <!-- update the control value, either from the query value, or the default... -->
- <xsl:choose>
- <xsl:when test="$update != 'false'">
- <out:choose>
- <!-- take the value from the env -->
- <out:when test="/root/env/param[@name = $control-name]">
- <out:attribute name="value"><out:value-of select="/root/env/param[@name = $control-name]"/></out:attribute>
- </out:when>
- <xsl:if test="$default-condition != ''">
- <!-- if the default condition is met, then the checkbox is checked -->
- <out:when>
- <xsl:attribute name="test"><xsl:value-of select="$default-condition"/></xsl:attribute>
- <out:attribute name="value"><out:value-of select="$value"/></out:attribute>
- </out:when>
- </xsl:if>
- <out:otherwise>
- <out:attribute name="value"><xsl:value-of select="$unchecked-value"/></out:attribute>
- </out:otherwise>
- </out:choose>
- </xsl:when>
- <xsl:otherwise>
- <out:attribute name="value"><out:value-of select="$value"/></out:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </input>
- </xsl:if>
- <input>
- <!-- copy all non-utml attributes... -->
- <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
- <!-- add the type... -->
- <out:attribute name="type">
- <xsl:call-template name="get-utml-type">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:attribute>
- <!-- add the name attribute... -->
- <out:attribute name="name">
- <xsl:if test="$unchecked-value != ''">tmp_chkbox_</xsl:if>
- <out:value-of select="$control-name"/>
- </out:attribute>
- <!-- add the value attribute... -->
- <out:attribute name="value">
- <out:value-of select="$value"/>
- </out:attribute>
- <!-- update the control value, either from the query value, or the default... -->
- <xsl:if test="$update != 'false'">
- <out:choose>
- <out:when test="/root/env/param[@name = $control-name] = $value">
- <out:attribute name="checked">checked</out:attribute>
- </out:when>
- <xsl:if test="$default-condition != ''">
- <out:when>
- <xsl:attribute name="test"><xsl:value-of select="$default-condition"/></xsl:attribute>
- <out:attribute name="checked">checked</out:attribute>
- </out:when>
- </xsl:if>
- </out:choose>
- </xsl:if>
- <!-- add the onchange attribute... -->
- <xsl:if test="$track-changes = 'true' or $unchecked-value != ''">
- <out:attribute name="onclick">
- <xsl:if test="$track-changes = 'true'">
- <out:text/>if(window.on_<out:value-of select="$control-name"/>_changed)window.on_<out:value-of select="$control-name"/>_changed();<out:text/>
- </xsl:if>
- <xsl:if test="$unchecked-value != ''">
- <out:text/>if (this.checked) { document.<out:value-of select="$utml-form-name"/>.<out:value-of select="$control-name"/>.value = '<out:value-of select="xtsext:javascriptencode(string($value))"/>'; } <out:text/>
- <out:text/>else { document.<out:value-of select="$utml-form-name"/>.<out:value-of select="$control-name"/>.value = '<xsl:value-of select="xtsext:javascriptencode(string($unchecked-value))"/>'; } <out:text/>
- </xsl:if>
- <xsl:if test="@onclick">
- <out:text/>
- <xsl:value-of select="@onclick"/>
- <out:text/>
- </xsl:if>
- </out:attribute>
- </xsl:if>
- <!-- handle children... -->
- <xsl:apply-templates/>
- </input>
- </out:otherwise>
- </out:choose>
- </out:if>
- </xsl:template>
-
-
- <!-- ===================================================================== -->
- <!-- ============== Textarea =================== -->
- <xsl:template match="utml:textarea[namespace-uri() = $utml-namespace-uri]" priority="1">
- <out:if test="true()">
- <!-- add this here to define unique context for the variables below -->
- <!-- determine if this ontrol needs to be rendered in read-only mode -->
- <out:variable name="read-only">
- <xsl:call-template name="get-utml-read-only">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- calculate the control name, this includes all dynamically generated name information... -->
- <out:variable name="control-name">
- <xsl:call-template name="get-utml-prefix">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- <xsl:call-template name="get-utml-name">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the value ... -->
- <out:variable name="value">
- <xsl:call-template name="get-utml-value">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the update flag, this can only be text... -->
- <xsl:variable name="update">
- <xsl:call-template name="get-utml-update">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <!-- get the state of the tracking feature... -->
- <xsl:variable name="track-changes">
- <xsl:call-template name="get-utml-track">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <out:choose>
- <out:when test="$read-only = 'true' or $form-read-only = 'true'">
- <out:value-of select = "xtsext:enforceBTD($value, $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/>
- </out:when>
- <out:otherwise>
- <xsl:if test="$track-changes = 'true'">
- <script language="JavaScript">
- function on_<out:value-of select="$control-name"/>_changed(){
- document.<out:value-of select="$utml-form-name"/>.changed_<out:value-of select="$control-name"/>.value="1";
- }
- </script>
- <out:variable name="hidden-control-name">
- <out:value-of select="concat( 'changed_', $control-name )"/>
- </out:variable>
- <input type="hidden">
- <out:attribute name="name">
- <out:value-of select="$hidden-control-name"/>
- </out:attribute>
- <out:choose>
- <out:when test="/root/env/param[@name = $hidden-control-name]">
- <out:attribute name="value">
- <out:value-of select="/root/env/param[@name = $hidden-control-name]"/>
- </out:attribute>
- </out:when>
- <out:otherwise>
- <out:attribute name="value">0</out:attribute>
- </out:otherwise>
- </out:choose>
- </input>
- </xsl:if>
- <textarea>
- <!-- copy all non-utml attributes... -->
- <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
- <!-- add the type... -->
- <out:attribute name="type">
- <xsl:call-template name="get-utml-type">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:attribute>
- <!-- add the name attribute... -->
- <out:attribute name="name">
- <out:value-of select="$control-name"/>
- </out:attribute>
- <!-- add the onchange attribute... -->
- <xsl:if test="$track-changes = 'true'">
- <out:attribute name="onchange">
- <out:text/>if(window.on_<out:value-of select="$control-name"/>_changed)window.on_<out:value-of select="$control-name"/>_changed();<out:text/>
- <xsl:if test="@onchange">
- <out:text/>
- <xsl:value-of select="@onchange"/>
- <out:text/>
- </xsl:if>
- </out:attribute>
- </xsl:if>
- <!-- bidi -->
- <out:variable name="updatedValue">
- <xsl:choose>
- <xsl:when test="$update = 'false'"><out:value-of select="$value"/></xsl:when>
- <xsl:otherwise>
- <out:choose>
- <out:when test="/root/env/param[@name = $control-name]">
- <out:value-of select="/root/env/param[@name = $control-name]"/>
- </out:when>
- <out:otherwise><out:value-of select="$value"/></out:otherwise>
- </out:choose>
- </xsl:otherwise>
- </xsl:choose>
- </out:variable>
- <out:variable name="textDirection">
- <out:choose>
- <out:when test="$isBidiEnabled != 'true'"></out:when>
- <out:otherwise>
- <xsl:choose>
- <xsl:when test="@dir"></xsl:when>
- <xsl:when test="@stttype">stt</xsl:when>
- <xsl:otherwise>
- <out:value-of select="xtsext:getBTD(string($updatedValue), $baseTextDirection, $productLocale)"/>
- </xsl:otherwise>
- </xsl:choose>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <out:if test="$textDirection != ''">
- <out:choose>
- <out:when test="$textDirection = 'stt'">
- <out:attribute name="dir">ltr</out:attribute>
- </out:when>
- <out:otherwise>
- <out:attribute name="dir">
- <out:value-of select="$textDirection"/>
- </out:attribute>
- </out:otherwise>
- </out:choose>
- <out:if test="$textDirection = 'stt' or $baseTextDirection = 'auto'">
- <xsl:choose>
- <xsl:when test="@onfocus">
- <out:attribute name="onfocus">
- <xsl:value-of select="concat('bidi.onfocus(this);',@onfocus)"/>
- </out:attribute>
- </xsl:when>
- <xsl:otherwise>
- <out:attribute name="onfocus">
- <out:text>bidi.onfocus(this)</out:text>
- </out:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </out:if>
- </out:if>
- <!-- handle children... -->
- <xsl:apply-templates/>
- <!-- update the control value, either from the query value, or the default... -->
- <out:value-of select="$updatedValue"/>
- </textarea>
- </out:otherwise>
- </out:choose>
- </out:if>
- </xsl:template>
-
-
- <!-- ===================================================================== -->
- <!-- ============== Select =================== -->
- <xsl:template match="utml:select[namespace-uri() = $utml-namespace-uri]" priority="1">
- <out:if test="true()">
- <!-- add this here to define unique context for the variables below -->
- <!-- determine if this ontrol needs to be rendered in read-only mode -->
- <out:variable name="read-only">
- <xsl:call-template name="get-utml-read-only">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- create variables for each default value in the comma delimited list... -->
- <!--
- TODO: ADD SUPPORT FOR SUBSTITUTION VARIABLES THAT CONTAIN A COMMA
- DELIMITED LIST, AND LISTS OF COMMA DELIMITED SUBSTITUTION VARIABLES/PLAIN
- TEXT ???
- -->
- <out:variable name="default-value">
- <xsl:call-template name="get-utml-default-value">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- calculate the control name, this includes all dynamically generated name information... -->
- <out:variable name="control-name">
- <xsl:call-template name="get-utml-prefix">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- <xsl:call-template name="get-utml-name">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the state of the tracking feature... -->
- <xsl:variable name="track-changes">
- <xsl:call-template name="get-utml-track">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <out:choose>
- <out:when test="$read-only = 'true' or $form-read-only = 'true'">
- <xsl:apply-templates/>
- </out:when>
- <out:otherwise>
- <xsl:if test="$track-changes = 'true'">
- <script language="JavaScript">
- function on_<out:value-of select="$control-name"/>_changed(){
- document.<out:value-of select="$utml-form-name"/>.changed_<out:value-of select="$control-name"/>.value="1";
- }
- </script>
- <out:variable name="hidden-control-name">
- <out:value-of select="concat( 'changed_', $control-name )"/>
- </out:variable>
- <input type="hidden">
- <out:attribute name="name">
- <out:value-of select="$hidden-control-name"/>
- </out:attribute>
- <out:choose>
- <out:when test="/root/env/param[@name = $hidden-control-name]">
- <out:attribute name="value">
- <out:value-of select="/root/env/param[@name = $hidden-control-name]"/>
- </out:attribute>
- </out:when>
- <out:otherwise>
- <out:attribute name="value">0</out:attribute>
- </out:otherwise>
- </out:choose>
- </input>
- </xsl:if>
- <select>
- <!-- copy all non-utml attributes... -->
- <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
- <!-- add the name attribute... -->
- <out:attribute name="name">
- <out:value-of select="$control-name"/>
- </out:attribute>
- <xsl:if test="$track-changes = 'true'">
- <out:attribute name="onchange">
- <out:text/>if(window.on_<out:value-of select="$control-name"/>_changed)window.on_<out:value-of select="$control-name"/>_changed();<out:text/>
- <xsl:if test="@onchange">
- <out:text/>
- <xsl:value-of select="@onchange"/>
- <out:text/>
- </xsl:if>
- </out:attribute>
- </xsl:if>
- <xsl:apply-templates/>
- </select>
- </out:otherwise>
- </out:choose>
- </out:if>
- </xsl:template>
-
-
- <!-- ===================================================================== -->
- <!-- ============== Option =================== -->
- <xsl:template match="utml:option[namespace-uri() = $utml-namespace-uri]" priority="1">
- <out:if test="true()">
- <!-- get the value ... -->
- <out:variable name="value">
- <xsl:call-template name="get-utml-value">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the update flag, this can only be text... -->
- <xsl:variable name="update">
- <xsl:call-template name="get-utml-update">
- <xsl:with-param name="node" select="ancestor::*[name() = 'utml:select' and namespace-uri() = $utml-namespace-uri]"/>
- </xsl:call-template>
- </xsl:variable>
- <out:choose>
- <out:when test="$read-only = 'true' or $form-read-only = 'true'">
- <xsl:choose>
- <xsl:when test="$update != 'false'">
- <out:choose>
- <out:when test="string(/root/env/param[@name = $control-name]) = $value">
- <xsl:apply-templates/>
- </out:when>
- <out:when test="not(/root/env/param[@name = $control-name])">
- <out:if test="$value = $default-value">
- <xsl:apply-templates/>
- </out:if>
- </out:when>
- </out:choose>
- </xsl:when>
- <xsl:otherwise>
- <out:if test="$value = $default-value">
- <xsl:apply-templates/>
- </out:if>
- </xsl:otherwise>
- </xsl:choose>
- </out:when>
- <out:otherwise>
- <option>
- <out:attribute name="value">
- <out:value-of select="$value"/>
- </out:attribute>
- <!-- update the control value from the query value... -->
- <xsl:choose>
- <xsl:when test="$update != 'false'">
- <out:choose>
- <out:when test="/root/env/param[@name = $control-name] = string($value)">
- <out:attribute name="selected">selected</out:attribute>
- </out:when>
- <out:when test="not(/root/env/param[@name = $control-name])">
- <out:if test="string($value) = string($default-value)">
- <out:attribute name="selected">selected</out:attribute>
- </out:if>
- </out:when>
- </out:choose>
- </xsl:when>
- <xsl:otherwise>
- <out:if test="string($value) = string($default-value)">
- <out:attribute name="selected">selected</out:attribute>
- </out:if>
- </xsl:otherwise>
- </xsl:choose>
- <!-- handle children... -->
- <xsl:apply-templates/>
- </option>
- </out:otherwise>
- </out:choose>
- </out:if>
- </xsl:template>
-
-
- <!-- ===================================================================== -->
- <!-- ============== Radio =================== -->
- <xsl:template match="utml:input[(@type = 'radio' or type = 'radio') and (namespace-uri() = $utml-namespace-uri)]" priority="1">
- <out:if test="true()">
- <!-- add this here to define unique context for the variables below -->
-
- <!-- the button names should match that of the group so all group variables will need this prefix -->
- <xsl:variable name="radio-prefix">
- <xsl:choose>
- <xsl:when test="@name"><xsl:value-of select="concat(@name, '-')"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="concat(ancestor::*[name() = 'utml:radio-group' and namespace-uri() = $utml-namespace-uri]/@name, '-')"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!-- get the value ... -->
- <out:variable name="value">
- <xsl:call-template name="get-utml-value">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the default condition that will be evaluated when the queryvalue isn't present... -->
- <out:variable name="checked">
- <xsl:call-template name="get-checked-state">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <xsl:variable name="track-changes">
- <xsl:call-template name="get-utml-track">
- <xsl:with-param name="node" select="ancestor::*[name() = 'utml:radio-group' and namespace-uri() = $utml-namespace-uri] | ."/>
- </xsl:call-template>
- </xsl:variable>
- <out:choose>
- <out:when test="${$radio-prefix}read-only = 'true' or $form-read-only = 'true'">
- <img role="radio" aria-disabled="true">
- <xsl:copy-of select="@id"/>
- <out:choose>
- <out:when test="string(/root/env/param[@name = ${$radio-prefix}control-name]) = $value or $checked = 'true'">
- <out:attribute name="src"><out:value-of select="$image_root"/>icon_disabled_radio_checked.gif</out:attribute>
- <out:attribute name="aria-checked">true</out:attribute>
- </out:when>
- <xsl:if test="ancestor::*[name() = 'utml:radio-group' and namespace-uri() = $utml-namespace-uri]">
- <out:when test="($value = ${$radio-prefix}default-value) and not(/root/env/param[@name = ${$radio-prefix}control-name])">
- <out:attribute name="src"><out:value-of select="$image_root"/>icon_disabled_radio_checked.gif</out:attribute>
- <out:attribute name="aria-checked">true</out:attribute>
- </out:when>
- </xsl:if>
- <out:otherwise>
- <out:attribute name="src"><out:value-of select="$image_root"/>icon_disabled_radio_unchecked.gif</out:attribute>
- <out:attribute name="aria-checked">false</out:attribute>
- </out:otherwise>
- </out:choose>
- </img>
- </out:when>
- <out:otherwise>
- <input>
- <!-- copy all non-utml attributes... -->
- <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
- <!-- calculate the control name, if it this guy isn't contained inside a utml:radio-group... -->
- <xsl:choose>
- <xsl:when test="not( ancestor::*[name() = 'utml:radio-group' and namespace-uri() = $utml-namespace-uri] )">
- <out:variable name="{$radio-prefix}control-name">
- <xsl:call-template name="get-utml-prefix">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- <xsl:call-template name="get-utml-name">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$track-changes = 'true'">
- <out:attribute name="onclick">
- <out:text/>if(window.on_<out:value-of select="${$radio-prefix}control-name"/>_changed)window.on_<out:value-of select="${$radio-prefix}control-name"/>_changed();<out:text/>
- <xsl:if test="@onclick">
- <out:text/>
- <xsl:value-of select="@onclick"/>
- <out:text/>
- </xsl:if>
- </out:attribute>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- <!-- get the update flag, this can only be text... -->
- <xsl:variable name="update">
- <xsl:call-template name="get-utml-update">
- <xsl:with-param name="node" select="ancestor::*[name() = 'utml:radio-group' and namespace-uri() = $utml-namespace-uri]"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- add the name attribute, $control-name would have been generated by the utml:radio-group... -->
- <out:attribute name="name">
- <out:value-of select="${$radio-prefix}control-name"/>
- </out:attribute>
- <!-- add the type... -->
- <out:attribute name="type">
- <xsl:call-template name="get-utml-type">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:attribute>
- <!-- add the value attribute... -->
- <out:attribute name="value">
- <out:value-of select="$value"/>
- </out:attribute>
- <!-- update the control value, either from the query value, or the default... -->
- <xsl:if test="$update != 'false'">
- <out:choose>
- <out:when test="string(/root/env/param[@name = ${$radio-prefix}control-name]) = string($value)">
- <out:attribute name="checked">checked</out:attribute>
- </out:when>
- <xsl:if test="ancestor::*[name() = 'utml:radio-group' and namespace-uri() = $utml-namespace-uri]">
- <out:when test="(string($value) = string(${$radio-prefix}default-value)) and (not(/root/env/param[@name = ${$radio-prefix}control-name]) or string(/root/env/param[@name = ${$radio-prefix}control-name])='')">
- <out:attribute name="checked">checked</out:attribute>
- </out:when>
- </xsl:if>
- </out:choose>
- </xsl:if>
- <!-- handle children... -->
- <xsl:apply-templates/>
- </input>
- </out:otherwise>
- </out:choose>
- </out:if>
- </xsl:template>
-
-
- <!-- ===================================================================== -->
- <!-- ============== Radio Group =================== -->
- <xsl:template match="utml:radio-group[namespace-uri() = $utml-namespace-uri]" priority="1">
- <!--
- unlike utml:select utml:radio-group doesn't generate a top level element, so we'll wrap it in an
- xsl:if to deal with any potential scoping issues.
- -->
- <!--
- determine if this ontrol needs to be rendered in read-only mode
- All radio button children of a radio button group will use this to be rendered in read-only mode (disabled).
- -->
- <out:if test="true()">
-
- <!-- this will prefix all the radio group variable so they have unique names -->
- <xsl:variable name="radio-prefix">
- <xsl:choose>
- <xsl:when test="@name"><xsl:value-of select="concat(@name, '-')"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <out:variable name="{$radio-prefix}read-only">
- <xsl:call-template name="get-utml-read-only">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- calculate the control name, this includes all dynamically generated name information... -->
- <out:variable name="{$radio-prefix}control-name">
- <xsl:call-template name="get-utml-prefix">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- <xsl:call-template name="get-utml-name">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- create a variable for the default value... -->
- <out:variable name="{$radio-prefix}default-value">
- <xsl:call-template name="get-utml-default-value">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- get the state of the tracking feature... -->
- <xsl:variable name="track-changes">
- <xsl:call-template name="get-utml-track">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <out:if test="${$radio-prefix}read-only != 'true' and $form-read-only != 'true'">
- <xsl:if test="$track-changes = 'true'">
- <script language="JavaScript">
- function on_<out:value-of select="${$radio-prefix}control-name"/>_changed(){
- document.<out:value-of select="$utml-form-name"/>.changed_<out:value-of select="${$radio-prefix}control-name"/>.value="1";
- }
- </script>
- <out:variable name="{$radio-prefix}hidden-control-name">
- <out:value-of select="concat( 'changed_', ${$radio-prefix}control-name )"/>
- </out:variable>
- <input type="hidden">
- <out:attribute name="name">
- <out:value-of select="${$radio-prefix}hidden-control-name"/>
- </out:attribute>
- <out:choose>
- <out:when test="/root/env/param[@name = ${$radio-prefix}hidden-control-name]">
- <out:attribute name="value">
- <out:value-of select="/root/env/param[@name = ${$radio-prefix}hidden-control-name]"/>
- </out:attribute>
- </out:when>
- <out:otherwise>
- <out:attribute name="value">0</out:attribute>
- </out:otherwise>
- </out:choose>
- </input>
- </xsl:if>
- </out:if>
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <!--
- =============================================================================
- Change - a control used to track changes to properties.
- =============================================================================
- -->
- <xsl:template match="utml:change[namespace-uri() = $utml-namespace-uri]" priority="1">
- <!-- Limit the scope of variables declared with <out:variable>. -->
- <out:if test="true()">
- <!-- Get the name of the hidden field. -->
- <out:variable name="hidden-control-name">
- <xsl:call-template name="get-utml-prefix">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- <xsl:call-template name="get-utml-name">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- Get the default value for this flag. -->
- <out:variable name="value">
- <xsl:call-template name="get-utml-value">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </out:variable>
- <!-- Get the value for the update flag. -->
- <xsl:variable name="update">
- <xsl:call-template name="get-utml-update">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Get the default condition expression. -->
- <xsl:variable name="default-condition">
- <xsl:call-template name="get-utml-default-condition">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Get the override condition. -->
- <xsl:variable name="override-condition">
- <xsl:call-template name="get-utml-condition">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <script language="JavaScript">
- function on_<out:value-of select="$hidden-control-name"/>_changed() {
- document.<out:value-of select="$utml-form-name"/>.<out:value-of select="$hidden-control-name"/>.value = '1';
- }
- </script>
- <input type="hidden">
- <out:attribute name="name"><out:value-of select="$hidden-control-name"/></out:attribute>
- <!-- Update the value attribute, either from the query-values or using the default condition. -->
- <xsl:choose>
- <xsl:when test="$update = 'false'">
- <xsl:choose>
- <xsl:when test="$override-condition != ''">
- <out:choose>
- <out:when>
- <xsl:attribute name="test"><xsl:value-of select="$override-condition"/></xsl:attribute>
- <out:attribute name="value">1</out:attribute>
- </out:when>
- <out:otherwise>
- <out:attribute name="value">0</out:attribute>
- </out:otherwise>
- </out:choose>
- </xsl:when>
- <xsl:otherwise>
- <out:attribute name="value"><out:value-of select="$value"/></out:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <out:choose>
- <out:when test="/root/env/param[@name = $hidden-control-name]">
- <out:attribute name="value"><out:value-of select="/root/env/param[@name = $hidden-control-name]"/></out:attribute>
- </out:when>
- <xsl:if test="$default-condition != ''">
- <out:when>
- <xsl:attribute name="test"><xsl:value-of select="$default-condition"/></xsl:attribute>
- <out:attribute name="value">1</out:attribute>
- </out:when>
- </xsl:if>
- <out:otherwise>
- <out:attribute name="value"><out:value-of select="$value"/></out:attribute>
- </out:otherwise>
- </out:choose>
- </xsl:otherwise>
- </xsl:choose>
- </input>
- </out:if>
- </xsl:template>
-
-
-
- <xsl:template name="get-utml-condition">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:condition">
- <xsl:value-of select="$node/@utml:condition"/>
- </xsl:when>
- <xsl:when test="$node/utml:condition">
- <xsl:value-of select="$node/utml:condition/child::text()"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: Retrieve the utml:prefix attribute or child element from the given node.
- -->
- <xsl:template name="get-utml-prefix">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:prefix">
- <out:text/>
- <xsl:value-of select="$node/@utml:prefix"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:prefix">
- <out:text/>
- <xsl:copy-of select="$node/utml:prefix/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: Retrieve the type attribute or the utml:type child element from the given node. Currently type can only be plain
- text (no substitutions!), any markup given in child utml:type element will be ignored.
- -->
- <xsl:template name="get-utml-type">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@type">
- <out:text/>
- <xsl:value-of select="$node/@type"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:type">
- <out:text/>
- <xsl:copy-of select="$node/utml:type/child::text()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the name attribute or child utml:name element from the given node.
- -->
- <xsl:template name="get-utml-name">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@name">
- <out:text/>
- <xsl:value-of select="$node/@name"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:name">
- <out:text/>
- <xsl:copy-of select="$node/utml:name/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the read-only attribute or child utml:read-only element from the given node.
- -->
- <xsl:template name="get-utml-read-only">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:read-only">
- <xsl:value-of select="$node/@utml:read-only"/>
- </xsl:when>
- <xsl:when test="$node/utml:read-only">
- <out:text/>
- <xsl:copy-of select="$node/utml:read-only/child::node()"/>
- <out:text/>
- </xsl:when>
- <xsl:otherwise>
- <out:text/>
- <xsl:value-of select="'false'"/>
- <out:text/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the hide-when-read-only attribute or child utml:hide-when-read-only element from the given node.
- -->
- <xsl:template name="get-utml-hide-when-read-only">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:hide-when-read-only">
- <xsl:value-of select="$node/@utml:hide-when-read-only"/>
- </xsl:when>
- <xsl:when test="$node/utml:hide-when-read-only">
- <out:text/>
- <xsl:copy-of select="$node/utml:hide-when-read-only/child::node()"/>
- <out:text/>
- </xsl:when>
- <xsl:otherwise>
- <out:text/>
- <xsl:value-of select="'false'"/>
- <out:text/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the utml:unique-id attribute or child element from the given node.
- -->
- <xsl:template name="get-utml-unique-id">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@unique-id">
- <out:text/>
- <xsl:value-of select="$node/@unique-id"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:unique-id">
- <out:text/>
- <xsl:copy-of select="$node/utml:unique-id/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the value attribute or the utml:value child element from the given node.
- -->
- <xsl:template name="get-utml-value">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@value">
- <out:text/>
- <xsl:value-of select="$node/@value"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:value">
- <out:text/>
- <xsl:copy-of select="$node/utml:value/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the utml:update attribute or child element from the given node. Currently update can only be plain
- text (no substitutions!), any markup given in child utml:update element will be ignored.
- -->
- <xsl:template name="get-utml-update">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:update">
- <out:text/>
- <xsl:value-of select="$node/@utml:update"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:update">
- <out:text/>
- <xsl:copy-of select="$node/utml:update/child::text()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the utml:default-value attribute or child element from the given node.
- -->
- <xsl:template name="get-utml-default-value">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:default-value">
- <out:text/>
- <xsl:value-of select="$node/@utml:default-value"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/@default-value">
- <out:text/>
- <xsl:value-of select="$node/@default-value"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:default-value">
- <out:text/>
- <xsl:copy-of select="$node/utml:default-value/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the utml:onclick attribute or child element from the given node.
- -->
- <xsl:template name="get-utml-onclick">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@onclick">
- <out:text/>
- <xsl:value-of select="$node/@onclick"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:onclick">
- <out:text/>
- <xsl:copy-of select="$node/utml:onclick/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the target attribute or utml:target child element from the given node.
- -->
- <xsl:template name="get-utml-target">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:target">
- <out:text/>
- <xsl:value-of select="$node/@utml:target"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:target">
- <out:text/>
- <xsl:copy-of select="$node/utml:target/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the target attribute or utml:target child element from the given node.
- -->
- <xsl:template name="get-target">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@target">
- <out:text/>
- <xsl:value-of select="$node/@target"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:target">
- <out:text/>
- <xsl:copy-of select="$node/utml:target/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the submit attribute or utml:submit child element from the given node.
- -->
- <xsl:template name="get-utml-submit">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:submit">
- <out:text/>
- <xsl:value-of select="$node/@utml:submit"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:submit">
- <out:text/>
- <xsl:copy-of select="$node/utml:submit/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the utml:validate attribute or utml:validate child element from the given node.
- -->
- <xsl:template name="get-utml-validate">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:validate">
- <out:text/>
- <xsl:value-of select="$node/@utml:validate"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:validate">
- <out:text/>
- <xsl:copy-of select="$node/utml:validate/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the checked state
- -->
- <xsl:template name="get-checked-state">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@checked = 'checked' or $node/@checked = 'true'">
- <xsl:text/>true<xsl:text/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text/>false<xsl:text/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the default-condition attribute or child utml:default-condition element from the given node.
- -->
- <xsl:template name="get-utml-default-condition">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:default-condition">
- <out:text/>
- <xsl:value-of select="$node/@utml:default-condition"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:default-condition">
- <out:text/>
- <xsl:copy-of select="$node/utml:default-condition/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieves the value of the utml:track attribute or child utml:track element
- from the given node.
- -->
- <xsl:template name="get-utml-track">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:track">
- <xsl:text/>
- <xsl:value-of select="$node/@utml:track"/>
- <xsl:text/>
- </xsl:when>
- <xsl:when test="$node/utml:track">
- <xsl:text/>
- <xsl:copy-of select="$node/utml:track/child::node()"/>
- <xsl:text/>
- </xsl:when>
- <xsl:otherwise>
- <!-- By default, this feature is disabled. -->
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieves the value of the utml:uncheckedValue. This is used for checkboxes that need
- to return a value even when the checkbox is unchecked
- -->
- <xsl:template name="get-utml-unchecked-value">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:uncheckedValue">
- <xsl:value-of select="$node/@utml:uncheckedValue"/>
- </xsl:when>
- <xsl:when test="$node/utml:uncheckedValue">
- <xsl:copy-of select="$node/utml:uncheckedValue/child::node()"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Description: retrieve the href attribute or child utml:href element from the given node.
- -->
- <xsl:template name="get-utml-href">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@href">
- <out:text/>
- <xsl:value-of select="$node/@href"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:href">
- <out:text/>
- <xsl:copy-of select="$node/utml:href/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the defaultKey attribute only.
- -->
- <xsl:template name="get-utml-defaultKey">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:defaultKey">
- <out:text/>
- <xsl:value-of select="$node/@utml:defaultKey"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:defaultKey">
- <out:text/>
- <xsl:copy-of select="$node/utml:defaultKey/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!--
- Description: retrieve the defaultAct child utml:defaultAct element from the given node.
- -->
- <xsl:template name="get-utml-defaultAct">
- <xsl:param name="node"/>
- <xsl:choose>
- <xsl:when test="$node/@utml:defaultAct">
- <out:text/>
- <xsl:value-of select="$node/@utml:defaultAct"/>
- <out:text/>
- </xsl:when>
- <xsl:when test="$node/utml:defaultAct">
- <out:text/>
- <xsl:copy-of select="$node/utml:defaultAct/child::node()"/>
- <out:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!-- the main engine -->
- <xsl:template match="*[namespace-uri() = $utml-namespace-uri]" priority="0"/>
-
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*[namespace-uri() != $utml-namespace-uri]"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- <!--
- utml:textbox
- type
- name
- value
- utml:default-value
- -->
- <!-- theoretically the simplest template -->
- <xsl:template match="utml:comment"/>
- <!-- debug information -->
- <xsl:template match="utml:dump-state">
- <table cellpadding="2" cellspacing="3" border="0" width="100%" bgcolor="#FFFFFF">
- <tr bgcolor="#3333FF">
- <td colspan="2">
- <font face="arial" size="4" color="#FFFFFF">
- query-values
- </font>
- </td>
- </tr>
- <tr bgcolor="#CCCCFF">
- <td>
- <font face="arial" size="2">
- <b>name</b>
- </font>
- </td>
- <td>
- <font face="arial" size="2">
- <b>value</b>
- </font>
- </td>
- </tr>
- <out:for-each select="/root/env/param">
- <out:sort select="@name"/>
- <tr bgcolor="#CCCCCC">
- <td>
- <font face="arial" size="2">
- <out:value-of select="@name"/>
- </font>
- </td>
- <td>
- <font face="arial" size="2">
- <out:value-of select="."/>
- </font>
- </td>
- </tr>
- </out:for-each>
- </table>
- </xsl:template>
- </xsl:stylesheet>
|