Page 1 of 1

New Saxon engine, problem with concat?

Posted: Fri Oct 16, 2009 8:48 pm
by cawillwe
Hello,
I recently upgraded to Oxygen 11, and am now having a problem, possibly with the new Saxon engine. I believe it boils down to this:

(Source)

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<book name="bookname">
<value>Mytxt</value>
</book>
(XSL)

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs" version="2.0">
<xsl:output method="text"/>
<xsl:template match="book">
<xsl:variable name="txt" select="concat(./@name, ' does not work.')" as="xs:string"/>
<xsl:text>Hello </xsl:text>
<xsl:value-of select="concat($txt, 'otherstring')"/>
</xsl:template>
</xsl:stylesheet>
I am getting a "Attempting to access a sequence as a singleton item" error at the second concat call (8th line). It seems the result from the first concat call is 4 nodes: 1 empty node, a text node 'bookname', another text node 'does not work', and another empty node. Concat should, to my knowledge, return a string (and I'm even casting the variable as a string, to no avail). These types of calls were working in Saxon 9.1, so I'm a little lost. Please tell me there's a nice little setting in Oxygen or a switch in Saxon to resolve this. Alternatively, please tell me there's a better way to resolve this than using string-join calls everywhere, a la:

Code: Select all

<xsl:value-of select="concat(string-join($txt, ''), 'otherstring')"/>

Re: New Saxon engine, problem with concat?

Posted: Mon Oct 19, 2009 12:00 pm
by sorin_ristache
Hello,

I cannot reproduce the error. I tried with Saxon PE, Saxon HE and Saxon EE (and the default values for the other scenario parameters) in Oxygen 11 build 2009100911 and in all cases I get the result:

Code: Select all

Hello bookname does not work.otherstring
What Saxon edition do you use in the transformation scenario? What are the parameters that you use in the scenario? Can you export your scenarios with the action Export Global Transformation Scenarios from menu Options and send the file that contains the exported scenario?


Regards,
Sorin

Re: New Saxon engine, problem with concat?

Posted: Mon Oct 19, 2009 6:51 pm
by cawillwe
Hello, I'm using the Untitled2, but I've tried this on all 3 versions of the Saxon 9.2.0.2 as well:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<serialized version="11.0">
<map>
<entry>
<String xml:space="preserve">scenarios</String>
<scenario-array>
<scenario>
<field name="advancedOptionsMap">
<null></null>
</field>
<field name="name">
<String xml:space="preserve">Execute SQL</String>
</field>
<field name="baseURL">
<String xml:space="preserve"></String>
</field>
<field name="footerURL">
<String xml:space="preserve"></String>
</field>
<field name="fOPMethod">
<null></null>
</field>
<field name="fOProcessorName">
<null></null>
</field>
<field name="headerURL">
<String xml:space="preserve"></String>
</field>
<field name="inputXSLURL">
<String xml:space="preserve">${currentFileURL}</String>
</field>
<field name="inputXMLURL">
<String xml:space="preserve"></String>
</field>
<field name="defaultScenario">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="isFOPPerforming">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="type">
<String xml:space="preserve">SQL</String>
</field>
<field name="saveAs">
<Boolean xml:space="preserve">true</Boolean>
</field>
<field name="openInBrowser">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="outputFile">
<null></null>
</field>
<field name="openOtherLocationInBrowser">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="locationToOpenInBrowserURL">
<String xml:space="preserve"></String>
</field>
<field name="openInEditor">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="showInHTMLPane">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="showInXMLPane">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="showInSVGPane">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="showInResultSetPane">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="useXSLTInput">
<Boolean xml:space="preserve">true</Boolean>
</field>
<field name="xsltParams">
<list></list>
</field>
<field name="cascadingStylesheets">
<String-array></String-array>
</field>
<field name="xslTransformer">
<String xml:space="preserve">JDBC</String>
</field>
<field name="extensionURLs">
<String-array></String-array>
</field>
</scenario>
<scenario>
<field name="advancedOptionsMap">
<null></null>
</field>
<field name="name">
<String xml:space="preserve">Untitled2</String>
</field>
<field name="baseURL">
<String xml:space="preserve"></String>
</field>
<field name="footerURL">
<String xml:space="preserve"></String>
</field>
<field name="fOPMethod">
<String xml:space="preserve">pdf</String>
</field>
<field name="fOProcessorName">
<String xml:space="preserve">Built-in (Apache FOP)</String>
</field>
<field name="headerURL">
<String xml:space="preserve"></String>
</field>
<field name="inputXSLURL">
<String xml:space="preserve">file:/C:/Program%20Files/Oxygen%20XML%20Editor%2011/Untitled2.xsl</String>
</field>
<field name="inputXMLURL">
<String xml:space="preserve">file:/C:/Program%20Files/Oxygen%20XML%20Editor%2011/Untitled1.xml</String>
</field>
<field name="defaultScenario">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="isFOPPerforming">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="type">
<String xml:space="preserve">XML</String>
</field>
<field name="saveAs">
<Boolean xml:space="preserve">true</Boolean>
</field>
<field name="openInBrowser">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="outputFile">
<null></null>
</field>
<field name="openOtherLocationInBrowser">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="locationToOpenInBrowserURL">
<null></null>
</field>
<field name="openInEditor">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="showInHTMLPane">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="showInXMLPane">
<Boolean xml:space="preserve">true</Boolean>
</field>
<field name="showInSVGPane">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="showInResultSetPane">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="useXSLTInput">
<Boolean xml:space="preserve">true</Boolean>
</field>
<field name="xsltParams">
<list></list>
</field>
<field name="cascadingStylesheets">
<String-array></String-array>
</field>
<field name="xslTransformer">
<String xml:space="preserve">Saxon-PE</String>
</field>
<field name="extensionURLs">
<String-array></String-array>
</field>
</scenario>
<scenario>
<field name="advancedOptionsMap">
<null></null>
</field>
<field name="name">
<String xml:space="preserve">Execute XQuery</String>
</field>
<field name="baseURL">
<String xml:space="preserve"></String>
</field>
<field name="footerURL">
<String xml:space="preserve"></String>
</field>
<field name="fOPMethod">
<null></null>
</field>
<field name="fOProcessorName">
<null></null>
</field>
<field name="headerURL">
<String xml:space="preserve"></String>
</field>
<field name="inputXSLURL">
<String xml:space="preserve">${currentFileURL}</String>
</field>
<field name="inputXMLURL">
<String xml:space="preserve"></String>
</field>
<field name="defaultScenario">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="isFOPPerforming">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="type">
<String xml:space="preserve">XQUERY</String>
</field>
<field name="saveAs">
<Boolean xml:space="preserve">true</Boolean>
</field>
<field name="openInBrowser">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="outputFile">
<null></null>
</field>
<field name="openOtherLocationInBrowser">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="locationToOpenInBrowserURL">
<String xml:space="preserve"></String>
</field>
<field name="openInEditor">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="showInHTMLPane">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="showInXMLPane">
<Boolean xml:space="preserve">true</Boolean>
</field>
<field name="showInSVGPane">
<Boolean xml:space="preserve">false</Boolean>
</field>
<field name="showInResultSetPane">
<Boolean xml:space="preserve">true</Boolean>
</field>
<field name="useXSLTInput">
<Boolean xml:space="preserve">true</Boolean>
</field>
<field name="xsltParams">
<list></list>
</field>
<field name="cascadingStylesheets">
<String-array></String-array>
</field>
<field name="xslTransformer">
<String xml:space="preserve">Saxon-PE XQuery</String>
</field>
<field name="extensionURLs">
<String-array></String-array>
</field>
</scenario>
</scenario-array>
</entry>
</map>
</serialized>

Re: New Saxon engine, problem with concat?

Posted: Mon Oct 19, 2009 11:33 pm
by george
This problem was a bug in Saxon 9.2 as documented here:
http://sourceforge.net/tracker/?func=de ... tid=397617

This Saxon fix was integrated in the latest oXygen 11 build, 2009101512.
So just get the 2009101512 build from our download page and you will have this issue fixed:
http://www.oxygenxml.com/download_oxygenxml_editor.html

Best Regards,
George

Re: New Saxon engine, problem with concat?

Posted: Tue Oct 20, 2009 6:58 pm
by cawillwe
Thank you for the response. It seems I am having the Saxon issue you linked to, but the new Oxygen build did not seem to help.

Re: New Saxon engine, problem with concat?

Posted: Tue Oct 20, 2009 9:40 pm
by george
Hmm. I just reinstalled the latest build and tried your stylesheet and it works ok. Try maybe a fresh uninstall/install the latest build. You can also check that you have build 2009101512 in the Help->About dialog.

Best Regards,
George

Re: New Saxon engine, problem with concat?

Posted: Tue Oct 20, 2009 9:43 pm
by george
Hmm. I just reinstalled the latest build and tried your stylesheet and it works ok. Try maybe a fresh uninstall/install the latest build. You can also check that you have build 2009101512 in the Help->About dialog.

Best Regards,
George

Re: New Saxon engine, problem with concat?

Posted: Tue Oct 20, 2009 9:54 pm
by cawillwe
Still getting the error. I checked the help/about dialog, and am definitely on the correct build.

How can I make sure Oxygen is completely uninstalled? I've been doing it through add/remove programs, and this last time I did it, I also deleted anything in C:\Program Files\Oxygen XML Editor 11. But there still must be some registry entries in there, because after I install, I can still re-open all the files I had open in the previous installation.

Re: New Saxon engine, problem with concat?

Posted: Wed Oct 21, 2009 12:32 pm
by george
The uninstall procedure is described in the user manual and shows how to remove also the oXygen options:
http://www.oxygenxml.com/doc/ug-oxygen/ ... alone.html

We double checked this, with a clean installation both on Mac and on Windows. We tested with the files you posted above in this topic.

Maybe you can try installing also on a different machine or at least in a different folder.

Let us know if you still have issues.

Best Regards,
George

Re: New Saxon engine, problem with concat?

Posted: Wed Oct 21, 2009 11:31 pm
by cawillwe
Hello,
I installed in a different directory, and deleted all my app_data. The code above worked under Saxon-HE 9.2.0.2, but still didn't run under EE or PE. However, when I went to my actual stylesheets, I got a similar error in HE. This is because I was using a function with a concat result as an argument. The error is now produced when I use this as my stylesheet:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tmp="http://www.tmp.com"
exclude-result-prefixes="xs" version="2.0">
<xsl:output method="text"/>
<xsl:template match="book">
<xsl:variable name="txt" select="concat(./@name, ' does not work.')" as="xs:string"/>
<xsl:text>Hello </xsl:text>
<xsl:value-of select="tmp:stringAdd(concat($txt, 'otherstring'))"/>
</xsl:template>

<xsl:function name="tmp:stringAdd">
<xsl:param name="in" as="xs:string"/>
<xsl:value-of select="concat($in, 'more text')"/>
</xsl:function>
</xsl:stylesheet>
I get the "Attempting to access a sequence as a singleton item" error at line 13.

Re: New Saxon engine, problem with concat?

Posted: Thu Oct 22, 2009 2:17 pm
by george
Hi,

I was able to reproduce the issue in the XSLT Debugger with the 2009101512 build. Invoking the transformation outside the debugger should work fine.
We will provide a fix asap, probably in a few hours.

Best Regards,
George

Re: New Saxon engine, problem with concat?

Posted: Thu Oct 22, 2009 6:02 pm
by george
Hi,

Please get the build 2009102216 from
http://www.oxygenxml.com/download_oxygenxml_editor.html

Please confirm that the issue is solved.

Best Regards,
George

Re: New Saxon engine, problem with concat?

Posted: Thu Oct 22, 2009 7:37 pm
by cawillwe
Thanks very much, this fixed my problem.