xsl-list
[Top] [All Lists]

Re: [xsl] xsl: variable comparision

2010-11-18 11:55:52
so how to fix this one

--- On Thu, 18/11/10, Brandon Ibach 
<brandon(_dot_)ibach(_at_)single-sourcing(_dot_)com> wrote:

From: Brandon Ibach <brandon(_dot_)ibach(_at_)single-sourcing(_dot_)com>
Subject: Re: [xsl] xsl: variable comparision
To: "xsl-list" <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Date: Thursday, 18 November, 2010, 4:20 AM
Keep in mind that you're setting
$qmNumber to a node set.  The
xsl:value-of instruction that you're using to print out the
value of
$qmNumber will take the string value of only the first node
in that
set.  The comparison that you say isn't working will
evaluate to true
if any member of that set matches $qmNumberFromContext.

-Brandon :)


On Wed, Nov 17, 2010 at 4:45 PM, ram <ram_kurra(_at_)yahoo(_dot_)co(_dot_)in>
wrote:
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>
--~--



--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>