Style a document in-place
Oxygen general issues.
-
- Posts: 36
- Joined: Tue Feb 21, 2012 8:22 pm
- Location: Rotterdam, the Netherlands
- Contact:
Style a document in-place
I would like to apply a XSLT stylesheet to a document and replace it with the output.
In a transformation scenario you can save the output to a new name. But, how to write a transformation scenario for file "xxx" that renames the original file xxx.bak and then applies the transformation and save the output as "xxx" replacing the original file?
In a transformation scenario you can save the output to a new name. But, how to write a transformation scenario for file "xxx" that renames the original file xxx.bak and then applies the transformation and save the output as "xxx" replacing the original file?
Kind Regards,
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Style a document in-place
Hi,
XSLT is not exactly fit for this kind of operation and Oxygen cannot help you with this. In theory, if you use Saxon, you could use Java extensions to rename files, but I can't really see a proper way to do this since the file to be renamed is involved in the transformation.
A proper way to do this would be to use ANT or XProc which are more scripting oriented and allow you perform successive operations.
Regards,
Adrian
XSLT is not exactly fit for this kind of operation and Oxygen cannot help you with this. In theory, if you use Saxon, you could use Java extensions to rename files, but I can't really see a proper way to do this since the file to be renamed is involved in the transformation.
Code: Select all
<xsl:function name="ns:renameFile" as="xs:boolean">
<xsl:param name="srcPath" as="xs:string"/>
<xsl:param name="dstPath" as="xs:string"/>
<xsl:value-of xmlns:file="java:java.io.File" select="boolean(file:renameTo(file:new($srcPath), file:new($dstPath)))"/>
</xsl:function>
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
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