Subject: Re: Why processor or stylesheets puts strange output
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 23 Aug 2002 10:19:02 -0600 (MDT)
|
TSchutzerWeissmann@xxxxxxxxxxxxxxxx wrote:
> <xsl:template match="text()[
> string-length(translate(.,'	

 ',''))=0]"/>
This can be shortened to
<xsl:template match="text()[translate(.,'	
 ','')]"/>
because the boolean equivalent of the string returned by translate()
will be false if the string is empty, true otherwise. Also there will
never be a carriage return in a text node, just linefeeds.
The abomination that is XPath 2.0 will change this (string 'true' or
'1' will be true) so you'll need to put the string-length() back in
someday, but the "=0" is redundant and can be omitted.
- Mike
____________________________________________________________________________
mike j. brown | xml/xslt: http://skew.org/xml/
denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|