XSLT 2.0 xsl:output attributes should be dynamically configurable

The committee should reconsider allowing attribute value templates for most
attributes of xsl:output.

In the 2 May 2003 draft of the XSLT 2.0 spec, none of the attributes of
xsl:output allow attribute value templates. Instead, one of a number of
statically defined xsl:output instructions can be dynamically selected by
name through a xsl:result-document instruction.

I have to assume the two styles of configurability were considered by
committee before this choice was made, but the current choice is the lesser
of the two in terms of configurability, does not represent the "majority
opinion" in terms of existing vendor extensions to XSLT 1.0 and does not
satisfy the use case of at least one prominent industry standard.

1. xsl:output has 14 attributes that configure its behavior. If each
attribute had only 2 choices, more than 16,000 variants would be required to
allow any combination to be selected. The actual situation is worse because,
although some of the choices are co-dependent, others have many more than 2
possibilities. When only simple stylesheets are considered, this seems to be
a ridiculous end case, but when stylesheets are used as general-purpose
modules in other general-purpose but configurable applications,
configurability must be severely restricted because, of course, numbers in
these ranges are intractable.

2. Prior to 2.0, several authors offered extensions to allow dynamic output
configurability. The incomplete table below shows some examples:

Supplier  Extension        Processors
--------  ---------        ----------
Saxon     saxon:output     saxon 6.x
XSLT 1.1  xsl:output       ?
          xsl:document     saxon 6.x
EXSLT     exsl:document    libxslt
Apache    redirect:write   xalan

redirect:write is roughtly equivalent to xsl:result-document.

The XSLT 1.1 version of xsl:output is particularly relevant, as it allowed
dynamic parameterization ("All attributes on xsl:output are interpreted as
attribute value templates.") without allowing xsl:output to appear other
than at the top level. This feature would be complementary to XSLT 2.0's
xsl:result-document.

3. The Docbook XSLT stylesheets
(http://docbook.sourceforge.net/projects/xsl/) do output formatting for
Docbook. They are widely used in industry and, indeed, establish the
"standard style" for HTML output from Docbook. These stylesheets currently
make heavy use of vendor extensions to accomplish their goals. It would be
highly desirable if the needs of the stylesheets could be met using only
standard XSLT 2.0 features.

The attached chunker.xsl stylesheet from this application perfectly
illustrates the parameterization issue. The stylesheet makes use of both
saxon:output and exsl:document; when neither is available, it uses Xalan's
redirect:write, losing the ability to parameterize any aspect of the output
except the URI. This is not a satisfactory solution.

(Note that even with attribute value templates, the need for multiple
variants of xsl:output in a single application would not be eliminated, but
it would be reduced by orders of magnitude. The chunker.xsl stylesheet
clearly illustrates this. It also illustrates that, even in an application
where the authors are willing to expand multiple variants, there is a
practical limit to the number that can be reasonably supported.)

I am not associated in any way with the Docbook stylesheets, except as a
Docbook and XSLT user.

Bob Foster
http://www.xmlbuddy.com/

Received on Tuesday, 7 October 2003 15:12:19 UTC