xsl-list
[Top] [All Lists]

[xsl] xsl: variable comparision

2010-11-17 15:46:09
Hi,
   I have a mapping file and an xsl which will read this xsl and do the 
comparision. But the comparision is not working. I am using xslt 1.0

Here is my map file

<Config-Policy> 
   <Policy Service="EBRequest"> 
      <QueueManager QMNumber="01" QMName="BRKQM"/>
      <QueueManager QMNumber="02" QMName="BEXQM"/>
      <RequestQueue>TEST.Req</RequestQueue>          
   </Policy>
   <Policy Service="EBResponse"> 
      <QueueManager QMNumber="01" QMName="BRKQM"/>
      <QueueManager QMNumber="02" QMName="BEXQM"/>
      <RequestQueue>TEST.RSP</RequestQueue>      
   </Policy>
</Config-Policy>



here is my xsl

<xsl:stylesheet version="1.0"
        extension-element-prefixes="dp func dpfunc dpconfig dyn"
        exclude-result-prefixes="dp func dpfunc dpconfig dyn"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:dp="http://www.datapower.com/extensions";
        xmlns:func="http://exslt.org/functions";
        xmlns:dpfunc="http://www.datapower.com/extensions/functions";
        xmlns:dpconfig="http://www.datapower.com/param/config";
        xmlns:dyn="http://exslt.org/dynamic";>

        <xsl:template match="/">

                <xsl:variable name="qmNumberFromContext"
                        select="'02'">
                </xsl:variable>
                <xsl:variable name="serviceType1">
                        <xsl:variable name="trType"
                                select="normalize-space('ENBRequest')" />
                        <xsl:choose>
                                <xsl:when test="($trType='EBRequest')">
                                        <xsl:message dp:type="custom category">
                                                Yes
                                        </xsl:message>
                                        <xsl:value-of select="'ENBRequest'" />
                                </xsl:when>
                                <xsl:when test="($trType='EBResponse')">
                                        <xsl:message dp:type="custom category">
                                                Yes
                                        </xsl:message>
                                        <xsl:value-of select="'ENBResponse'" />
                                </xsl:when>
                                <xsl:otherwise>
                                        <xsl:message dp:type="custom category">
                                                No matching service
                                        </xsl:message>
                                </xsl:otherwise>
                        </xsl:choose>
                </xsl:variable>

                <xsl:variable name="config"
                        select="document('QM_Mapping_Response.xml')" />
                <xsl:variable name="serviceType"
                        
select="$config/Config-Policy/Policy[(_at_)Service=$serviceType1]" />


                
                <xsl:variable name="qmNumber"
                        select="$serviceType/QueueManager/@QMNumber" />
                <xsl:message>
                        QMNumber =
                        <xsl:value-of select="$qmNumber"></xsl:value-of>
                </xsl:message>
                <xsl:message>
                        QMNumberFromContext =
                        <xsl:value-of 
select="$qmNumberFromContext"></xsl:value-of>
                </xsl:message>

                <xsl:choose>
                        <xsl:when test="$qmNumberFromContext = $qmNumber">
                                <xsl:variable name="mqQM"
                                        
select="$serviceType/QueueManager[(_at_)QMNumber=$qmNumberFromContext]/@QMName">
                                </xsl:variable>
                                <xsl:variable name="reqQueue"
                                        select="$serviceType/RequestQueue">
                                </xsl:variable>
                                <xsl:variable name="mq-routing-url"
                                        
select="concat('dpmq://',$mqQM,'?RequestQueue=',$reqQueue)" />
                                <xsl:message>
                                        DPMQURL
                                        <xsl:value-of 
select="$mq-routing-url"></xsl:value-of>
                                </xsl:message>

                        </xsl:when>
                        <xsl:otherwise>
                                <xsl:message>wrong</xsl:message>
                        </xsl:otherwise>
                </xsl:choose>


        </xsl:template>
</xsl:stylesheet>


<xsl:when test="$qmNumberFromContext = $qmNumber">  is not working.even if 
qmNumber is 01 its comming into when block. whats wrong here.





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>