This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A simple xsl:if question from a newbie


Hi Nicki,

> ----XSL-----
> <xsl:for-each select="ROWSET/ROW">
> 	<xsl:if test="substring(Starttime, 1, 10) = {Time}"> 
>     		
>         <xsl:value-of select="Body"/>
>       	</xsl:if>	
> </xsl:for-each>
> -----------
> 
> Unfortunately the condition never returns true.
> Is there anyone who's got some suggestions as to
> why???

Two points:
- you have to consider (i.e. remove) whitespace characters (newlines)
- Time isn't accessed correctly

Something like this should work:

<xsl:variable name="time" select="normalize-space(Time)" />
<xsl:for-each select="ROWSET/ROW">
	<xsl:if test="substring(normalize-space(Starttime), 1, 10) = $time"> 
           <xsl:value-of select="Body"/>
      	</xsl:if>	
</xsl:for-each>

Regards,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]