Transform:result-document error

Here should go questions about transforming XML with XSLT and FOP.
tjeffery
Posts: 4
Joined: Thu Jan 19, 2017 1:20 am

Transform:result-document error

Post by tjeffery »

When I run a transform scenario, I always get this error:

C:\Users\tjeffery01\Desktop\iot-ssp-um_clone\build1.xml:43: javax.xml.transform.TransformerException: java.lang.RuntimeException: Unsupported XSL element 'http://www.w3.org/1999/XSL/Transform:result-document'

The odd thing is that my colleague's machine does NOT get this error, using the same scripts, same data. The Oxygen versions are the same (XML Developer, v17.1 build 2016032212) and the same Preferences are set (as far as I can tell). The Libraries, Frameworks, and System Properties seem to be the same, but I could only eyeball.

Background: The scripts were built by a colleague no longer with the company. They were being used by another colleague who just left. I am the novice who inherited her job.

I can keep using her machine, but it is inconvenient. Any ideas what would cause this error on one system but not another?
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: Transform:result-document error

Post by adrian »

Hi,

Code: Select all

C:\Users\tjeffery01\Desktop\iot-ssp-um_clone\build1.xml:43: javax.xml.transform.TransformerException: java.lang.RuntimeException: Unsupported XSL element 'http://www.w3.org/1999/XSL/Transform:result-document'
This means that an XSLT 1.0 processor is being used to transform an XSLT 2.0 stylesheet. You need an XSLT 2.0 processor like Saxon 9. Usually it's enough for the processor .jar library to be in the classpath for this to work.
Any ideas what would cause this error on one system but not another?
Most likely there's a hard-coded path somewhere either in the scenario configuration or ANT build script that matches the location of some libraries on one system, but not on another.
Check the Libraries from the transformation scenario configuration. One of saxon9ee.jar or saxon9he.jar is required.
Also check how the transformation is run in the ANT script. Is there a java command and a classpath involved?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
tjeffery
Posts: 4
Joined: Thu Jan 19, 2017 1:20 am

Re: Transform:result-document error

Post by tjeffery »

Thanks! I think you are correct. On closer inspection, I see that the next line of the error msg is:

Code: Select all

	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
So the system is using Xalan instead of Saxon? Searching my code, I can only find refs to Saxon. They look like this:

Code: Select all

<scenario>
...
<field name="xslTransformer">
<String>Saxon-PE</String>
</field>
...
</scenario>
or

Code: Select all

<antScenario>
...
<field name="extensionURLs">
<String-array>
<String>file:/C:/Program%20Files/Oxygen%20XML%20Editor%2017/lib/saxon9ee.jar</String>
</String-array>
</field>
</antScenario>
The saxon9ee.jar does exist, and is good as far as I know.

Is Xalan a fallback when Saxon isn't working? Could that what is causing this?
Radu
Posts: 9431
Joined: Fri Jul 09, 2004 5:18 pm

Re: Transform:result-document error

Post by Radu »

Hi,

This may depend on how you are running the XSLT transformation from the ANT build file.
Could you give us a code snippet from the place in the build file where the XSLT transformation is started?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tjeffery
Posts: 4
Joined: Thu Jan 19, 2017 1:20 am

Re: Transform:result-document error

Post by tjeffery »

Thanks for the help given to a rank beginner! I'll try and extract the useful snippets.

The project file has this project tree:

Code: Select all

    <projectTree name="doxygen2dita.xpr">
<file name="build1.xml"/>
<file name="ssp-doc-data.xml"/>
</projectTree>
We right-click build1.xml and Apply Transformation Scenario(s). In the project file, there is an ANT Scenario entry for build1.xml like this:

Code: Select all

                            <antScenario>
<field name="additionalAntArgs">
<String></String>
</field>
<field name="buildTarget">
<String></String>
</field>
<field name="buildFilePath">
<String>${pd}/build1.xml</String>
</field>
<field name="ditaParams">
<list/>
</field>
<field name="jvmArgs">
<String>-Xmx256m</String>
</field>
<field name="useCustomJavaHome">
<Boolean>false</Boolean>
</field>
<field name="customJavaHomeDir">
<String></String>
</field>
<field name="useCustomANTHome">
<Boolean>false</Boolean>
</field>
<field name="customANTHomeDir">
<String></String>
</field>
<field name="workingDir">
<String>${pd}</String>
</field>
<field name="showConsoleAlways">
<Boolean>true</Boolean>
</field>
<field name="advancedOptionsMap">
<null/>
</field>
<field name="name">
<String>build1</String>
</field>
<field name="baseURL">
<null/>
</field>
<field name="footerURL">
<null/>
</field>
<field name="fOPMethod">
<null/>
</field>
<field name="fOProcessorName">
<null/>
</field>
<field name="headerURL">
<null/>
</field>
<field name="inputXSLURL">
<null/>
</field>
<field name="inputXMLURL">
<null/>
</field>
<field name="defaultScenario">
<Boolean>false</Boolean>
</field>
<field name="isFOPPerforming">
<Boolean>false</Boolean>
</field>
<field name="type">
<String>ANT</String>
</field>
<field name="saveAs">
<Boolean>true</Boolean>
</field>
<field name="openInBrowser">
<Boolean>true</Boolean>
</field>
<field name="outputFile">
<null/>
</field>
<field name="outputResource">
<null/>
</field>
<field name="openOtherLocationInBrowser">
<Boolean>true</Boolean>
</field>
<field name="locationToOpenInBrowserURL">
<String></String>
</field>
<field name="openInEditor">
<Boolean>false</Boolean>
</field>
<field name="showInHTMLPane">
<Boolean>false</Boolean>
</field>
<field name="showInXMLPane">
<Boolean>false</Boolean>
</field>
<field name="showInSVGPane">
<Boolean>false</Boolean>
</field>
<field name="showInResultSetPane">
<Boolean>false</Boolean>
</field>
<field name="useXSLTInput">
<Boolean>false</Boolean>
</field>
<field name="xsltParams">
<list/>
</field>
<field name="cascadingStylesheets">
<String-array/>
</field>
<field name="xslTransformer">
<String>ANT</String>
</field>
<field name="extensionURLs">
<String-array>
<String>file:/C:/Program%20Files/Oxygen%20XML%20Editor%2017/lib/saxon9ee.jar</String>
</String-array>
</field>
</antScenario>
build1.xml itself sets up and clears some directories, successfully. The error occurs in this section of the build file, when it loads doxygen2dita_v2.11-innerclasslist.xsl:

Code: Select all


    <target name="generate-innerclass-list"
description="Create the innerclasslist from index.xml."
depends="create-temp-dir-out">
<xslt
style="doxygen2dita_v2.11-innerclasslist.xsl"
in="${src.dir}/index.xml"
out="${out.dir}/out.txt"
>
</xslt>
</target>
The offending area of doxygen2dita_v2.11-innerclasslist.xls seems to be:

Code: Select all


   <xsl:template match="doxygenindex">
<xsl:result-document href="innerclass-list.xml">
<xsl:element name="list">
<xsl:for-each select="./compound[@kind='group' and contains(@refid, 'a_p_i') ]">
<!--<xsl:value-of select="$newline"></xsl:value-of>-->
<xsl:variable name="filename" select="concat($doxygendir, @refid, '.xml')"></xsl:variable>
<xsl:variable name="groupname" select="document($filename)/doxygen/compounddef/@id"></xsl:variable>
<xsl:variable name="innerclass-list">
<xsl:for-each select="document($filename)/doxygen/compounddef/innerclass">
<xsl:element name="item">
<xsl:element name="struct">
<xsl:value-of select="@refid"></xsl:value-of>
</xsl:element>
<xsl:element name="group">
<xsl:value-of select="$groupname"></xsl:value-of>
</xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:variable>
<xsl:copy-of select="$innerclass-list"></xsl:copy-of>
</xsl:for-each>
</xsl:element>
</xsl:result-document>
</xsl:template>
Hope this helps. If there is any other area that I should look at, any element or attribute, please let me know. Thanks.
Radu
Posts: 9431
Joined: Fri Jul 09, 2004 5:18 pm

Re: Transform:result-document error

Post by Radu »

Hi,

Thanks for the details.
From what the build file looks like, the xslt task should use the first Saxon library found in the scenario's classpath.
Could you edit the transformation scenario you are using, click the Libraries button, remove the reference to the saxon9ee.jar and add it again using the Add button?
If it still does not work, maybe you could zip your project, send it to support@oxygenxml.com and we can take a look at it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tjeffery
Posts: 4
Joined: Thu Jan 19, 2017 1:20 am

Re: Transform:result-document error

Post by tjeffery »

That worked! Thanks so much. The XPR file looks the same, but I guess there is an internal compiled version that looks different?

Thanks for all the help.
Radu
Posts: 9431
Joined: Fri Jul 09, 2004 5:18 pm

Re: Transform:result-document error

Post by Radu »

Hi,

There is no compiled version of the XPR, we use it as it is, if you have a copy of the older XPR you can compare the versions using our Tools menu->Compare Files.
In my opinion initially the reference to the Saxon 9 JAR was somehow incorrect.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply