Page 1 of 1

Problem with script

Posted: Fri Feb 08, 2008 12:15 am
by sfmoorex
If I run the code below in the debugger (Oxygen 9.1 on Vista) it gives appropriate output for an appropriate input document. When I try to run from the command line with:

Code: Select all

java net.sf.saxon.Transform my.xml this.xml
I receive this error listing:

Code: Select all

Warning: at xsl:transform on line 4 of file:/c:/sil/digpub/ll/src/DocBook2LGM/s2.xsl:
Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor

Error on line 10 of file:/c/this.xsl:
XPTY0004: Arithmetic operator is not defined for arguments of types (numeric, xs:double)

Failed to compile stylesheet. 1 error detected.
However if I compile and then run in this fashion:

Code: Select all

java net.sf.saxon.Compile this.xsl this.xsc
java net.sf.saxon.Transform -c:this.xsc my.xml
everything works fine.

I have taken care to make certain that I am running the Saxon 9B processor from both the command line and within the Oxygen debugger.

It is of course a pain to do both steps each time. I am curious if Oxygen is doing the two-step process internally, and if not, what are the options passed the the Saxon processor. I am pretty certain I've never encountered this problem with earlier versions of Oxygen.

Here is the code for 'this.xsl':

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE stylesheet >

<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>


<xsl:template match="/">
<xsl:value-of select="(sum(item/a/@val)* 100)"/>
</xsl:template>

</xsl:transform>

Re: Problem with script

Posted: Fri Feb 08, 2008 1:21 pm
by sorin_ristache
Hello,

oXygen does not compile the stylesheet. It uses the one-step process.

I think you did not run the stylesheet with Saxon 9 in oXygen and you did not validate it in oXygen with Saxon 9. When I validate the stylesheet with Saxon 9 I get the same error in oXygen 9.1 that you get in the command line: Arithmetic operator is not defined for arguments of types (numeric, xs:double).

For running an XSLT 1.0 stylesheet with Saxon 9 you have to set Saxon 9 explicitly as the transformer of choice in the transformation scenario edit dialog because the default one for XSLT 1.0 is Saxon 6.5 which does not report an error for this stylesheet. For validating an XSLT 1.0 stylesheet with Saxon 9 you have to set Saxon 9 as the XSLT 1.0 validator in Options -> Preferences -> XML -- XSLT/FO/XQuery -- XSLT -- XSLT 1.0 Validate with. The reason is the same.


Regards,
Sorin