Subject: Re: [xsl] xsl:for-each and xml:space with text-nodes inbetween From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Tue, 25 Apr 2006 16:44:01 -0400 |
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?
<!-- Category: instruction --> <xsl:for-each select = node-set-expression> <!-- Content: (xsl:sort*, template) --> </xsl:for-each>
Should any text-node, regardless if it's whitespace-only or not, be reported as invalid at such a position?
Using the MSXML .NET Processor, I get the following result:
<?xml version='1.0' encoding='utf-8' ?> <foo> a b c</foo>
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?
T:\ftemp>type kasimier.xml <?xml version="1.0"?> <foo> <bar>b</bar> <bar>c</bar> <bar>a</bar> </foo>
T:\ftemp>type kasimier.xsl <?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>
T:\ftemp>xslt kasimier.xml kasimier.xsl con Error at xsl:for-each on line 8 of file:/T:/ftemp/kasimier.xsl: An xsl:sort element is not allowed here Transformation failed: Failed to compile stylesheet. 1 error detected.
-- Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16 Also for XSLT/XSL-FO training: Minneapolis, MN 2006-07-31/08-04 Also for XML/XSLT/XSL-FO training:Birmingham,England 2006-05-22/25 Also for XSLT/XSL-FO training: Copenhagen,Denmark 2006-05-08/11 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] xsl:for-each and xml:spac, Michael Kay | Thread | [xsl] get the sum of a sequence of , Karen McAdams |
RE: [xsl] xsl:for-each and xml:spac, Michael Kay | Date | [xsl] get the sum of a sequence of , Karen McAdams |
Month |