Working directory of a framework-based xquery script
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 25
- Joined: Mon May 19, 2014 11:38 am
Working directory of a framework-based xquery script
Good day,
I am developing a framework for a project that contains around 2000 XML files tucked into different subdirectories of the project.
The framework must include a variety of xquery scripts to generate different kinds of reports, indexes etc. for this data, i.e. cull information from the collection of files, pack it up as an XML and present it in a tab, where it can be used and processed in the same framework. The scripts should be accessible as author actions / buttons on the toolbar.
My difficulty is to pass the project directory to the xquery script, which I have included in the framework as a "transformation scenario". The configuration of the scenario allows either a specific file as input, or nothing. In the latter case, the working directory is the directory of the framework resource (doesn't help me), in the former case the working directory may be any of the subdirectories of the project (complicated).
My workaround at present is placing a dummy file in the project directory and naming it as input, then extricating its path. This is somewhat inconvenient.
Using parameters is difficult because the project is distributed to users who may put it anywhere in their environments. But there is always a project with an XPR file along with it.
Is there a more straightforward way to pass the project directory to a transformation scenario in aframework?
I am developing a framework for a project that contains around 2000 XML files tucked into different subdirectories of the project.
The framework must include a variety of xquery scripts to generate different kinds of reports, indexes etc. for this data, i.e. cull information from the collection of files, pack it up as an XML and present it in a tab, where it can be used and processed in the same framework. The scripts should be accessible as author actions / buttons on the toolbar.
My difficulty is to pass the project directory to the xquery script, which I have included in the framework as a "transformation scenario". The configuration of the scenario allows either a specific file as input, or nothing. In the latter case, the working directory is the directory of the framework resource (doesn't help me), in the former case the working directory may be any of the subdirectories of the project (complicated).
My workaround at present is placing a dummy file in the project directory and naming it as input, then extricating its path. This is somewhat inconvenient.
Using parameters is difficult because the project is distributed to users who may put it anywhere in their environments. But there is always a project with an XPR file along with it.
Is there a more straightforward way to pass the project directory to a transformation scenario in aframework?
-
- Posts: 9477
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Working directory of a framework-based xquery script
Hi,
In general in an XQuery transformation scenario when you define the XML document path or a value for a parameter you can use editor variables, one of those is "${pdu}/" which expands to the URL path or the current opened project.
https://www.oxygenxml.com/doc/versions/ ... ables.html
Regards,
Radu
In general in an XQuery transformation scenario when you define the XML document path or a value for a parameter you can use editor variables, one of those is "${pdu}/" which expands to the URL path or the current opened project.
https://www.oxygenxml.com/doc/versions/ ... ables.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 25
- Joined: Mon May 19, 2014 11:38 am
Re: Working directory of a framework-based xquery script
Hi Radu,
Thank you very much for your prompt reply.
Unfortunately, when I use ${pdu}/ in the XML URL field of the transformation, and then try to access the collection thus:
...I get an error which lists the correct project directory but says "is a directory".
And only if I name a dummy file inside the project directory in the URL XML field, such as "${pdu}/dummy.xml", then use
I can access the collection from the right directory.
Am I missing some part of the transformation configuration which would allow to passing a directory, not a file?
Thank you very much for your prompt reply.
Unfortunately, when I use ${pdu}/ in the XML URL field of the transformation, and then try to access the collection thus:
Code: Select all
let $refs := collection('./?select=*.xml;recurse=yes')
And only if I name a dummy file inside the project directory in the URL XML field, such as "${pdu}/dummy.xml", then use
Code: Select all
let $refs := collection(concat(replace(document-uri(.), '(/)[^/]*$', '$1'),'?select=*.xml;recurse=yes'))
Am I missing some part of the transformation configuration which would allow to passing a directory, not a file?
-
- Posts: 9477
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Working directory of a framework-based xquery script
Hi,
There should already be some kind of "project.xpr" XML project configuration file in your project, maybe you can use something like "${pdu}/project.xpr" as the XML input.
Regards,
Radu
There should already be some kind of "project.xpr" XML project configuration file in your project, maybe you can use something like "${pdu}/project.xpr" as the XML input.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service