Unit Testing Framework - XSLT Documentation System
Jacek Radajewski
April 2007

Table of Contents

1 Introduction
 1.1 Wat is UTF-X?
 1.2 What is UTF-X Doc?
2 Formatting XML
3 WSDL Example
4 UTF-X Document Structure
 4.1 Document metadata
 4.2 Namespace context
 4.3 Nested Sections
 4.4 Block Elements

1 Introduction

XML source available here

1.1 Wat is UTF-X?

UTF-X is an extension to the JUnit Java unit testing framework and provides functionality for unit testing XSLT stylesheets. UTF-X strongly supports the test-first-design principle with test rendition and test validation features allowing you to visually design your test before you start working on the on stylesheet. UTF-X was originally built to test XSLT stylesheet used in an XML publishing system so it has good support for DTD validation, XHTML and XSL:FO stylesheets.

1.2 What is UTF-X Doc?

UTF-X Doc is a simple application for documenting XML systems and apps. UTF-X Doc documents are authored in XML and then rendered into desired formats such as HTML or PDF. UTF-X Doc was originally written to demonstrate how UTF-X tests are applied to real XML applications and to document the UTF-X system itself. This document for example has been created using UTF-X Doc.

2 Formatting XML

UTF-X Doc allows you format XML fragments like this:

<u:sect1 id="formattingxml1">
<u:title>Formatting XML</u:title>
<u:para>UTF-X Doc allows you format XML fragments like this:</u:para>
<xml />

<u:caption>XML Fragment</u:caption>
Figure 2.1: XML Fragment

3 WSDL Example

The following example is a WSDL document with wsdl:binding highlighted by XPath .//wsdl:binding. Each prefix is highlighted in it's own colour.

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd1="http://example.com/stockquote.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://example.com/stockquote.wsdl" name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl">
<xsd:schema targetNamespace="http://example.com/stockquote.xsd">
<xsd:element name="TradePriceRequest">
<xsd:element name="tickerSymbol" type="xsd:string" />
<xsd:element name="TradePriceResponse">
<xsd:element name="price" type="xsd:float" />
<xsd:element name="invalidTickerSymbol" type="xsd:string" />
<wsdl:message name="GetLastTradePriceInput">
<wsdl:part element="xsd1:TradePriceRequest" name="body" />
<wsdl:message name="GetLastTradePriceOutput">
<wsdl:part element="xsd1:TradePriceResponse" name="body" />
<wsdl:portType name="StockQuotePortType">
<wsdl:operation name="GetLastTradePrice">
<wsdl:input message="tns:GetLastTradePriceInput" />
<wsdl:output message="tns:GetLastTradePriceOutput" />
<wsdl:binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetLastTradePrice">
<soap:operation soapAction="http://example.com/GetLastTradePrice" />
<soap:body use="literal" />
<soap:body use="literal" />


4 UTF-X Document Structure

4.1 Document metadata

<u:document xsi:schemaLocation="http://utf-x.sourceforge.net/xsd/utfxdoc_1_0/utfxdoc.xsd http://utf-x.sourceforge.net/xsd/utfxdoc_1_0/utfxdoc.xsd">
<u:title>UTF-X Doc</u:title>
<u:subtitle>Unit Testing Framework - XSLT Documentation System</u:subtitle>
<u:author>Jacek Radajewski</u:author>
<u:date>February 2006</u:date>
Figure 4.1: Document metadata

4.2 Namespace context

In order for all the funky features (e.g. element highliting) to work you will need to define a namespace context which bind prefixes to corresponding namespace URIs.


Figure 4.2: Defining namespace context. Highlighted is the W3C Schema namespace to prefix binding.

4.3 Nested Sections

<!-- nested sections -->
<u:sect1 id="s1">
<u:title>Level 1</u:title>
<u:para>Paragraph in level 1 section</u:para>
<u:sect2 id="s2">
<u:title>Level 2</u:title>
<u:para>Some more content in level 2 section.</u:para>
<u:sect3 id="s3">
<u:title>Level 3</u:title>
<u:para>And the last, level 3 paragraph.</u:para>
Figure 4.3: Three levels of nesting available

4.4 Block Elements

<xsd:group name="block">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element ref="u:para" />
<xsd:element ref="u:note" />
<xsd:element ref="u:figure" />
<xsd:element ref="u:pre" />
<xsd:element ref="u:xml" />
<xsd:element ref="u:ordered_list" />
<xsd:element ref="u:unordered_list" />
Figure 4.4: Block elements