|
Subject: RE: [xsl] Decimal precision From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Sat, 5 Feb 2005 17:20:07 -0000 |
Dimitre,
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"/>
I also changed the representation of the empty sequence to something more
direct.
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)
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.)
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: [xsl] 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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Decimal precision, Dimitre Novatchev | Thread | Re: [xsl] Decimal precision, Dimitre Novatchev |
| RE: [xsl] Selecting last text() fro, Michael Kay | Date | RE: RE: [xsl] WordML to XML/HTML, Vasu Nanjangud |
| Month |