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

Re: Decimal precision

Subject: Re: Decimal precision
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 6 Feb 2005 08:38:59 +1100
f decimal
Hi Mike,

> I notice that in FXSL-for-XSLT2, you're still using this 1.0 idiom:
> 
>   <doubleall:doubleall/>
> 
>   <xsl:template name="doubleall">
>     <xsl:param name="pList" select="/.."/>
> 
>     <xsl:variable name="vFunDouble"
> select="document('')/*/doubleall:*[1]"/>
> 
> Is this still necessary? It has very poor performance, because the
> stylesheet has to be reparsed at run-time. Wouldn't it now be possible to do
> 
>   <xsl:variable name="doubleall:doubleall" as="element()">
>      <doubleall:doubleall/>
>   </xsl:variable>
> 
>   <xsl:template name="doubleall">
>     <xsl:param name="pList" select="()"/>
> 
>     <xsl:variable name="vFunDouble" select="$doubleall:doubleall"/>

Thank you for this observation!


What happened was that FXSL for XSLT 2.0 was "ported" from the
existing FXSL for XSLT 1.0.

There are some historical layers and in many places the code can be
still better aligned with the features of XSLT 2.0.

This example is indicative, as now we can simply use 
        f:mult(2) 
instead of creating a new function f:doubleall()

It is a valuable observation that it is much more efficient to place
the template reference within a global xsl:variable than to re-parse
the stylesheet again and again.

I'll make the necessary changes and this will require some time. I'll
also try to compare the timings with these two techniques.
      

> 
> I also changed the representation of the empty sequence to something more
> direct.

So, what is the more direct representation of the empty sequence?

> 
> Also, your template rule:
> 
>  <xsl:template name="double" match="*[namespace-uri() = 'doubleall']"
> 
> would be more efficient in Saxon as
> 
>  <xsl:template name="double" match="doubleall:doubleall"/>
> 
> (because the hash lookup on template rules works best when the element name
> is known statically)


Definitely. I know about this and the newer templates use the more
efficient match pattern -- the older ones are part of the historical
layers.

> 
> and it would be better to return an atomic value rather than a text node:
> 
>  <xsl:value-of select="2 * $arg1"/>
> 
> should be
> 
>  <xsl:sequence select="2 * $arg1"/>
> 
> (I would also like to see some type declarations added, but that requires
> some thought.)

Yes, I must perform one pass on all FXSL code and make all these changes.

Thank you Mike.

Would it be interesting to you to be a member of the FXSL project team? 

Needless to say, your "Yes" will be a great stimulus for the project
and will help develop FXSL better and faster.


Cheers,

Dimitre Novatchev


> 
> Michael Kay
> http://www.saxonica.com/
> 
> > -----Original Message-----
> > From: Dimitre Novatchev [mailto:dnovatchev@xxxxxxxxx]
> > Sent: 05 February 2005 01:43
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: Re:  Decimal precision
> >
> > On Sat, 5 Feb 2005 12:13:08 +1100, Dimitre Novatchev
> > <dnovatchev@xxxxxxxxx> wrote:
> > > On Fri, 4 Feb 2005 23:32:03 -0000, Michael Kay
> > <mike@xxxxxxxxxxxx> wrote:
> > > > x/y/xs:decimal() works only in Saxon 8.2. In earlier
> > releases you have to
> > > > write it as
> > > >
> > > > for $x in x/y return xs:decimal($x)
> > >
> > > Or with FXSL:
> > >
> > >   sum(  f:map(f:decimal(),
> > /*/*/claim/claim_line/reimbursement_amount)   )
> > >
> >
> > The above was intended to show the solution of the OP.
> >
> > What in FXSL correspond's to:
> >
> >                 for $x in x/y return xs:decimal($x)
> >
> > is
> >
> >                f:map( f:decimal(), x/y )
> >
> >
> > Cheers,
> > Dimitre.

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.