xml - xsl choose when xpath not working -
i have following code. not appear trigger. want disable radio button 'overdraft' when 'personal' checked . if there easier ways or if can see doing wrong. have tried both options below.
<td class="label" colspan="1" width="50%"> <input class="label" type="radio" name="selectedfacilitytype" value="1" onclick="document.lending.selectedfacilitytypevalue.value=this.value"> <xsl:if test="facilitytype/options[@id='1']='checked'"> <xsl:attribute name="checked"/> </xsl:if> <!-- start --> <xsl:if test="lettertype/type[@id='personal']='checked'"> <xsl:attribute disabled="disabled"/> </xsl:if> <!-- end --> </input>overdraft </td> <xsl:choose> <xsl:when test="lettertype/type[@id='personal']='checked'"> <td class="label" colspan="1" width="50%"> <input class="label" type="radio" name="selectedfacilitytype" value="1" onclick="document.lending.selectedfacilitytypevalue.value=this.value" disabled="disabled"></input>overdraft </td> </xsl:when> <xsl:otherwise> <td class="label" colspan="1" width="50%"> <input class="label" type="radio" name="selectedfacilitytype" value="1" onclick="document.lending.selectedfacilitytypevalue.value=this.value"> <xsl:if test="facilitytype/options[@id='1']='checked'"> <xsl:attribute name="checked"/> </xsl:if> </input>overdraft </td> </xsl:otherwise> </xsl:choose>
sample xml:
<lending> <currentbaserate/> <lettertype> <type id="personal">checked</type> <type id="business"/> <type id="limited"/> </lettertype> <saved/> <applicantdetails> <name> <title/> <firstname/> <surname/> </name> <address> <addressline1/> <addressline2/> <addressline3/> <addressline4/> <addressline5/> </address> <ourref/> <date/> <salutation/> <facilitysought/> <signame/> <sigposition/> <signameadd/> <sigpositionadd/> </applicantdetails> <facilitytype> <options id="1">checked</options> <options id="2"/> <options id="3"/> <options id="4"/> <options id="5"/> <options id="6"/> <options id="7"/> <options id="8"/> </facilitytype>
for each xpath should use '//' before:
like instead of
<xsl:if test="facilitytype/options[@id='1']='checked'">
use
<xsl:if test="//facilitytype/options[@id='1']='checked'">
add in instance in script.
it can result desired output
Comments
Post a Comment