mercredi 30 août 2017

XSLT with test and otherwise

I have below xslt where ID and LASTNAME are the input parameters. When ID matches the EMPLOYEE_ID in the VW_JAX_EMP_JOB_DEPTRECORDSELECT then set the Last_Name element as s0:PREFERREDLASTNAME otherwise se the input parameter LASTNAME. Below one doesnt work.

 <xsl:template name="GetLastNameVW_JAX_EMP_JOB_DEPT"> 
 <xsl:param name="ID" />
 <xsl:param name = "LASTNAME" />
 <xsl:element name="Last_Name">
 <xsl:choose>
 <xsl:when test="//s0:VW_JAX_EMP_JOB_DEPTRECORDSELECT[s0:EMPLOYEE_ID = $ID]/s0:PREFERREDLASTNAME">
 <xsl:value-of select="//s0:VW_JAX_EMP_JOB_DEPTRECORDSELECT[s0:EMPLOYEE_ID = $ID]/s0:PREFERREDLASTNAME" />
 </xsl:when>
 <xsl:otherwise> LASTNAME
 </xsl:otherwise>
 </xsl:choose>
 </xsl:element> 
 </xsl:template>

Can anyone please suggest me ho to set the otherwise tag here.

Aucun commentaire:

Enregistrer un commentaire