Re: Transformation including database-call doesn't work

Hussein Shafie <[email protected]> Wed, 6 Oct 2021 16:30:19 +0200
Newsgroups gmane.editors.xxe.general
Message-ID <[email protected]>
Monika M. wrote:
> 
> I want to start an XSLT-Transformation via a button of the XML-Mind 
> (version 9.5.1). So far so good - "normal" transformations work fine. 
> But I have a transformation where I have to use <sql:query> to get 
> information of an access-database.
> 
> I copied the file saxon-sql-8.7.jar to the directory where I installed 
> XML-Mind and where the xxe.jar-file is settled (Z:\XMLMind_v9\bin\) and 
> tried to call the mentioned stylesheet.

1) Z:\XMLMind_v9\bin\ is not scanned for add-ons and extension ".jar" 
files during XXE startup. But the two add-on directories of XXE are.

For example, you'll find a 
XXE_install_dir/addon/config/docbook/docbook-xsl-saxon.jar (written by 
Normal Walsh, the author of the DocBook XSL stylesheets) which contains 
  extension functions and extension elements for Saxon 6.5 just like 
your saxon-sql-8.7.jar does but for Saxon 8.7 (<sql:query> is an 
extension element; 
https://www.saxonica.com/documentation9.5/sql-extension/).

2) XXE does not support Saxon 8.7 at all, only Saxon 6.5 and Saxon-HE 
9.9 (opensource Home Edition). See XXE_install_dir/bin/saxon.jar and 
XXE_install_dir/bin/saxon9.jar

This implies that, in theory, you must find a saxon-sql JAR but for 
Saxon 6.5 or for Saxon-HE 9.9 depending on whether your MY.xslt is an 
XSLT 1.0 or XSLT 2.0 stylesheet.




> 
> But I got the error that <sql:query> is an unknown extension 
> instruction. So I researched the Saxonica-Site (https://www.saxonica.com 
> <https://www.saxonica.com/>) and there I read, that for <sql:query> a 
> configuration-file is needed where the configuration parameters for 
> Saxon can be defined. This config-file can be applied by using the 
> option -config:filename on the transform command line.

There is no such -config:filename when Saxon runs embedded in XXE. All 
kinds of embedded Saxon configuration are done programmatically in Java.



> 
> But how can I apply this command "-config:filename" to this command in 
> XML-Mind:
> <cfg:command name="transform2news">
> <cfg:process showProgress="true">
> <cfg:transform stylesheet="xsl/MY.xslt" version="2.0" 
> file="%D" to="G:/XMLMind_V9/temp/%R.xml" cacheStylesheet="true">
> <cfg:parameter name="kat">%0</cfg:parameter>
> </cfg:transform>
> <cfg:read file="G:/XMLMind_V9/temp/%R.txt" encoding="default"/>
> <cfg:shell command="\\MYSERVER\MYBAT\copy.bat" 
> platform="Windows"/>
> </cfg:process>
> 
> Is there a possibility to do this?

Using <cfg:transform>, I don't think so, given what has been explained 
above.

May be a process command invoking

<cfg:shell command=ZZZ.bat ...>

rather than

<cfg:transform stylesheet=MY.xslt file="%D" ...>

to transform the document being edited.

The <cfg:shell> must be used to execute *your* external copy of Saxon 
8.7 (not the Saxon 6.5 or 9.9 embedded in XXE) with its own 
saxon-sql-8.7.jar properly configured using -config:filename

See http://www.xmlmind.com/xmleditor/_distrib/doc/commands/shell.html

--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support