[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] position()!=last() works in one env, not in another


Subject: Re: [xsl] position()!=last() works in one env, not in another
From: "Sam Carleton" <scarleton@xxxxxxxxx>
Date: Thu, 8 Feb 2007 12:52:19 -0500

On 2/7/07, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:
You don't show enough of the code to tell.

For example, if your data were:

<test>
  <a/><b/><c/>
</test>

And you did:

<xsl:apply-templates/>

... with the following match:

<xsl:template match="c">
 <xsl:if test="position()!=last()">
   ...

Then it would return true() because the last node child of <test> is
a text node.  Perhaps you are doing something similar.

Why would XMLSpy return true()?  Perhaps it is incorrectly throwing
away white-space-only text nodes and thinks that the last node child
of <test> is <c/>, which it isn't.  For example, you would get the
same incorrect result using Internet Explorer, since it has a bug
that throws away white-space-only text nodes.  If XMLSpy is using
msxml.dll the same way that Internet Explorer is using it, then you
will get non-conformant behaviour.

You where 100% on the mark. The apply-template did not have a select statement, when I added one with only the relavent nodes, it works as expected. Thanks for both your help and Michaels help.

Sam


Current Thread