How to get the value from a valuelist in XSLT -
i'm creating web page has dropdown list , button. page updates value of original dropdown new selected one.
so have declared template this:
<xsl:template name="custtype"> <xsl:param name="custtypelbl" select="$lang.custtypelbl"/> <xsl:param name="valuelist"/> <xsl:param name="disable" select="'false'"/> <xsl:param name="controlname" select="'customertype'"/> <xsl:param name="onchange" select="''"/> <xsl:call-template name="selectbox"> <xsl:with-param name="selectboxlabel" select="$custtypelbl"/> <xsl:with-param name="controlname" select="$controlname"/> <xsl:with-param name="disable" select="$disable"/> <xsl:with-param name="valuelist" select="$valuelist"/> <xsl:with-param name="onchange" select="$onchange"/> <xsl:with-param name="valuecolspan" select="''"/> </xsl:call-template> </xsl:template>
and here content of dropdown:
<xsl:template name="customertypelist"> <xsl:param name="selectedcusttype"/> <xsl:call-template name="optionelement"> <xsl:with-param name="optionvalue" select="'m'"/> <xsl:with-param name="optiondescription" select="$lang.opt.customertype.member"/> <xsl:with-param name="selectedoptionvalue" select="$selectedcusttype"/> </xsl:call-template> <xsl:call-template name="optionelement"> <xsl:with-param name="optionvalue" select="'e'"/> <xsl:with-param name="optiondescription" select="$lang.opt.customertype.employee"/> <xsl:with-param name="selectedoptionvalue" select="$selectedcusttype"/> </xsl:call-template> <xsl:call-template name="optionelement"> <xsl:with-param name="optionvalue" select="'n'"/> <xsl:with-param name="optiondescription" select="$lang.opt.customertype.nonmember"/> <xsl:with-param name="selectedoptionvalue" select="$selectedcusttype"/> </xsl:call-template> <xsl:call-template name="optionelement"> <xsl:with-param name="optionvalue" select="'r'"/> <xsl:with-param name="optiondescription" select="$lang.opt.customertype.returncenter"/> <xsl:with-param name="selectedoptionvalue" select="$selectedcusttype"/> </xsl:call-template> </xsl:template>
then call/display dropdown in page this:
<xsl:call-template name="custtype"> <xsl:with-param name="customertype" select="$customertype"/> <xsl:with-param name="valuelist"> <xsl:call-template name="customertypelist"> <xsl:with-param name="selectedcusttype" select="$customertype"/> </xsl:call-template> </xsl:with-param> </xsl:call-template>
then when click button, pass these parameters:
<form name="{$customerdetailsform}" action="{$formaction}" method="post" onsubmit="{$formonsubmit}"> <input type="hidden" name="groupid" value="{$groupid}"/> <input type="hidden" name="selectedcusttype" value="{$customertype}"/> <input type="hidden" name="namechangecode" value=""/> <input type="hidden" name="statusinfots" value="{$customerinfonode/status/@timestamp}"></input> <input type="hidden" name="loyaltyidpanelflag" value="hidden"/> <input type="hidden" name="accessscreen" value="{$accessscreen}"/> <xsl:call-template name="datalayout"/> </form>
my problem not selected value of customertype (example: "m" member, "n" non-member, "e" employee). gets still same old value. (my "no data changed" error handler triggered)
i had lot of research dropdown in xslt, of them uses for-each didn't help. i'm beginner in language, i'm analyzing code , tweaking bit enhancement, , i'm not yet familiar these syntax.
my question is, "how using existing codes?" , appreciate if attach link / explain bit can learn more it. thank much.
if using xslt 1.0 engine built in browser, can generate html page, potentially containing javascript. once html page generated (and therefore, @ time user clicks button) xslt has done work , no longer executing: way handle user input events within javascript of html page.
this changes if use saxon-js, allows write code within xslt stylesheet responds user input events , modifies html page. can read saxon-js @ http://www.saxonica.com/saxon-js/index.xml
Comments
Post a Comment