xsl-list
[Top] [All Lists]

Re: [xsl] previous sibiling node value

2010-11-14 14:55:32
okey, 
     here is my problem.

what i was trying to do is

<xsl:if test="$qmNumberFromContext=01">
<xsl:variable name="QMN1"select="$serviceType/QMNumber[1]"/>
<xsl:message>qmName one                                                   
   <xsl:value-of                                                          
      select="$QMN1/preceding-sibling::QMName[1]/text()" />
 </xsl:message>
</xsl:if>
 <xsl:if test="$qmNumberFromContext=02">
    <xsl:variable name="QMN2"select="$serviceType/QMNumber[2]"/>
    <xsl:message>qmName two
        <xsl:value-of
        select="$QMN2/preceding-sibling::QMName[1]/text()" />
   </xsl:message>
</xsl:if>

     I dont want to two if conditions over here  i need  more generalized one
    what i am looking is 
    <xsl:variable 
name="QMN2"select="$serviceType/QMNumber[$qmNumberFromContext]"/>
            which is throwing exception and getting empty values
       how can i fix this.


--- On Mon, 15/11/10, Dimitre Novatchev <dnovatchev(_at_)gmail(_dot_)com> wrote:

From: Dimitre Novatchev <dnovatchev(_at_)gmail(_dot_)com>
Subject: Re: [xsl] previous sibiling node value
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date: Monday, 15 November, 2010, 1:55 AM
I am confused, your last message is
difficult to understand and
doesn't contain any question.



On Sun, Nov 14, 2010 at 11:17 AM, ram <ram_kurra(_at_)yahoo(_dot_)co(_dot_)in>
wrote:
Thanks that perfectly works.
      let us suppose if i get qmNumber as 01 then i
need to get BRKQM
if i get qmNumber is 02 then i need to get BEKQM
i have written the logic like below but I am not able
to go second QMNUmber

if QMNumber is 2 its failing.Its showign only qmnumber
1

$qmNumberFromContext is variable which will come
either 01/02
$serviceType is Response

<xsl:choose>
       <xsl:when
test="$serviceType/QMNumber=$qmNumberFromContext">
         <xsl:value-of
       
 select="$qmNumberFromContext/precedingibling::QMName[1]/text()"/>

       </xsl:when>
        <xsl:otherwise/>

</xsl:choose>
--- On Mon, 15/11/10, Dimitre Novatchev <dnovatchev(_at_)gmail(_dot_)com>
wrote:

From: Dimitre Novatchev <dnovatchev(_at_)gmail(_dot_)com>
Subject: Re: [xsl] previous sibiling node value
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date: Monday, 15 November, 2010, 12:22 AM
On Sun, Nov 14, 2010 at 10:46 AM, ram
<ram_kurra(_at_)yahoo(_dot_)co(_dot_)in>
wrote:
Hi,
  I am trying to get the current node's
preceding-sibling node value.
Here is my xml


 <Policy Service="response">
   
 <QMName>BRKQM</QMName>>
     <QMNumber>01</QMNumber>
   
 <QMName>BEKQM</QMName>>
     <QMNumber>02</QMNumber>


 <RequestQueue>TEST.RSP</RequestQueue>
  </Policy>
                Let us suppose if my
qmNumber
is 02 i need to go to prevoius node QMName and get
BEKQM.
         How can i do this .


Use:

/*/QMNumber[. =
2]/preceding-sibling::QMName[1]/text()

This expression can be used in many xslt
instuctions -- in
attributes
such as "select" or "test" .

--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without
significant
intelligence.
---------------------------------------
To invent, you need a good imagination and a pile
of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you
don't know
whether what
you're doing is work or play


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





-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant
intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know
whether what
you're doing is work or play
-------------------------------------
I enjoy the massacre of ads. This sentence will slaughter
ads without
a messy bloodbath.

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