RE: [xsl] String test pro's /con's

Subject: RE: [xsl] String test pro's /con's
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 24 Jun 2002 20:30:35 +0100
> To test if an element contains data (any string) what is the 
> difference/benefits/cons?? to either of the following:  
> 
> <xsl:if test="string-length(./myelement)> 0 )
> 
> or 
> 
> <xsl:if test="not(./myelement='')">
> 
Use the second. string-length() can be an expensive operation because of
the need to scan the string looking for Unicode surrogate pairs. But of
course, performance questions are always processor-dependent. Saxon
optimizes the first expression to avoid scanning the string; other
processors may have ways of storing strings that make it faster to look
for surrogate pairs.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


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


Current Thread