RE: xsl:for-each and xml:space with text-nodes inbetwe
> -----Original Message----- > From: Michael Kay [mailto:mike@xxxxxxxxxxxx] > Sent: Monday, May 08, 2006 7:21 PM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: xsl:for-each and xml:space with text-nodes > inbetween > > > Some additional tests revealed that some other processors are > > also buggy here. This produces a bit of headache on my side, > > since I would like to be compatible with Saxon and Xalan-J, > > but it seems like the behaviour of those processors does > > deviate from the spec. > > Actually, in the case of Saxon, it's not a bug: it was a > conscious decision > to treat this as an oversight in the spec. I disallowed it at > one stage, and > got a stream of bug reports, and decided that no useful > purpose was served > by rejecting these stylesheets. You might disagree with the > decision, but > the code is doing what it was designed to do. Now that we are trying to untangle such whitespace issues in Libxslt, we are hitting similar problems. In this particular case, I think we'll just keep Libxslt behaviour, which was to raise an error. For some other issues we'll probably keep the current behaviour as well and provide a way of specifying a "strict" stylesheet validation if wanted. A supplement to the test: Saxon 6.5.3 seems to allow any "template" content before xsl:sort, i.e., literal result elements, instructions, etc., while Xalan-J allows only text (regardless if whitespace-only or not), while MSXML .NET allows only whitespace-only text. So we'll happily add Libxslt's behaviour to this hot spot. The following <xsl:template match="/"> <foo> <xsl:for-each select="/foo/bar"></bar>--<xsl:sort/><xsl:value-of select="."/></xsl:for-each> </foo> </xsl:template> produces with Saxon 6.5.3: <foo><bar/>--a<bar/>--b<bar/>--c</foo> The following <foo> <xsl:for-each select="/foo/bar">--<xsl:sort/><xsl:value-of select="."/></xsl:for-each> </foo> produces with Xerces-J: <foo>--a--b--c</foo> Regards & thanks for the info, Kasimier
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format