Page 1 of 1

Working with a data source from XSLT

Posted: Wed Jan 15, 2014 5:22 am
by Vadi
I've got an XSLT 2.0 transformation in Oxygen 14.2 that currently produces locally produces a result which the needs to be uploaded to an eXist database. Since Oxygen is connected to the database already (it is a "data source"), I'd like to remove the manual step of uploading and have the transformation (or the transformation scenario) do this for the user.

I'm not all that familiar with what Oxygen offers me in this regard however, and searching didn't bring up much. What would be the best way to solve this problem?

Re: Working with a data source from XSLT

Posted: Wed Jan 15, 2014 5:23 am
by Vadi
One additional detail that complicates a simple file upload is that I'd like to create a backup of the old file beforehand in the same collection (so a file rename will do).

Re: Working with a data source from XSLT

Posted: Wed Jan 15, 2014 12:31 pm
by adrian
Hi,

Unfortunately a transformation scenario in Oxygen can only be configured to output to the local file system. It cannot be configured to upload or output to a remote location. So this is not very straightforward.

Possible workarounds (not covering the backup):
- Map/mount the eXist database via WebDAV in the local file system (as a drive in Windows). Then you can configure the Oxygen transformation to output there.
- Create a custom stylesheet that outputs (via xsl:result-document) directly to the remote location URI:
e.g. for WebDAV connection

Code: Select all

<xsl:result-document href="http://path/to/my/resource" >
e.g. for eXist native connection

Code: Select all

<xsl:result-document href="oxygen:/<data-source-name>$<connection-name>/path/to/my/resource">
In both cases you can easily obtain the required URI from the Data Source Explorer view. Right click on the resource and use the Copy Location action from the contextual menu.

Regards,
Adrian

Re: Working with a data source from XSLT

Posted: Thu Jan 16, 2014 1:08 am
by Vadi
Thanks!