After some more testing it actually turned out that the whitespace predicate is needed when using xalan 2.0.0 but not when using 2.3.0! Thanks again!
/Anders -----Original Message----- From: Anders Samuelson Sent: den 22 februari 2002 07:42 To: [EMAIL PROTECTED] Subject: RE: Different behaviour when using last() Exchanging '=text()' for '[self::text()]' did the trick! Thanks alot! /Anders -----Original Message----- From: Peter Davis [mailto:[EMAIL PROTECTED] Sent: den 21 februari 2002 20:21 To: [EMAIL PROTECTED] Subject: Re: Different behaviour when using last() I haven't tested, but you might try: child::node()[self::* or string-length(normalize-space(.)) > 0] [position()=last()][self::text()] I'm guessing that if you have an element at the end of your paragraph, you probably have whitespace after that element. The child::node() axis would also return the text node representing that space, and so the last node is always a text node. So the first predicate makes it so that [position()=last()] is only applied on elements or text nodes that have non-whitespace. If you've already accounted for all that, then, well, I'm at a loss for ideas. :) It's also probably better to use self::text() instead of "=text()", since the '=' sign is used to compare *all* of the child nodes matching text(), instead of just one; self::text() is probably more efficient. On Thursday 21 February 2002 05:29, Anders Samuelson wrote: > I have the following template snippet: > > <xsl:template match="paragraph"> > <xsl:apply-templates/> > <xsl:if test="child::node()[position()=last()]=text()"> > <xsl:call-template name="br"/> > </xsl:if> > </xsl:template> > > The purpose is that the 'br' template should only be called if the last > child node of the paragraph element is a text node. This wok fine with > Microsoft XML Parser 3.0 but not with xalan 2.0.0 (or 2.3.0 fo that > matter). With xalan the test argument is always true (as far as i can tell > from my tests). -- Peter Davis
