Altova Mailing List Archives


RE: [xsl] error using number()

From: Mike Ferrando <mikeferrando@--------->
To:
Date: 5/14/2004 5:45:00 AM
Michael,
Ok. I thought this might be the problem. I need to use number() on
the string only. When I did that, it worked fine.

I took a look at the number() in your first edition. I gathered that
the function must be used purely and not mixed with other opperands.

However, I regularly write the following:

number($x + 7)

This has not given me any errors and passed by fine in SAXON 7.

Mike Ferrando
Washington, DC

--- Michael Kay <mhk@xxxxxxxxx> wrote:
> > I am getting this error.
> > 
> > When I run my stylesheet with SAXON instant 6.5.3, everything
> runs
> > fine without errors. But my friend ran the same stylesheet with
> his
> > SAXON 7 and received this error (below).
> > 
> > Is there some reason why the error only comes up with the SAXON
> 7?
> 
> Rather than 
> 
> number(substring(A,B,C) - 1000)
> 
> you need to write
> 
> number(substring(A,B,C)) - 1000
> 
> Generally, XPath 2.0 is stricter about type checking than 1.0
> (though if you
> specify version="1.0" in the xsl:stylesheet element then most
> things revert
> to the 1.0 rules). If you want to use a string as an arithmetic
> operand, you
> now have to convert it to a number explicitly. This change allows
> operators
> to be overloaded to do different things with different data types.
> 
> Michael Kay
> 
> 
> > 
> > Mike Ferrando
> > Washington, DC
> > 
> > 
> > Error returned:
> > 
> > bash-2.05b$  java -jar c:/saxon79/saxon7.jar -o ead.html
> > fa_2002_8859_1_x.xml c:/my_ead_2002_conv/ead_2002_HTML_conv-1.xsl
> 
> > Error at variable st_p-sb on line 2280 of
> > file:/c:/my_ead_2002_conv/ead_2002_HTML_conv-1.xsl:
> >   Unsuitable operands for arithmetic operation (xs:string,
> > xs:integer)
> > Transformation failed: Run-time errors were reported
> > 
> > XSL
> > 
> > 	<xsl:variable name="st_p-sb" 
> > select="number(substring($physdesc_b,
> > string-length($physdesc_b) -9, 4) - 1000)"/>
> > 
> > 
> > 
> > --- B Tommie Usdin <btusdin@xxxxxxxxxxxxxxxx> wrote:
> > > My goodness - such a lot of blood from such a small cut!
> > > 
> > > This announcement seems to have done something remarkable: at
> least
> > > for a moment in one forum it seems to have erased all concerns
> > > about XSLT 2.0 and rallied EVERYONE to it's defense.
> > > 
> > > How odd: until we saw this I heard quite a few concerns about
> > > XSLT 2.0 and have had several conversations with developers I
> > > respect who said that they were thinking of sticking with
> > > XSLT 1.0 because the gains in 2.0 (for their applications) were
> > > not worth the losses.  Now all of a sudden non-adoption of
> > > XSLT 2.0 is "killing xslt".
> > > 
> > > 
> > > Perhaps the folks at Microsoft were concerned that they would
> be
> > > criticized for adopting a controversial spec like XSLT 2.0 so
> they
> > > decided to rally support for it by announcing that they were
> not
> > > going to support it. Then they could change their minds and be
> > > heros instead of goats. ... Nahhhh. But it sounds good.
> > > 
> > > -- Tommie
> > > -- 
> > >
> >
>
======================================================================
> > > B. Tommie Usdin                       
> > > mailto:btusdin@xxxxxxxxxxxxxxxx
> > > Mulberry Technologies, Inc.               
> > > http://www.mulberrytech.com
> > > 17 West Jefferson Street                           Phone:
> > > 301/315-9631
> > > Suite 207                                    Direct Line:
> > > 301/315-9634
> > > Rockville, MD  20850                                 Fax:
> > > 301/315-8285
> > >
> >
>
----------------------------------------------------------------------
> > >    Mulberry Technologies: A Consultancy Specializing in  XML
> and
> > > SGML
> > >
> >
>
======================================================================
> > > 
> > 
> > 
> > 
> > 	
> > 		
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! - Internet access at a great low price.
> > http://promo.yahoo.com/sbc/
> 



	
		
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.