[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl: variable comparision

Subject: Re: xsl: variable comparision
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 17 Nov 2010 17:50:36 -0500
Re:  xsl: variable comparision
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@xxxxxxxxxxx> 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[@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[@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.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.