|
Subject: RE: [xsl] not() function behaving differently in java 1.4 and 1.5 environment. From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 2 Aug 2007 21:30:00 +0100 |
Looks like a bug. You are presumably using Xalan, so you should report it
there.
But it's likely to be a bug in the old version that's fixed in the new.
Can't be sure from your description.
> On a dry run we found the value of variable ($value) is null.
There's no such thing as null in XPath.
One possibility is that $value is a result tree fragment containing a
document node with no children. This exhibits rather surprising behaviour
and products have been known to get it wrong. For such a value, not($value)
should give false(), $value='' should give true. This is consistent with the
1.5 results you are seeing.
> The matrix below explains different test scenarios in which
> we ran the test changing java version and replacing
> not($value) with $value=''.
>
> Java Version Syntax Used
> Test Result
> --------------------------------------------------------------
> ----------
> ------------------------------------------
> 1.4 <xsl:when test="not($value) and
> position() = 1">YES</xsl:when> True
> 1.4 <xsl:when test="$value = '' and
> position() = 1">YES</xsl:when> False
> 1.5 <xsl:when test="not($value) and
> position() = 1">YES</xsl:when> False
> 1.5 <xsl:when test="$value = '' and
> position() = 1">YES</xsl:when> True
>
> The first test case is what the xsl originally looked like.
> The same test fails in java 1.5 environment. Interestingly
> changing the not() function with operator = (see test# 4),
> the xsl works fine.
>
> We have a couple of questions for this behavior:
>
> * Is there a difference in how a null and an empty string('') are
> interpreted in java 1.4 and java 1.5?
The XPath specification hasn't changed between java releases, if that's what
you mean. And there's no such thing as a null in XPath.
> * Are the semantics of the statements we are using for not() and
> the = operator equivalent?
No. Given a node with a zero-length string value, boolean($node) returns
true and $node='' also returns true.
> * Does XSL distinguish between null value and an empty string
> ('')?
>
Not applicable, there's no such thing as null in XSLT/XPath.
Michael Kay
http://www.saxonica.com/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] not() function behaving diff, Tandon, Rohit | Thread | Re: [xsl] IE Client side transforma, Ilya Sterin |
| [xsl] not() function behaving diff, Tandon, Rohit | Date | RE: [xsl] RE: Troubling passing par, Jessica Hennessey |
| Month |