How to apply an XSLT transformation to multiple XML files in a folder?

Questions about XML that are not covered by the other forums should go here.
RobertBrittain
Posts: 1
Joined: Mon Jun 16, 2025 12:44 pm
Contact:

How to apply an XSLT transformation to multiple XML files in a folder?

Post by RobertBrittain »

I'm trying to batch transform several XML files located in a single folder using the same XSLT stylesheet. I'm currently using Oxygen XML Editor 25.0.

Is there a way to apply an XSLT transformation to all XML files in a specific folder automatically, without manually opening and transforming each one? Ideally, I would like to output the results into another folder.

Any tips on how to configure this in Oxygen, maybe using a transformation scenario or script?
teo
Posts: 86
Joined: Wed Aug 30, 2017 3:56 pm

Re: How to apply an XSLT transformation to multiple XML files in a folder?

Post by teo »

Hello Robert,

The procedure to follow is not complicated:
- select the folder in the 'Project' view
- from the context menu invoke 'Transform/Configure Transformation Scenario(s)'
- follow the steps to configure the desired transformation scenario
- the stylesheet used for the transformation should be placed outside the folder containing the XML documents
- use Oxygen XML Editor editor variables to specify the input and output files
- for example, in the 'Output File' section from the 'Output' tab, set the path of the output file ('Save as' radio button selected) using a construct of editor variables, such as "${cfd}/../output-folder/${cfn}.html", where I assumed that 'input-folder' and 'output-folder' have the same parent
- the configured and saved transformation scenario is automatically associated with all files in the folder in question
- distinct transformation scenarios can be associated with the XML files in the folder, of course using distinct XSLTs
- by selecting the folder in the 'Project' view, the transformation(s) can be applied from the context menu by invoking either 'Transform/Apply Transformation Scenario(s') or 'Transform/Transform with'.

More details can be found by following the link:
https://www.oxygenxml.com/doc/versions/ ... ation.html
For the case of applying an XSLT transformation to multiple XML files via scripting, you can consult the following topic:
https://www.oxygenxml.com/doc/versions/ ... sform.html

Regards,
Teo
Teodor Timplaru
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply