W3C home > Mailing lists > Public > xsl-editors@w3.org > April to June 2001

RE: conditionals not allowed at top-level

From: Michael Kay <mhkay@iclway.co.uk>
Date: Sat, 28 Apr 2001 12:11:51 +0100
To: "'Mark Nahabedian'" <naha@ai.mit.edu>, <xsl-editors@w3.org>
Message-ID: <000a01c0cfd5$a7e4d770$0100007f@PCUKMKA>
> Conditional XSLT elements like <choose> and <if> are not currently
> allowed as direct children of <stylesheet>.  I'm writing to request
> that this restriction be relaxed.
>
> I wonder if there is any particular reason for this restriction.  It
> seems to me that there are several top-level elements which one might
> like to conditionalize, though there are others which the processor
> might find difficult to treat conditionally (e.g. <template>).

A personal response: I think it would be very hard to define consistent and
predictable semantics for this. <xsl:if> can invoke general XPath
expressions and XSLT templates, which can make arbitrary access to variables
and to the source document and can generate nodes on the result tree; it's
not possible to do this earlier than resolving xsl:include and xsl:import,
computing global variables, or assembling the full list of template rule
match patterns.

The specific requirement to parameterize the attributes of xsl:output is
addressed by allowing these values in the XSLT 1.1 working draft to be
attribute value templates.

There is a valid requirement, I think, for "compile time parameterization"
of stylesheets. Some projects solve this by generating stylesheets from some
higher-level representation: the fact that XSLT is encoded in XML makes it
straightforward to do this. Perhaps someone could standardize this approach,
creating in effect a set of preprocessor instructions rather like ifdef's in
C. I don't think this is a priority for the XSL WG, though.

Mike Kay
Received on Saturday, 28 April 2001 07:21:28 GMT

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