Command line to run a transformation on a source file
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 67
- Joined: Thu Jan 24, 2008 4:52 pm
Command line to run a transformation on a source file
I am hoping it is possible to use the Oxygen 10 command line to invoke a transformation on an XML source file.
Is this possible, and if so, what options and parameters are needed?
Essentially, we'd like to be able to run an "Apply Transformation Scenario" from the command line on a given file.
We'd like to develop a Windows XP script (batch file) to invoke transformations.
Is any of this possible?
Thanks, Mike
Is this possible, and if so, what options and parameters are needed?
Essentially, we'd like to be able to run an "Apply Transformation Scenario" from the command line on a given file.
We'd like to develop a Windows XP script (batch file) to invoke transformations.
Is any of this possible?
Thanks, Mike
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Command line to run a transformation on a source file
Post by sorin_ristache »
Hello,
No, it is not possible to run a transformation from the command line. You can specify in the command line that starts Oxygen a list of files that will be opened automatically on startup and as option a schema for validating each specified file but a transformation cannot be executed from the command line.
Regards,
Sorin
No, it is not possible to run a transformation from the command line. You can specify in the command line that starts Oxygen a list of files that will be opened automatically on startup and as option a schema for validating each specified file but a transformation cannot be executed from the command line.
Regards,
Sorin
-
- Posts: 14
- Joined: Mon Feb 09, 2009 5:49 pm
Re: Command line to run a transformation on a source file
You actually can run a transform from the command line, but NOT using Oxygen.
After you have your transform working in Oxygen, find the documentation for that vendor's transform and call it from the command line. It will likely be different for different vendors.
For example, to call Saxon-SA from the command line (you'll need a license from Saxonica) my command line looks like this:
Oxygen comes with a license for Saxon-SA but it seems to only be for using from within Oxygen as there's no physical license file (that I could find). In my case I asked Saxonica for a 30-day trial license and made a license directory under Oxygen's lib directory, placed the license file there, and put that directory in the class path (after the -cp above).
Also, I just used the saxon-sa that came with Oxygen but if I wanted to put this on a separate system without violating my Oxygen license I could just download the Saxon-SA transformer:
It WOULD be nice if Oxygen could tell us which options are relevant for a specific vendor's transformer. It took me a few tries to figure out I needed the strict validation (-val:strict) option. I couldn't find any options inside of Oxygen that would make them reveal how they were calling Saxon-SA, and, short of reverse-engineering Oxygen, don't know how else to find out.
After you have your transform working in Oxygen, find the documentation for that vendor's transform and call it from the command line. It will likely be different for different vendors.
For example, to call Saxon-SA from the command line (you'll need a license from Saxonica) my command line looks like this:
Code: Select all
java -cp c:\oxml\lib\saxon9sa.jar;c:\oxml\lib\license com.saxonica.Transform -val:strict -sa -o table13.txt Letter_XML.xml table13ToTAB.xslt
Also, I just used the saxon-sa that came with Oxygen but if I wanted to put this on a separate system without violating my Oxygen license I could just download the Saxon-SA transformer:
Code: Select all
java -cp saxon\saxon9sa.jar;saxon\license com.saxonica.Transform -val:strict -sa -o table14.txt Letter_XML.xml table14ToTAB.xslt
-
- Posts: 67
- Joined: Thu Jan 24, 2008 4:52 pm
Re: Command line to run a transformation on a source file
Thanks for the information.
Any idea of how to run a transformation using LIBXML? Or even Saxon-B which shouldn't need a license? Would using "saxon.jar" instead of "saxon9sa.jar" do the job? I assume the "-o" option specifies the output file, while the .xml and .xslt files are the input and transformation files?
Our current transformations should work with Saxon-B, since they don't have any schema aware elements.
Thanks, Mike
Any idea of how to run a transformation using LIBXML? Or even Saxon-B which shouldn't need a license? Would using "saxon.jar" instead of "saxon9sa.jar" do the job? I assume the "-o" option specifies the output file, while the .xml and .xslt files are the input and transformation files?
Our current transformations should work with Saxon-B, since they don't have any schema aware elements.
Thanks, Mike
-
- Posts: 14
- Joined: Mon Feb 09, 2009 5:49 pm
Re: Command line to run a transformation on a source file
I see no reason why they wouldn't work, but, like I said, you'll need to check their docs.mlcook wrote:Thanks for the information.
Any idea of how to run a transformation using LIBXML? Or even Saxon-B which shouldn't need a license? Would using "saxon.jar" instead of "saxon9sa.jar" do the job? I assume the "-o" option specifies the output file, while the .xml and .xslt files are the input and transformation files?
Our current transformations should work with Saxon-B, since they don't have any schema aware elements.
Thanks, Mike
Very quickly I download the saxon9B files, placed them in a saxon9 subdirectory of my project, and ran the following:
Code: Select all
java -cp saxon9\saxon9.jar net.sf.saxon.Transform -o table14.txt Letter_XML.xml table14ToTAB.xslt
-
- Posts: 67
- Joined: Thu Jan 24, 2008 4:52 pm
Re: Command line to run a transformation on a source file
I've been able to run a transformation based the java commands above.
OK, how about performing a *validation* via a command line?
I'd like to do both an External Validation with my schema that contains Schematron assertions, and a 'regular' "Reset Cache and Validate" equivalent, since my schema also has identity constraints using unique and key constraints.
Any idea how to do that from a script command line?
Thanks again, Mike
OK, how about performing a *validation* via a command line?
I'd like to do both an External Validation with my schema that contains Schematron assertions, and a 'regular' "Reset Cache and Validate" equivalent, since my schema also has identity constraints using unique and key constraints.
Any idea how to do that from a script command line?
Thanks again, Mike
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: Command line to run a transformation on a source file
For Schematron you just need to apply a couple of stylesheets. Its implementation is one stylesheet that is applied on the schema and gives another stylesheet that basically represents the schema compiled into executable code. Then, this result stylesheet is applied on your input document and you get the validation results. See http://www.schematron.com for the reference implementation.
For XML Schema look at the processor you want to use for its command line options. In case of Xerces you need to use one of its samples.
Best Regards,
George
For XML Schema look at the processor you want to use for its command line options. In case of Xerces you need to use one of its samples.
Best Regards,
George
George Cristian Bina
-
- Posts: 67
- Joined: Thu Jan 24, 2008 4:52 pm
Re: Command line to run a transformation on a source file
I'm beginning to catch on to the schema processing commands and using the external validation (e.g. Schematron) commands.
Once I began studying the command log windows that appear during validation, things started to make more sense. I realized more what I was seeing.
New questions:
When running xmllint via the "LIBXML" menu command I see something like this:
C:\Program Files\Oxygen XML Editor 10/xmllint --noout --catalogs --xinclude --schema file.xsd file.xml
What does the --catalogs option do?
Where is the catalog file (since when I run this command in a Windows batch file, there is no catalog file available)?
How do I make it available?
And, what are "catalogs" anyway, and do I really need one?
Thanks for more information,
Mike
Once I began studying the command log windows that appear during validation, things started to make more sense. I realized more what I was seeing.
New questions:
When running xmllint via the "LIBXML" menu command I see something like this:
C:\Program Files\Oxygen XML Editor 10/xmllint --noout --catalogs --xinclude --schema file.xsd file.xml
What does the --catalogs option do?
Where is the catalog file (since when I run this command in a Windows batch file, there is no catalog file available)?
How do I make it available?
And, what are "catalogs" anyway, and do I really need one?
Thanks for more information,
Mike
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Command line to run a transformation on a source file
Post by sorin_ristache »
Hello,
The --catalog option enables using the XML catalogs added in Oxygen from menu Options -> Preferences -> XML -> XML Catalog. If you want to set your own XML catalogs in a command line that you run outside Oxygen please see the LIBXML documentation.
Regards,
Sorin
The --catalog option enables using the XML catalogs added in Oxygen from menu Options -> Preferences -> XML -> XML Catalog. If you want to set your own XML catalogs in a command line that you run outside Oxygen please see the LIBXML documentation.
Regards,
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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