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

RE: comparisons between strings have changed since XPa

Subject: RE: comparisons between strings have changed since XPath 1.0 warning
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 5 Oct 2005 09:32:19 +0100
RE:  comparisons between strings have changed since XPa
> > <xsl:if test="string-length(WebExtra) &gt; 1">
> >         <xsl:variable name="webs">
> >                 <xsl:number value="count(WebExtra)"/>
> >         </xsl:variable>
> >         <xsl:choose>
> >                 <xsl:when test="$webs &gt; '3'">


Yet another oddity here. If count(WebExtra) can be greater than 1, then
string-length(WebExtra) is going to give you the string-length of the first
WebExtra element under 1.0, but in 2.0 mode it's going to give you an error.
If you really want to test the string-length of the first WebExtra element
under 2.0 then you have to say so explicitly by writing
string-length(WebExtra[1]). This change was introduced because a lot of
people were writing such code by mistake - I don't know if that's the case
here, but given the questionable nature of the rest of the code, I would
look at it pretty carefully.

Michael Kay
http://www.saxonica.com/

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.