A VS Code extension that executes an XSLT transformation on XML data extracted from a custom .wpf archive (a renamed .zip file) using the Saxon XSLT processor.
Features
- Extracts
input.datandvariables.xmlfrom a selected.wpfor.ziparchive into a secure temporary directory. - Displays extracted files side-by-side for review or modification without cluttering your workspace.
- Runs XSLT transformations on the extracted data, reading parameters directly from
variables.xml. - Works on unsaved XSLT files natively; no need to save your XSLT before testing.
- Displays the output of the Saxon processor in a clean, unsaved editor tab.
- Captures and displays execution errors in the "WPF-XSLT Error" output channel.
- Cross-platform compatible.
Prerequisites
- Java: The extension uses Java to run the Saxon processor. Ensure Java is installed and available in your system's
PATH. - Saxon XSLT Processor: You will need a
saxon.jarexecutable to process transformations.
Extension Settings
This extension contributes the following settings:
wpfXslt.saxonPath: The absolute path to yoursaxon.jarfile. You can set this via the command palette.
How to Use
1. Set the Saxon Path (First-time setup)
You only need to do this once per machine, or when the location of your saxon.jar changes.
- Open the Command Palette (
Ctrl+Shift+Pon Windows/Linux,Cmd+Shift+Pon macOS). - Type and select
WPF-XSLT Runner: Set Saxon Path. - A file explorer window will open. Select your downloaded
saxon.jar.
2. Select a WPF Archive
- Open the Command Palette (
Ctrl+Shift+P). - Type and select
WPF-XSLT Runner: Select WPF File. - A file explorer will open. Select your
.wpfor.zipfile containing aninput.datand avariables.xml. - The extension will automatically extract these files and open them side-by-side in your editor. You can inspect or edit these files. If you edit them, simply save (
Ctrl+S/Cmd+S).
3. Run the XSLT Transformation
- Open your XSLT file. (You do not even need to save the file; you can open a new untitled file, set the language to XSL, and paste your code).
- Ensure the tab with your XSLT code is currently the active, focused tab.
- Open the Command Palette (
Ctrl+Shift+P). - Type and select
WPF-XSLT Runner: Run XSLT. - The extension will pass the extracted
input.dat,variables.xml, and your active XSLT to Saxon. The results will be displayed in a new editor tab next to your code.
Sample Files
If you wish to test the extension, use the files generated in the test_data folder of this repository:
- Load
test_data/sample.wpfusing theSelect WPF Filecommand. - Open
test_data/transform.xsl. - Run the
Run XSLTcommand.
Known Issues
- The variable mapping logic assumes
variables.xmluses elements with anameandvalueattribute (e.g.,<variable name="discountRate" value="0.8" />).
Release Notes
0.0.1
Initial release of WPF-XSLT Runner.