Subject: Re: [xsl] Re: Re: The Perils of Sudden Type-Safety in XPath 2.0 From: "Kurt Cagle" <cagle@xxxxxxxxx> Date: Wed, 19 Feb 2003 14:19:37 -0800 |
Dmitre, I'm inclined to agree with Michael on this. I think that the type mechanisms do add (perhaps an unreasonable) burden in verbosity, but that is more than offset by the ability to move a significant amount of the heavy lifting into XPath through <xsl:function> <xsl:function name="fmt:bangPad"> <xsl:param name="expr"/> <xsl:result select="string-pad('!',xs:string(xs:integer($expr)))"/> </xsl:function> <xsl:value-of select="fmt:bangPad(@risk * @severity)"/> It does serve to make the language itself more functional, which has always been a problem I've had with XSLT1; not everything readily fits into the nodal model, and there was perhaps too much of an emphasis on recursive programming. I much prefer to do <xsl:for-each select="(1 to 16)"> <xsl:variable name="index" select="."/> <td><xsl:value-of select="$index"/></td> </xsl:for-each> than <xsl:call-template name="indexWalker"> <xsl:with-param name="index" select="1"/> </xsl:call-template> <xsl:template name="indexWalker"> <xsl:param name="index"/> <td><xsl:value-of select="$index"/></td> <xsl:if test="$index le 16"> <xsl:call-template name="indexWalker"> <xsl:with-param name="index" select="$index + 1"/> </xsl:call-template> </xsl:if> </xsl:template> In other words, XSLT2 is considerably less verbose in non-trivial cases. -- Kurt ----- Original Message ----- From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Wednesday, February 19, 2003 1:56 PM Subject: [xsl] Re: Re: The Perils of Sudden Type-Safety in XPath 2.0 > > > > One of the critiques about XSLT 1.0 is that it's too verbose. > > > From what I see about XSLT 2.0, transformations written in it > > > may well have to be twice as verbose as their XSLT 1.0 counterpart. > > > > No, my experience so far is that stylesheets that do no significant > > computation are essentially unchanged, while those that do a lot of > > computation can become dramatically smaller, because of features like > > conditional expressions in XPath and the availability of xsl:function, > > as well as the much richer built-in function library. > > Maybe it is too early for general observations. I was just comparing: > > <xsl:value-of select="string-pad('!', @risk * @severity)" /> > > with > > <xsl:value-of select="string-pad('!', xs:integer(@risk * @severity))" /> > > > and > > <xsl:variable name="danger" select="@risk * @severity"/> > > with > > <xsl:variable name="danger"> > <xsl:value-of select="@risk * @severity" /> > </xsl:variable> > > > and > > <xsl:value-of select="string-pad('!', @risk * @severity)" /> > > with > > <xsl:variable name="danger"> > <xsl:value-of select="@risk * @severity" /> > </xsl:variable> > <xsl:value-of select="string-pad('!', $danger)" /> > > > ===== > Cheers, > > Dimitre Novatchev. > http://fxsl.sourceforge.net/ -- the home of FXSL > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Re: The Perils of Sudden , Dimitre Novatchev | Thread | RE: [xsl] Re: Re: The Perils of Sud, Michael Kay |
[xsl] Re: Re: The Perils of Sudden , Dimitre Novatchev | Date | Re: [xsl] Should You Comment XSLT A, Steve Ball |
Month |