W3C home > Mailing lists > Public > xsl-editors@w3.org > October to December 1999

Re: Multiple xsl:strip-space and xsl:preserve-space declarations

From: James Clark <jjc@jclark.com>
Date: Sat, 11 Dec 1999 11:47:27 +0700
Message-ID: <3851D75E.45388B55@jclark.com>
To: Kay Michael <Michael.Kay@icl.com>
CC: "'xsl-editors@w3.org'" <xsl-editors@w3.org>
Kay Michael wrote:
> 
> The spec (section 3.4) is very confusing in this area.
> 
> The definition comes in two parts. The first part appears to describe an
> algorithm: "initially the set of whitespace-preserving names contains all
> names, if an element matches an xsl:strip-space it is removed from the list,
> if it matches an xsl:preserve-space it is added to the list".

This is broken. It should have been updated when the material about
conflicts were added.

> Further, the spec doesn't define what it means by
> "conflict", it doesn't say whether
> 
> <xsl:strip-space elements="title title"/>
> 
> is a conflict, or whether
> 
> <xsl:strip-space elements="title"/>
> <xsl:strip-space elements="title"/>
> 
> is a conflict; the fact that conflict resolution it is defined by reference
> to template rules suggests that it is a conflict, because there is no
> suggestion with template rules that a conflict doesn't arise if two
> templates have the same effect.

I would agree that these are conflicts.

Here's an attempt at a fixing the section:

<p>For source documents, the set of whitespace-preserving element
names is specified by <code>xsl:strip-space</code> and
<code>xsl:preserve-space</code> <termref
def="dt-top-level">top-level</termref> elements.  Whether an element
name is included in the set of whitespace-preserving names is
determined by the best match amongst <code>xsl:strip-space</code> or
<code>xsl:preserve-space</code> elements: it is included if and only
if there is no match or the best match is an
<code>xsl:preserve-space</code> element.  The
<code>xsl:strip-space</code> and <code>xsl:preserve-space</code>
elements each have an <code>elements</code> attribute whose value is a
whitespace-separated list of <xnt
href="&XPath;#NT-NameTest">NameTest</xnt>s; an element name matches an
<code>xsl:strip-space</code> or <code>xsl:preserve-space</code>
element if it matches one of the <xnt
href="&XPath;#NT-NameTest">NameTest</xnt>s. An element matches a <xnt
href="&XPath;#NT-NameTest">NameTest</xnt> if and only if the <xnt
href="&XPath;#NT-NameTest">NameTest</xnt> would be true for the
element as an <xspecref href="&XPath;#node-tests">XPath node
test</xspecref>.  When more than one <code>xsl:strip-space</code> and
<code>xsl:preserve-space</code> element matches, the best matching
element is determined by the best matching <xnt
href="&XPath;#NT-NameTest">NameTest</xnt>.  This is determined in the
same way as with template rules:</p>

<ulist>

<item><p>First, any match with lower <termref
def="dt-import-precedence">import precedence</termref> than another
match is ignored.</p></item>

<item><p>Next, any match that has a lower <termref
def="dt-default-priority">default priority</termref> than the <termref
def="dt-default-priority">default priority</termref> of another match
is ignored.</p></item>

</ulist>

<p>It is an error if this leaves more than one matching <xnt
href="&XPath;#NT-NameTest">NameTest</xnt>.  An XSLT processor may
signal the error; if it does not signal the error, it must recover by
choosing, from amongst the matches that are left, the one that occurs
last in the stylesheet.</p>

Is this clear?

James
Received on Saturday, 11 December 1999 00:18:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:49 GMT