|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Arithmetic operator is not defined for arguments of types (numeric, xs:double)Michael, I've a horrible feeling that this is going to be user-error but... The transform below if run with saxon 8.9J produces $ saxon8 test.xml test.xsl Warning: at xsl:stylesheet on line 2 of file:/C:/cygwin/home/mml2tex/test.xsl: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor <?xml version="1.0" encoding="UTF-8"?>3 which is what I exected. If run with Saxon 9.1.0.1J then it produces no output and gives the error $ saxon9 test.xml test.xsl Warning: at xsl:stylesheet on line 2 column 52 of test.xsl: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor Error at xsl:template on line 4 column 42 of test.xsl: XPTY0004: Arithmetic operator is not defined for arguments of types (numeric, xs:double) Failed to compile stylesheet. 1 error detected. If I change the version= attribuute to 2.0 instead of 1.0 then saxon 8 and 9 give the same result $ saxon9 test.xml test.xsl <?xml version="1.0" encoding="UTF-8"?>3 test.xsl <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="apply" priority="1"> <xsl:value-of select="sum(bvar/degree)+count(bvar[not(degree)])"/> </xsl:template> </xsl:stylesheet> test.xml <apply> <partialdiff/> <bvar> <ci>x</ci> <degree> <cn>2</cn> </degree> </bvar> <bvar> <ci>y</ci> </bvar> </apply> David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: Arithmetic operator is not defined for arguments of types(numeric, xs:double)Looks like a bug in the code for backwards-compatible arithmetic, which is
now handled completely separately from 2.0 arithmetic. I'll look into it. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: saxon-help-bounces@... > [mailto:saxon-help-bounces@...] On Behalf > Of David Carlisle > Sent: 20 July 2008 23:41 > To: saxon-help@... > Subject: [saxon] Arithmetic operator is not defined for > arguments of types(numeric, xs:double) > > > Michael, > > I've a horrible feeling that this is going to be user-error but... > > The transform below if run with saxon 8.9J produces > > > $ saxon8 test.xml test.xsl > Warning: at xsl:stylesheet on line 2 of > file:/C:/cygwin/home/mml2tex/test.xsl: > Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor > <?xml version="1.0" encoding="UTF-8"?>3 > > which is what I exected. > > > If run with Saxon 9.1.0.1J then it produces no output and > gives the error > > $ saxon9 test.xml test.xsl > Warning: at xsl:stylesheet on line 2 column 52 of test.xsl: > Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor > Error at xsl:template on line 4 column 42 of test.xsl: > XPTY0004: Arithmetic operator is not defined for arguments > of types (numeric, xs:double) Failed to compile stylesheet. 1 > error detected. > > > If I change the version= attribuute to 2.0 instead of 1.0 > then saxon 8 > and 9 give the same result > > $ saxon9 test.xml test.xsl > <?xml version="1.0" encoding="UTF-8"?>3 > > > > > test.xsl > <xsl:stylesheet version="2.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:template match="apply" priority="1"> > <xsl:value-of select="sum(bvar/degree)+count(bvar[not(degree)])"/> > </xsl:template> > > </xsl:stylesheet> > > > > test.xml > <apply> > <partialdiff/> > <bvar> > <ci>x</ci> > <degree> > <cn>2</cn> > </degree> > </bvar> > <bvar> > <ci>y</ci> > </bvar> > </apply> > > > > David > > > > ______________________________________________________________ > __________ > The Numerical Algorithms Group Ltd is a company registered in England > and Wales with company number 1249803. The registered office is: > Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. > > This e-mail has been scanned for all viruses by Star. The service is > powered by MessageLabs. > ______________________________________________________________ > __________ > > -------------------------------------------------------------- > ----------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK & > win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: Arithmetic operator is not defined for arguments of types(numeric, xs:double)I've created a patch for Saxon 9.0 and 9.1 and will post it as soon as I get
online. The problem occurs with any arithmetic expression in backwards compatibility mode where the static type of one of the operands is "numeric" (and not a specific numeric type). This is the case for sum(/a/b/c) where c is known to be untypedAtomic (the expression works in Saxon-SA, curiously, because less type information is available in that case - c might be of type duration, so the inferred type for sum() is anyAtomicType, which works OK.) The reason that the inferred type is "numeric" rather than xs:double is that sum() is defined to return the integer zero when the argument is an empty sequence. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: saxon-help-bounces@... > [mailto:saxon-help-bounces@...] On Behalf > Of David Carlisle > Sent: 20 July 2008 23:41 > To: saxon-help@... > Subject: [saxon] Arithmetic operator is not defined for > arguments of types(numeric, xs:double) > > > Michael, > > I've a horrible feeling that this is going to be user-error but... > > The transform below if run with saxon 8.9J produces > > > $ saxon8 test.xml test.xsl > Warning: at xsl:stylesheet on line 2 of > file:/C:/cygwin/home/mml2tex/test.xsl: > Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor > <?xml version="1.0" encoding="UTF-8"?>3 > > which is what I exected. > > > If run with Saxon 9.1.0.1J then it produces no output and > gives the error > > $ saxon9 test.xml test.xsl > Warning: at xsl:stylesheet on line 2 column 52 of test.xsl: > Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor > Error at xsl:template on line 4 column 42 of test.xsl: > XPTY0004: Arithmetic operator is not defined for arguments > of types (numeric, xs:double) Failed to compile stylesheet. 1 > error detected. > > > If I change the version= attribuute to 2.0 instead of 1.0 > then saxon 8 > and 9 give the same result > > $ saxon9 test.xml test.xsl > <?xml version="1.0" encoding="UTF-8"?>3 > > > > > test.xsl > <xsl:stylesheet version="2.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:template match="apply" priority="1"> > <xsl:value-of select="sum(bvar/degree)+count(bvar[not(degree)])"/> > </xsl:template> > > </xsl:stylesheet> > > > > test.xml > <apply> > <partialdiff/> > <bvar> > <ci>x</ci> > <degree> > <cn>2</cn> > </degree> > </bvar> > <bvar> > <ci>y</ci> > </bvar> > </apply> > > > > David > > > > ______________________________________________________________ > __________ > The Numerical Algorithms Group Ltd is a company registered in England > and Wales with company number 1249803. The registered office is: > Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. > > This e-mail has been scanned for all viruses by Star. The service is > powered by MessageLabs. > ______________________________________________________________ > __________ > > -------------------------------------------------------------- > ----------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK & > win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: Arithmetic operator is not defined for arguments of types(numeric, xs:double)Thanks, David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
| Free Forum Powered by Nabble | Forum Help |