Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSLT Unit testing

Does anyone know of a way to write unit tests for the XSLT transformation?

I've a lot of XSLT files and it's getting harder to test them manually. We have an example XML and can compare it to the resulting output XML from the XSL transormation. However, I'm looking for a better test method.

like image 621
CodeHelp Avatar asked Apr 11 '11 15:04

CodeHelp


People also ask

What is the purpose of XSLT?

The Extensible Stylesheet Language Transformation (XSLT) standard specifies a language definition for XML data transformations. XSLT is used to transform XML documents into XHTML documents, or into other XML documents.

What is XSLT and how it works?

XSLT (Extensible Stylesheet Language Transformations) is a language originally designed for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF, PostScript and PNG.

Is XSLT a technology?

Extensible Stylesheet Language Transformations (XSLT) is an XML-based language used, in conjunction with specialized processing software, for the transformation of XML documents.


2 Answers

I am currently looking for some good options to do this as well. As a result, I came across this question, and a few other potential candidate solutions. Admittedly, I haven't tried any of them yet, so I can't speak to their quality, but at least they are some other avenues potentially worthy of researching.

  1. Jenni Tennison's Unit Testing Package
  2. UTF-X Unit Testing Framework
  3. Juxy
  4. XTC

Additionally, I found the following article to be informative in terms of a general methodology for unit testing XSLT.

Unit test XSL transformations

like image 146
Scott Avatar answered Oct 20 '22 17:10

Scott


Try XSpec, a testing framework for XSLT. It allows you to write tests declaratively, and test templates and functions.

like image 27
James Sulak Avatar answered Oct 20 '22 17:10

James Sulak