Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • vikram anand bhushan 1 post 71 karma points
    Feb 19, 2016 @ 06:16
    vikram anand bhushan

    How to use Choose condition on XSLT variable

    Hello Guys,

    I am new to XSLT , So putting up maybe really basic question .

    Well I will keep it short ,

    What I have to do is create three dummy variables (Which will be updated from server--LDAP ) and compare this against another set of variables ,After comparison I have to update the result in another variable and return that variable ,

    Here is the SUDO code .

    If ( A_Div_Code contain '$DIVISION_CODE') and  ( A_Dept_Code contains '$DEPT_CODE') and (A_job_Level contains '$JOB_LEVEL)
    If (C_Div_Code contain '$DIVISION_CODE') and  (C_Dept_Code contains '$DEPT_CODE') and (C_job_Level contains '$JOB_LEVEL)

    and the variables will be like this

    1.DIVISION_CODE : This variable will store the Division code received from LDAP for a user/file_id.
    Example :DIVISION_CODE":"48
    2.DEPT_CODE : This varaible will store the Department code received from LDAP for a user/file_id.
    Example :DEPT_CODE":"LT"
    3.JOB_LEVEL : This variable will store the Job level received from LDAP for a user/file_id 
    Example :JOB_LEVEL":"4B

    MI_GROUP : Which basically we be finding logically and sending to backend web server.

    Based on this I created following XSLT file ,

    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- New document created with EditiX at Thu Feb 18 19:08:23 IST 2016 -->
    <xsl:stylesheet version="2.0" 
        exclude-result-prefixes="xs xdt err fn">
        <xsl:output method="xml" indent="yes"/>
        <xsl:variable name="DIVISION_CODE" select="'47'" /> 
        <xsl:variable name="DEPT_CODE" select="'KT'" /> 
        <xsl:variable name="JOB_LEVEL" select="4B''" /> 
    <xsl:variable name="MI_GROUP"  /> 
        <xsl:variable name="A_Div_Code">
        <xsl:variable name="A_Dept_Code">
        <xsl:variable name="A_Job_Level">
        <xsl:variable name="C_Div_Code">
        <xsl:variable name="C_Dept_Code">
        <xsl:variable name="C_Job_Level">
        <xsl:template match="/">

    So basically I will have to compare the Three variable against those department codes and update the MI_GROUP variable

  • Chriztian Steinmeier 2732 posts 8341 karma points MVP 5x admin c-trib
    Feb 24, 2016 @ 20:03
    Chriztian Steinmeier

    Hi Vikram,

    I would love to see what you're really trying to output.

    E.g.: Is the macro only responsible for returning a value like A or A,C?


Please Sign in or register to post replies

Write your reply to: