External data from XQuery in Transformation Scenario.

I am new to oxygen and I was wondering if it is possible to setup a transformation scenario where it would take my local file then add some data from external XQuery processor and take resulting XML and hand it off XSLT Processor and then to PDF FO. Here is my scenario in more details. I have main input DocBook 5 xml file. That file contains most of the data that needs to go in PDF. However final PDF needs some data that is not in that XML. That data is stored in a separate set of files and needs to be selected using complex XQuery based on certain parameters. Those parameters are stored in main xml file in processing instructions. Is something like this possible? Perhaps chained scenarios where output of one is input to another. Sort of like Apache Cocoon with eXist. -- Sincerely, Mike

Hello, It is possible to set up a chain of XSLT transformations in the same transformation scenario but in the current version it is not possible to chain XQuery and XSLT transformations in the same scenario. That means you will have to create a first scenario that runs the XQuery transformation for filling the DocBook 5 XML file with the details based on the processing instructions and a second scenario that applies the predefined DocBook PDF scenario to the result of the first scenario. You find details about transformation scenarios (create a scenario, chain some transformations in the same scenario, etc) and about the supported XQuery processors in the Oxygen User Manual: http://www.oxygenxml.com/doc/ug-oxygen/defining-new-transformation-scenario.... http://www.oxygenxml.com/doc/ug-oxygen/additional-xslt-stylesheets.html http://www.oxygenxml.com/doc/ug-oxygen/transforming-xml-documents-using-xque... http://www.oxygenxml.com/doc/ug-oxygen/database-perspective.html If the XQuery processor does not have built-in support in Oxygen you can set it as custom processor in Oxygen and use it in a transformation scenario: http://www.oxygenxml.com/doc/ug-oxygen/preferences-custom-engines.html Please let us know if you have problems using any feature. Also you can set up an XProc scenario and run it as a single action from Oxygen with an integration of an XProc processor, as in Florent's example (he posted a message about it to this mailing list too): http://fgeorges.blogspot.com/2008/10/poor-mans-calabash-integeration-into.ht... http://fgeorges.blogspot.com/2008/11/xproc-with-xslt-completion-in-oxygen.ht... Regards, Sorin Mike Starov wrote:
I am new to oxygen and I was wondering if it is possible to setup a transformation scenario where it would take my local file then add some data from external XQuery processor and take resulting XML and hand it off XSLT Processor and then to PDF FO.
Here is my scenario in more details.
I have main input DocBook 5 xml file. That file contains most of the data that needs to go in PDF. However final PDF needs some data that is not in that XML. That data is stored in a separate set of files and needs to be selected using complex XQuery based on certain parameters. Those parameters are stored in main xml file in processing instructions. Is something like this possible? Perhaps chained scenarios where output of one is input to another. Sort of like Apache Cocoon with eXist.

Sorin Ristache wrote: Hi,
Also you can set up an XProc scenario and run it as a single action from Oxygen with an integration of an XProc processor, as in Florent's example (he posted a message about it to this mailing list too):
http://fgeorges.blogspot.com/2008/10/poor-mans-calabash-integeration-into.ht... http://fgeorges.blogspot.com/2008/11/xproc-with-xslt-completion-in-oxygen.ht...
Out of interest, Mike can use something like the following if he wants to follow that road: <p:pipeline xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:e="http://exist.sourceforge.net/NS/exist"> <!-- query eXist through its REST interface --> <p:http-request name="hello"> <p:input port="source"> <p:inline> <c:request href="http://localhost:8080/exist/rest/db" method="post" username=".." password=".."> <c:body content-type="application/xml"> <e:query> <e:text>concat('Hello, ', 'world!')</e:text> </e:query> </c:body> </c:request> </p:inline> </p:input> </p:http-request> <!-- enrich the docbook document with data from eXist --> <p:xslt name="enrich"> <p:input port="source"> <p:document href="mike-starov.xml"/> <p:pipe port="result" step="hello"/> </p:input> <p:input port="stylesheet"> <p:inline> <xsl:stylesheet version="2.0"> <!-- identity template pattern --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <!-- add a PI before the title elements --> <xsl:template match="title"> <xsl:processing-instruction name="pi"> <xsl:value-of select="collection()[2]/*"/> </xsl:processing-instruction> <xsl:next-match/> </xsl:template> </xsl:stylesheet> </p:inline> </p:input> </p:xslt> <!-- transform the resulting docbook document --> <p:xslt name="format"> <p:input port="source"> <p:pipe port="result" step="enrich"/> </p:input> <!-- the stylesheet you use to format the resulting docbook document --> <p:input port="stylesheet"> ... </p:input> </p:xslt> </p:pipeline> Hope that helps, -- Florent Georges http://www.fgeorges.org/ __________________________________________________________________________________________________ Ne pleurez pas si votre Webmail ferme ! Récupérez votre historique sur Yahoo! Mail ! http://fr.docs.yahoo.com/mail/transfert_mails.html

Hello.
It is possible to set up a chain of XSLT transformations in the same transformation scenario but in the current version it is not possible to chain XQuery and XSLT transformations in the same scenario. That means you will have to create a first scenario that runs the XQuery transformation for filling the DocBook 5 XML file with the details based on the processing instructions and a second scenario that applies the predefined DocBook PDF scenario to the result of the first scenario.
You find details about transformation scenarios (create a scenario, chain some transformations in the same scenario, etc) and about the supported XQuery processors in the Oxygen User Manual:
I cannot find a way to chain transformation scenarios and execute them in one step.
If the XQuery processor does not have built-in support in Oxygen you can set it as custom processor in Oxygen and use it in a transformation scenario:
I know oXygen has support for eXist but is there a way to execute XQeries withing oXygen locally without use of a server. Perhaps using Saxon. All files that are to be queried are within the project or in the same directory as the project. This way I can modify files and see the end result right away without having to upload to server. I know i can just edit files directly in eXist DB but that is not good enough. All my XML files are to be under source control and thus have to be local (or maybe WebDAV). I am making my way through the Manuals ( i am looking at both Author and Editor ) and if some of my questions are answered there then bare with me and please point me there. By the way, oXygen is by far one of the best written apps I ever used ( appears to be very well designed and thought through ). :)
Please let us know if you have problems using any feature.
Also you can set up an XProc scenario and run it as a single action from Oxygen with an integration of an XProc processor, as in Florent's example (he posted a message about it to this mailing list too):
http://fgeorges.blogspot.com/2008/10/poor-mans-calabash-integeration-into.ht...
http://fgeorges.blogspot.com/2008/11/xproc-with-xslt-completion-in-oxygen.ht...
Thanks. The sample from F. Georges really put the light on it. This looks very promising. Actually I never heard of XProc before so I had to go and research it a bit. To me it looks very similar (in concept) to Apache Cocoon pipelines. I already have a working Cocoon pipeline that takes main XML add more XML from XQuery then hands it off to XSL then to FO Processor. The downside to this, is that after editing XML, you have update XML DB on the server to get new results. I would rather have this done all withing oXygen with a press of a button, at least for preview purposes. Seems like XProc can do it for me. Now where do I find a good tutorial for it. I need to know if it can for FO -> PDF transformations.

The transformation scenarios cannot be chained. The XSLT transformations can be chained in a scenario if you set the first XSLT stylesheet in the XSL URL field and add the following stylesheets with the Additional XSLT stylesheets button: http://www.oxygenxml.com/doc/ug-oxygen/additional-xslt-stylesheets.html http://www.oxygenxml.com/doc/ug-oxygen/defining-new-transformation-scenario.... Regards, Sorin Mike Starov wrote:
I cannot find a way to chain transformation scenarios and execute them in one step.

Sorin Ristache wrote:
The transformation scenarios cannot be chained. The XSLT transformations can be chained in a scenario if you set the first XSLT stylesheet in the XSL URL field and add the following stylesheets with the Additional XSLT stylesheets button:
Is this feature ( being able to arbitrarily create a transformation pipeline ) on oXygen's development TODO list? I think this will be useful for many people. Its like XProc or Cocoon but its all local to the editor. That will make oXygen editor one stop shop for sure. We are still going to use the editor: I'll probably build an external scripts that does everything in one step.
Regards, Sorin
Mike Starov wrote:
I cannot find a way to chain transformation scenarios and execute them in one step.
oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

Mike Starov wrote:
Is this feature ( being able to arbitrarily create a transformation pipeline ) on oXygen's development TODO list? I think this will be useful for many people. Its like XProc or Cocoon but its all local to the editor.
If we speak about future features related to the scenarii in oXygen, I think it would be more consistent to invest on XProc support, and allowing one to use an XProc script to drive a scenario. But I am maybe not totally objective here ;-) Regards, -- Florent Georges http://www.fgeorges.org/ __________________________________________________________________________________________________ Ne pleurez pas si votre Webmail ferme ! Récupérez votre historique sur Yahoo! Mail ! http://fr.docs.yahoo.com/mail/transfert_mails.html

On 2/6/2009 11:28 AM, Florent Georges wrote:
Mike Starov wrote:
Is this feature ( being able to arbitrarily create a transformation pipeline ) on oXygen's development TODO list? I think this will be useful for many people. Its like XProc or Cocoon but its all local to the editor.
If we speak about future features related to the scenarii in oXygen, I think it would be more consistent to invest on XProc support, and allowing one to use an XProc script to drive a scenario.
But I am maybe not totally objective here ;-)
Regards,
I would agree that if you're going to provide XML pipeline features, it would be more useful if you could go with an existing standard (i.e. XProc), rather than reinventing the wheel... then the pipelines we use in Oxygen could be used elsewhere and vice versa. That would also help identify needed improvements to the XProc draft standard, as well as helping to drive adoption. Lars

On 2/6/2009 3:51 PM, Lars Huttar wrote:
I would agree that if you're going to provide XML pipeline features, it would be more useful if you could go with an existing standard (i.e. XProc), rather than reinventing the wheel... then the pipelines we use in Oxygen could be used elsewhere and vice versa.
That would also help identify needed improvements to the XProc draft standard, as well as helping to drive adoption.
Lars
P.S. Even though we use Cocoon heavily, I would prefer to see XProc support in Oxygen than Cocoon sitemap support. The latter is not designed for use outside of Cocoon. Nor is it designed to be a standard; it has a lot of quirks. Lars

Hello, You can increase the priority of the XProc support with your votes for this feature on the page with the most wanted features: http://www.oxygenxml.com/survey.html Thank you, Sorin Lars Huttar wrote:
On 2/6/2009 11:28 AM, Florent Georges wrote:
Mike Starov wrote:
Is this feature ( being able to arbitrarily create a transformation pipeline ) on oXygen's development TODO list? I think this will be useful for many people. Its like XProc or Cocoon but its all local to the editor. If we speak about future features related to the scenarii in oXygen, I think it would be more consistent to invest on XProc support, and allowing one to use an XProc script to drive a scenario.
But I am maybe not totally objective here ;-)
Regards,
I would agree that if you're going to provide XML pipeline features, it would be more useful if you could go with an existing standard (i.e. XProc), rather than reinventing the wheel... then the pipelines we use in Oxygen could be used elsewhere and vice versa.
That would also help identify needed improvements to the XProc draft standard, as well as helping to drive adoption.
Lars

>> I am new to oxygen and I was wondering if it is possible to setup a >> transformation scenario where it would take my local file then add some >> data from external XQuery processor and take resulting XML and hand it >> off XSLT Processor and then to PDF FO. >> >> >> Here is my scenario in more details. >> >> I have main input DocBook 5 xml file. That file contains most of the >> data that needs to go in PDF. However final PDF needs some data that is >> not in that XML. That data is stored in a separate set of files and >> needs to be selected using complex XQuery based on certain parameters. >> Those parameters are stored in main xml file in processing instructions. >> Is something like this possible? Perhaps chained scenarios where output >> of one is input to another. Sort of like Apache Cocoon with eXist. I got it down to 2 steps. 1. I have XQuery file that concatenates main XML file with results of a FLOWR expression that extracts data from other files. When I run a transformation scenario it executes the XQuery file and opens the result in editor. (I am forced to have second step because i cannot find a way to associate an XSLT sheet to XQuery file. The "Additional XSLT Stylesheets" button is missing from Transformation configuration dialog.) 2. Now its time to convert resulting file into PDF. For this i have a transformation scenario configured that runs it through two XSLT sheets. First puts correct data in place of PIs and outputs valid DocBook, next makes FO out of DocBook. This is close to what i want. Actually I would have been happy with this but I am developing this for our content authors. They need a one button solution and preferably that one button needs to be available while they have main XML open for editing. As you pointed out this may be available using external tools like XProc or maybe an external script that uses saxon command line, but I am just exploring what I can do with oXygen transformation scenarios.

In the current version of Oxygen an XQuery transformation cannot be chained with an XSLT one. Only XSLT transformations can be chained. You need to run an XQuery scenario first and run the XSLT scenario on the result of the first one. Yes, you can set Saxon 9 as transformation engine in the XQuery scenario and apply it to local files instead of files stored in an eXist database. Just select Saxon XQuery 9 in the Transformer combo box of the dialog for editing an XQuery scenario and the path of the local XML input file in the XML URL field. Regards, Sorin Mike Starov wrote:
(I am forced to have second step because i cannot find a way to associate an XSLT sheet to XQuery file. The "Additional XSLT Stylesheets" button is missing from Transformation configuration dialog.)
This is close to what i want. Actually I would have been happy with this but I am developing this for our content authors. They need a one button solution and preferably that one button needs to be available while they have main XML open for editing. As you pointed out this may be available using external tools like XProc or maybe an external script that uses saxon command line, but I am just exploring what I can do with oXygen transformation scenarios.
participants (4)
-
Florent Georges
-
Lars Huttar
-
Mike Starov
-
Sorin Ristache