RE: [xsl] contains()

Subject: RE: [xsl] contains()
From: Alia Mikati <Aliam@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Sep 2002 11:46:06 +0300
Thx a lot. It worked!

-----Original Message-----
From: Jarno.Elovirta@xxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Sep 2002 11:29:00 +0300
Subject: RE: [xsl] contains()

> Hi,
> 
> > I hope u can help me with this. I have this part of an xml file:
> >      ...
> >      <tr class="dynamic_row1">
> >         <td width="160px">
> >         <img border="0" src="mypictures/flags/euro.gif" width="21"
> >         height="13" />
> >          Euro</td>
> >         <td width="50px" class="dynamic_right">1.018</td>
> >         <td width="50px" class="dynamic_right">1.018</td>
> >         <td width="50px" class="dynamic_right">08:10</td>
> >         <td width="90px" class="dynamic_center">09 SEP 2002</td>
> >       </tr>
> >       ...
> > 
> > And I wanna get the sibling value of the row containing 
> > 'Euro'. But the 
> > xsl template is not working as if it can't find 'Euro'. 
> > ...
> > <xsl:template match="body/center/table/tr/td">
> >   <xsl:if test="contains(child::text(),'Euro')">
> > 	<b> Bid value is :  </b> 
> > 	<xsl:value-of select="normalize-space(following-sibling::td
> > [position() = 1])"/><br/><br/>
> > 	<b> Ask value is :  </b> 
> > 	<xsl:value-of select="normalize-space(following-sibling::td
> > [position() = 2])"/><br/><br/>
> >   </xsl:if>
> > </xsl:template>
> > ...
> > 
> > It works if instead of 'Euro' I searched for '1.018' for exp. or any 
> > other row value. I think the problem is the space before the 
> > word 'Euro'. 
> > I used 'normalize-space' but didnt work either. How can I fix it?
> 
> In the test you're testing the value of the first child text node,
> which in your example is "
        ", that is whitespace. Try
> 
>   contains(., 'Euro')
> 
> Jarno - Razed in Black: Disintegration (The Cure cover)
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread