XSLT Literal Result Element

Hi, 

DISelect is almost implementable in XSLT, which I expect was
intended. In particular using XSLT's "Literal Result Elements" [1],
one can write stylesheets such as (randomly selected from the spec)

<html xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0">

<xsl:variable name="isColor" select="di-cssmq-color(0)"/>
<xsl:variable name="presClass" select="colorClass"/>
<xsl:if expr="$isColor = 0">
    <xsl:variable ref="presClass" value="greyClass"/>
</xsl:if>
...
<h3 class="{$presClass}">Latest Cricket News</h3>
<dl class="{$presClass}">
    <dt>South Africa win latest one day international</dt>
    <dd>In a thrilling run chase, England yesterday just failed to overtake
    South Africa's mammoth score of 311.....</dd>
    <dt>Flintoff layoff will last four months</dt>
    <dd>Following recent surgery to correct a recurring injury problem, .......</dd>
</dl>
...
</html>

which is a legal XSLT stylesheet, according to [1]. So one could
imagine a generic stylesheet that would transform the example in the
spec into the example above by

-renaming select to choose
-changing the sel namespace to xsl
-renaming the value attribute to select

Of course that only does a partial job and it doesn't address the
events, extra markup like <options>, or the functions themselves.
Anyway, the above doesn't constitute a formal comment, just a
braindump (Sorry...). 

However, the following does:

1. The functions could be defined in the same style as the XPath2/XQuery
   Functions and Operators spec [2], i.e. make them namespaced?
   "di-cssmq-width" -> "sel:cssmq-width". That would allow XPath2 engines
   to use the functions without any ambiguity about where they come from.

2. There are many typos in the spec, mostly missing spaces following
   </code> or </a>. e.g. paragraph before 5.9.1
   "the <code>options</code>elements"

3. Section 5 is confusing because one doesn't know the structure of each
   element until 5.10. I would suggest examples in each section.
   Or even better, something like:

   5.1 Overview
   5.2 Conditional Processing
     5.2.1 if
     5.2.2 select (describe when/otherwise here)
   5.3 Options
     5.3.1 idreplace
     5.3.2 process
     5.3.3 required
   

[1] http://www.w3.org/TR/xslt#result-element-stylesheet
[2] http://www.w3.org/TR/xpath-functions/

Max.

Received on Tuesday, 3 May 2005 13:33:48 UTC