
jxsl
Introduction
jxsl goals are :
- to provide a very simple API to run XSL transformation from Java code, on top of JAXP;
- to foster the adoption of XSL Unit testing and integration into Continuous Integration processes, on top of XSpec.
Simple API to run XSLT from Java code
Applying an XSL on XML content might be as simple as
``` // Create a transformation scenario XslScenario sc = new XslScenario("path_to_your_xsl.xsl");
// Run this scenario on XML content Map outputs = sc.apply("xml_content");
// Display transformation result System.out.println(outputs.get(XslScenario.MAIN_OUTPUT_KEY)); ```
where:
"path_to_your_xsl.xsl"
can be aFile
,URL
orString
"xml_content"
can bebyte[]
,File
orString
XslScenario object lets you easily manage XSL parameters and multiple outputs. See XslScenario page for more information.
XSL Unit testing
Once you have written XSpec test scenarios, jxsl allows you to quickly integrate them into your build or continous integration processes.
jxsl comes with a Maven archetype to help you start quickly. Ant support is coming soon. To make it short:
- First, you need to install Maven and have Saxon 9.3.0.2j library deployed in your local Maven repository.
- Generate the archetype with the following code
mvn archetype:generate -DarchetypeGroupId=com.servicelibre -DarchetypeArtifactId=xspec-test -DarchetypeVersion=0.1.11 -DarchetypeCatalog=http://jxsl.googlecode.com/svn/trunk/archetypes
- Test your new XSL test project.
mvn test
- Specify the location of your XSpec files by editing src/test/resources/xspec-context.xml
- Run your own tests
mvn test
- Add your new project to your source control system (Subversion, Git, Mercurial, etc.) and link it to your Continuous Integration server (Hudson, TeamCity, CruiseControl, Mike, etc. )
For detailed setup instructions, read XslUnitTesting page.
Happy XSL testing!
Project Information
- License: GNU GPL v3
- 7 stars
- svn-based source control
Labels:
Java
XSL
UnitTesting