[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xsl:for-each and xml:space with text-nodes inbetween

Subject: xsl:for-each and xml:space with text-nodes inbetween
From: "Buchcik, Kasimier" <k.buchcik@xxxxxxxxxxxx>
Date: Tue, 25 Apr 2006 21:45:30 +0200
bar.xsl
Hi,

Does someone know what an XSLT 1.0 processor is expected
to do if the immediate child-node of an xsl:for-each is
a whitespace-only text node, which is preserved by xml:space?
Should any text-node, regardless if it's whitespace-only or not,
be reported as invalid at such a position?

Example

Stylesheet:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<foo>
		<!-- There's whitespace between xsl:for-each and
xsl:sort. -->
		<xsl:for-each select="/foo/bar" xml:space="preserve">
<xsl:sort /><xsl:value-of select="."/></xsl:for-each>
		</foo>
	</xsl:template>
</xsl:stylesheet>

Input:
<?xml version="1.0"?>
<foo>
  <bar>b</bar>
  <bar>c</bar>
  <bar>a</bar>
</foo>

Using the MSXML .NET Processor, I get the following result:

<?xml version='1.0' encoding='utf-8' ?>
<foo> a b c</foo>

If I change the whitespace-only text-node to contain a letter:
...
<xsl:for-each select="/foo/bar" xml:space="preserve">X<xsl:sort
/><xsl:value-of select="."/></xsl:for-each>
...
then an error is reported concerning the invalid position of xsl:sort
inside xsl:for-each. I'm confused here.

Was this maybe clarified in the XSLT 2.0 spec?

Regards,

Kasimier

Current Thread

Back To School Sale!

Save 30% off all Stylus Studio 2008 Products when you purchase from our Online Shop.

Offer ends August 31, 2008.

Coupon Code
TRTY-C4JV-OFF

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.