XmlTransformer
A Sublime Text Build package for effortless XSLT transformations on XML files using Saxon-HE 12.9, featuring intuitive file browsing and parameter support across Linux, Windows, and macOS.
Details
Installs
- Total 4
- Win 3
- Mac 1
- Linux 0
Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
XmlTransformer Package
A Sublime Text package for performing XSLT transformations on XML files using Saxon-HE 12.9 and xmlresolver 6.0.6. Supports Linux, Windows, and macOS with a file browser-like interface for selecting XSL files and parameter files.
Features
- Navigate directories (excluding hidden . directories) and select .xsl files in a single quick panel.
- Scans XSL for
- If parameters are detected: Option to enter values manually (saved as XML in the XML/XSL directory) or select an existing XML parameter file.
- Warns on missing parameters in selected files but continues transformation.
- Remembers the last used parameter filename for suggestions.
- Transforms XML files into HTML output (-output.html).
- No output generated if selection is canceled (Escape key).
- Uses Saxon-HE 12.9 with -warnings:silent for efficiency.
- Debug logging to console and error handling via an output panel (xml_transformer_errors).
- Platform-specific dependency checks for Java and JARs during plugin load.
Requirements
- Sublime Text: Version 3 or 4.
- Java: 8+ (recommended: openjdk-11-jre or equivalent).
- Saxon-HE: Version 12.9.
- xmlresolver: Version 6.0.6 (including data).
- JAR Locations:
- Linux: /usr/local/lib/saxon
- Windows: C:\Program Files\Saxon
- macOS: ~/Library/Saxon
- Files:
- Saxon-HE-12.9.jar
- xmlresolver-6.0.6.jar
- xmlresolver-6.0.6-data.jar
Installation
Linux
- Install Dependencies: Run the setup script to install Java (openjdk-11-jre), Saxon-HE 12.9, and xmlresolver 6.0.6:
~/.config/sublime-text/Packages/XmlTransformer/setup_XmlTransformer_ubuntu.sh
Follow prompts to install or skip dependencies (press Y or n). Requires sudo for /usr/local/lib/saxon. Alternatively, manually install: - Java:
```
sudo apt update
sudo apt install openjdk-11-jre
```
- JARs: Download from:
Place JARs in /usr/local/lib/saxon:
sudo mkdir -p /usr/local/lib/saxon sudo cp ~/Downloads/Saxon-HE-12.9.jar /usr/local/lib/saxon/ sudo cp ~/Downloads/xmlresolver-6.0.6.jar /usr/local/lib/saxon/ sudo cp ~/Downloads/xmlresolver-6.0.6-data.jar /usr/local/lib/saxon/ sudo chmod 644 /usr/local/lib/saxon/*.jar
- Install Package: Copy the XmlTransformer directory to Sublime Text’s Packages folder:
mkdir -p ~/.config/sublime-text/Packages/XmlTransformer
cp -r /path/to/XmlTransformer/* ~/.config/sublime-text/Packages/XmlTransformer/
Ensure files include XmlTransformer_build.py, XmlTransformer_exec.py, XmlTransformer.sublime-build, XmlTransformer.sublime-settings, setup_XmlTransformer_ubuntu.sh, and README.md
- Verify: Check Java and JARs:
java -version
ls /usr/local/lib/saxon/*.jar
Expected: Java 11+ (e.g., openjdk version “11.0.20”), lists Saxon-HE-12.9.jar, xmlresolver-6.0.6.jar, xmlresolver-6.0.6-data.jar.
Windows
- Install Dependencies: Run the setup script as Administrator to install Java (openjdk-11-jre), Saxon-HE 12.9, and xmlresolver 6.0.6:
%APPDATA%\Sublime Text\Packages\XmlTransformer\setup_XmlTransformer_windows.bat
Open a Command Prompt as Administrator. Follow prompts to install or skip dependencies (press Y or n). Requires PowerShell and winget for Java; downloads JARs to C:\Program Files\Saxon. Alternatively, manually install: - Java: Download and install from https://adoptium.net. Ensure java is in your PATH (test with java -version). - JARs: Download from the URLs above. - Place JARs in C:\Program Files\Saxon:
```
mkdir "C:\Program Files\Saxon"
copy \path\to\Saxon-HE-12.9.jar "C:\Program Files\Saxon\"
copy \path\to\xmlresolver-6.0.6.jar "C:\Program Files\Saxon\"
copy \path\to\xmlresolver-6.0.6-data.jar "C:\Program Files\Saxon\"
```
- Install Package: Copy the XmlTransformer directory to Sublime Text’s Packages folder:
mkdir "%APPDATA%\Sublime Text\Packages\XmlTransformer"
copy \path\to\XmlTransformer\* "%APPDATA%\Sublime Text\Packages\XmlTransformer\"
Ensure files include XmlTransformer_build.py, XmlTransformer_exec.py, XmlTransformer.sublime-build, XmlTransformer.sublime-settings, setup_XmlTransformer_windows.bat, and README.md
- Verify: Check Java and JARs:
java -version
dir "%ProgramFiles%\Saxon\*.jar"
Expected: Java 11+ (e.g., openjdk version “11.0.20”), lists Saxon-HE-12.9.jar, xmlresolver-6.0.6.jar, xmlresolver-6.0.6-data.jar.
macOS
- Install Dependencies: Run the setup script to install Java (openjdk@11), Saxon-HE 12.9, and xmlresolver 6.0.6:
~/Library/Application\ Support/Sublime\ Text/Packages/XmlTransformer/setup_XmlTransformer_macos.sh
Follow prompts to install or skip dependencies (press Y or n). Requires Homebrew. If not installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Downloads JARs to ~/Library/Saxon. Alternatively, manually install: - Java:
```
brew install openjdk@11
```
Add to PATH (e.g., in ~/.zshrc):
```
echo 'export PATH="/usr/local/opt/openjdk@11/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
```
- JARs: Download from the URLs above.
Place JARs in ~/Library/Saxon:
mkdir -p ~/Library/Saxon cp ~/Downloads/Saxon-HE-12.9.jar ~/Library/Saxon/ cp ~/Downloads/xmlresolver-6.0.6.jar ~/Library/Saxon/ cp ~/Downloads/xmlresolver-6.0.6-data.jar ~/Library/Saxon/ chmod 644 ~/Library/Saxon/*.jar
- Install Package: Copy the XmlTransformer directory to Sublime Text’s Packages folder:
mkdir -p ~/Library/Application\ Support/Sublime\ Text/Packages/XmlTransformer
cp -r /path/to/XmlTransformer/* ~/Library/Application\ Support/Sublime\ Text/Packages/XmlTransformer/
Ensure files include XmlTransformer_build.py, XmlTransformer_exec.py, XmlTransformer.sublime-build, XmlTransformer.sublime-settings, setup_XmlTransformer_macos.sh, and README.md.
- Verify: Check Java and JARs:
java -version
ls ~/Library/Saxon/*.jar
Expected: Java 11+ (e.g., openjdk version “11.0.20”), lists Saxon-HE-12.9.jar, xmlresolver-6.0.6.jar, xmlresolver-6.0.6-data.jar.
Parameter File Format
The package uses a simple XML format for parameters:
<?xml version="1.0" encoding="UTF-8"?>
<params>
<param name="pTestParam" value="TestValue"/>
<param name="pTestParam2" value="TestValue2"/>
<param name="extraParam" value="ExtraValue"/>
</params>
- Root element can be anything (e.g., ); the package parses .//param elements.
- Only name and value attributes are used; value defaults to empty string if missing.
- Extra parameters are passed; missing ones trigger a warning.
Usage
- Open an XML file in Sublime Text.
- Run the build command:
- Linux/Windows: Ctrl+B
- macOS: Cmd+B
- In the quick panel: Navigate directories (excludes hidden . directories) and select an .xsl file. Use [Parent Directory] to go up.
- If xsl:param are found in the XSL:
- Choose: “Enter parameters manually” or “Select variables XML file”.
- Manual: Input values one by one; saved as XML (suggests last filename, in XML/XSL dir).
- Select: Browse for an XML file; parses elements.
- Transformation runs, producing -output.html (opened automatically).
- Check the xml_transformer_errors panel (View > Show Console, or Tools > Build Results > Show Build Results) for errors
Test Files
For verification, use the included test files: - test.xml: Input XML. - test.xsl: XSL with parameters (pTestParam, pTestParam2). - params.xml: Sample parameter file. - Expected output: test-output.html with parameter values displayed.
Troubleshooting
Java Not Found:
- Linux:
sudo apt install openjdk-11-jre
- Windows: Download from https://adoptium.net, add to PATH.
- macOS:
brew install openjdk@11
- Verify:
java -version
- Linux:
Missing JARs:
- Check paths:
- Linux:
ls /usr/local/lib/saxon/*.jar
- Windows:
dir "%ProgramFiles%\Saxon\*.jar"
- macOS:
ls ~/Library/Saxon/*.jar
- Re-run setup script or download manually.
Permission Issues:
- Linux:
sudo chmod 644 /usr/local/lib/saxon/*.jar
- Windows: Run .bat as Administrator.
- macOS:
chmod 644 ~/Library/Saxon/*.jar
- Linux:
Transformation Errors:
- Check console (Ctrl+
or Cmd+
) or xml_transformer_errors panel. - Test manually (replace paths as needed):
- Linux/macOS:
java -cp /usr/local/lib/saxon/Saxon-HE-12.9.jar:/usr/local/lib/saxon/xmlresolver-6.0.6.jar:/usr/local/lib/saxon/xmlresolver-6.0.6-data.jar net.sf.saxon.Transform -s:test.xml -xsl:test.xsl -o:test-output.html pTestParam=TestValue pTestParam2=TestValue2 -warnings:silent
- Windows:
java -cp "C:\Program Files\Saxon\Saxon-HE-12.9.jar;C:\Program Files\Saxon\xmlresolver-6.0.6.jar;C:\Program Files\Saxon\xmlresolver-6.0.6-data.jar" net.sf.saxon.Transform -s:test.xml -xsl:test.xsl -o:test-output.html pTestParam=TestValue pTestParam2=TestValue2 -warnings:silent
License" with “This package is licensed under the MIT License. See LICENSE for details.
- Check console (Ctrl+
Dependencies
XmlTransformer requires: - Java 8+ (e.g., OpenJDK 11, available at https://adoptium.net). - Saxon-HE 12.9 (https://www.saxonica.com/download/java.xml). - xmlresolver 6.0.6 (https://github.com/xmlresolver/xmlresolver).
After installing via Package Control, copy and run the platform-specific setup script:
- macOS: cp ~/.config/sublime-text/Packages/XmlTransformer/setup_XmlTransformer_macos.sh ~; chmod +x ~/setup_XmlTransformer_macos.sh; ~/setup_XmlTransformer_macos.sh
- Linux: cp ~/.config/sublime-text/Packages/XmlTransformer/setup_XmlTransformer_ubuntu.sh ~; chmod +x ~/setup_XmlTransformer_ubuntu.sh; ~/setup_XmlTransformer_ubuntu.sh
- Windows: Copy ~/.config/sublime-text/Packages/XmlTransformer/setup_XmlTransformer_windows.bat to a folder and double-click to run.
Alternatively, download scripts from: - macOS: https://raw.githubusercontent.com/haloway13/XmlTransformer/main/setup_XmlTransformer_macos.sh - Linux: https://raw.githubusercontent.com/haloway13/XmlTransformer/main/setup_XmlTransformer_ubuntu.sh - Windows: https://raw.githubusercontent.com/haloway13/XmlTransformer/main/setup_XmlTransformer_windows.bat
Place JARs in: - macOS: ~/Library/Saxon - Linux: /usr/local/lib/saxon - Windows: C:\Program Files\Saxon