com.topologi.diffx
Class Extension

java.lang.Object
  extended by com.topologi.diffx.Extension

public final class Extension
extends Object

To use Diff-X as an XSLT extension.

In Saxon, declare the namespace as:

<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:diffx="com.topologi.diffx.Extension"
    extension-element-prefixes="diffx"
 >
 

Diff-X can be called within XSLT with:

<xsl:copy-of select="diffx:diff(/node1/to/compare, /node2/to/compare, 'IGNORE', 'TEXT')"/>
 
Note: the method signatures requires DOM arguments, include the Saxon-DOM jar on your classpath to use this extension function with Saxon.

Version:
18 May 2010
Author:
Christophe Lauret

Constructor Summary
Extension()
           
 
Method Summary
static Node diff(Node xml1, Node xml2, String whitespace, String granularity)
          Compares the two specified Nodes and returns the diff as a node.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Extension

public Extension()
Method Detail

diff

public static Node diff(Node xml1,
                        Node xml2,
                        String whitespace,
                        String granularity)
                 throws DiffXException,
                        IOException
Compares the two specified Nodes and returns the diff as a node.

Only the first node in the node list is sequenced.

Parameters:
xml1 - The first XML node to compare.
xml2 - The second XML node to compare.
whitespace - The white space processing (a valid WhiteSpaceProcessing value).
granularity - The text granularity (a valid TextGranularity value).
Throws:
DiffXException - Should a Diff-X exception occur.
IOException - Should an I/O exception occur.