Action to run multiple updates on the source document
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 71
- Joined: Sat Jan 07, 2017 1:23 am
Action to run multiple updates on the source document
I have an XSLT script that performs two types of actions on an XML document:
From within Oxygen, I'd like to run this script and have it edit the source document without outputting a new result document. What Author Mode operations will do that?
- Issues warnings (using <xsl:message>) if it finds markup errors it cannot correct
- Makes some easy corrections (e.g., change <month>1</month> to <month>01</month> throughout the document)
From within Oxygen, I'd like to run this script and have it edit the source document without outputting a new result document. What Author Mode operations will do that?
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Action to run multiple updates on the source document
Post by alex_jitianu »
Hello,
An XSLTOperation can do what you describe. The root element returned by the script will replace an element from within the document (it can be the root element if the operation is configured as such). The warnings emitted via xsl:message will be presented in the results area.
Best regards,
Alex
An XSLTOperation can do what you describe. The root element returned by the script will replace an element from within the document (it can be the root element if the operation is configured as such). The warnings emitted via xsl:message will be presented in the results area.
You could extract this part from the script into a Schematron file which can be applied automatically on the document (if needed). Maybe even provide some quick fixes for the user (for those situation when there might be multiple fixes to an issue and you can't choose one automatically).Issues warnings (using <xsl:message>) if it finds markup errors it cannot correct
Best regards,
Alex
-
- Posts: 71
- Joined: Sat Jan 07, 2017 1:23 am
Re: Action to run multiple updates on the source document
Thanks, Alex. I set up the action as follows, and it does what I want:
In brief, the file I'm viewing in Oxygen is a JATS article that looks like this:
On the command line, the XSLT script needs to output the doctype declaration, so it includes this:
However, when I run the script via the XSLTOperation as configured above, I get a "content is not allowed in prolog" error. To fix this, I change the <xsl:output> element above to
Is there a way to update either my Action or my XSLT script so that it doesn't output the doctype declaration when run from Oxygen but does so when run from the command line?
Now I'd like to be able to use the same XSLT script in Oxygen and on the command line as well, but I need its behavior to be slightly different in these two contexts, and I'm wondering if there's a way for XSLTOperation to pass a parameter to the XSLT script.Operation: XSLTOperation
Arguments
sourceLocation: /article
targetLocation: /article
script: ${framework}/xslt/verify.xsl
action: Replace
caretPosition: First editable position
expandEditorVariables: true
suspendTrackChanges: false
In brief, the file I'm viewing in Oxygen is a JATS article that looks like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ...>
<article ... >
...
</article>
Code: Select all
<xsl:output method="xml" xml:space="default" indent="yes" omit-xml-declaration="no" doctype-public="-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" doctype-system="journalpublishing3.dtd"/>
Code: Select all
<xsl:output method="xml" xml:space="default" indent="yes"/>
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Action to run multiple updates on the source document
Post by alex_jitianu »
Hello,
In the next version of Oxygen you will be able to send parameters to the XSLT script. Meanwhile, perhaps you can have a generic XSLT, one that doesn't specify any xsl:output and create two other driver XSLTs. One for the command line that imports the generic one and defines an xsl:output to generate the DOCTYPE and another for Oxygen that doesn't have the DOCTYPE part. This way you will still be sure that, when making a change, the code will run similarly in Oxygen and on the command line.
Best regards,
Alex
In the next version of Oxygen you will be able to send parameters to the XSLT script. Meanwhile, perhaps you can have a generic XSLT, one that doesn't specify any xsl:output and create two other driver XSLTs. One for the command line that imports the generic one and defines an xsl:output to generate the DOCTYPE and another for Oxygen that doesn't have the DOCTYPE part. This way you will still be sure that, when making a change, the code will run similarly in Oxygen and on the command line.
Best regards,
Alex
Return to “SDK-API, Frameworks - Document Types”
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