[xslt] Validation of the content of xsl:template


This issue is related to

Spec: There must be no content before an xsl:param inside an

I want to ask the list to what extent we should fix the validation
of the content of xsl:template. I'm asking this in order to see
what impact this would have on existing stylesheets.
Does someone rely on output of text or literal result elements or
whatever before an xsl:param inside a xsl:template?
If someone does rely on this incorrect behaviour, shall we just
fix it or somehow preserve the current state?

Example - the following incorrectly does not raise an error currently
(note the content before xsl:param here):

<xsl:stylesheet version="1.0"

  <xsl:template match="/">
    <xsl:if test="true()">
    <xsl:param name="foo"/>


A strict validation of the content will have also impact on scenarios
using xml:space="preserve".

Example - this stylesheet is not valid, since it has a text-node
before xsl:param; although it's a whitespace-only text-node, the
xml:space does preserve it. Currently this text-node is incorrectly
treated as "template" content, thus added to the output tree.

<xsl:stylesheet version="1.0"

  <xsl:template match="/" xml:space="preserve">
    <xsl:param name="foo"/>


As per XSLT 1.0, the above example is incorrect.

XSLT 2.0 stripps whitespace-only text before xsl:param
regardless of what xml:space indicates.

So we have the following possibilities:
1) Keep the broken behaviour.
   This would obviously change nothing.

2) Apply validation as defined by XSLT 1.0
   This would raise errors in existing broken stylesheets.

3) Go the XSLT 2.0 way and strip the whitespace.
   This would raise no error, but produce a different result.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]