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
|
> > <xsl:if test="string-length(WebExtra) > 1">
> > <xsl:variable name="webs">
> > <xsl:number value="count(WebExtra)"/>
> > </xsl:variable>
> > <xsl:choose>
> > <xsl:when test="$webs > '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/
|