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

Re: How do I use non-literals in <xsl:if statements

Subject: Re: How do I use non-literals in <xsl:if statements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 20 Oct 1999 16:39:33 +0100 (BST)
xsl if statement with string
> but my XSL processor must not support them (i.e they're always empty
> after assignment).  I'm using the LotusXSL processor. 

lotus xsl supports variables. probably you are looking at the value of
the variable outside the scope where it is bound.

A common mistake is

<xsl:if test="something">
  <xsl:variable name="x" select="something_else"/>
<xsl:if>
    ...$x ...
which doesn't work as the scope of the binding of $x ends at the
element containing the binding, ie the </xsl:if> here.


	<file previous_date="03/13/99">
		<file_date>04/03/99</file_date>
	</file>


you don't say which node you try to evaluate this on:
  <xsl:if test="file_date[not(. = @previous_date)]"> do something </xsl:if>

If you are on the file node then the string value of `.' will include
that white space, in which case you might want to use normalize-space(.)
but safer would be normalize-space(file_date)= @previous_date
(normalize-space() may be called normalize() if your xsl processor is
older than a couple of weeks or so)

If you are on the file_date  node, the nyou want
        normalize-space(.)=normalize-space(../@previous_date)
The normalize-space() can be omitted if you know there is never any
white space in these strings.


David


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


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.