- From: Shelby Moore <shelby@coolpage.com>
- Date: Mon, 30 Dec 2002 03:11:26 -0600
- To: "L. David Baron" <dbaron@fas.harvard.edu>
- Cc: www-style@w3.org
From private discussion, I generated the following XSLT snippet which is concise example of XSLT's powerful capabilities to make general transforms from abstract markup to any desired implementation. This translates a <select> into radio buttons. I think that is fairly impressive for such a concise snippet. Imagine the possibilites with only a few more lines! Remember that XSLT is Turning complete, so in theory *ANY* type of transformation is possible. It is silly exercise to ask me to write complex transformations just to prove that XSLT is Turing complete. That has already been proved. Besides then we would argue over complexities which could make this the longest thread ever. Also remember that we are comparing XSLT and XBL, not XUL. Any XBL example that inherits from XUL is going to be more concise because XBL has been narrowly designed (optimized) for XUL extensions. XUL could be used with XSLT transformations also. XSLT is more general. Note this example was written quickly and not tested. It may require a few fixes when tested, but sufficient to make the point. Probably the nested outer quotes need to be converted to entities. <xsl:template match="option"> <input type="radio" value="<xsl:value-of select="@value"/>" </xsl:template> <xsl:template match="select"> <xsl:apply-templates select="option"/> name="<xsl:value-of select="option"/>"> </xsl:template> The above template should convert: <select> <option value="value1">Item1</option> <option value="value2">Item2</option> . . . </select> To: <input type="radio" value="value1" name="Item1"> <input type="radio" value="value2" name="Item2"> . . . I could just have easily named it <customselect> instead of <select>. I thought the latter is more impressive, because you can use XSLT to change implementations of existing tags, not only custom ones! Feel the power of thin, orthogonal W3 standards! Reject attempts to de-commodize them. Commodity standards are good for mankind. -Shelby Moore
Received on Monday, 30 December 2002 04:11:11 UTC