[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Re: The Perils of Sudden Type-Safety in XPath

Subject: Re: 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
bangpad
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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.