Xml – How to generate XSLT from XML samples


I am looking for a tool for semi-automatic XSLT generation.

Given 2 XML files, source:


and target:


The tool should make the XSLT file, which produces the target from the source.
Looking at the content, it should identify changes in level, placement, element names etc.
There is no general solution to this, but I would need simple transformations only.

Possible implementation:

1. scan the source, map XML data "XXX" to element path "elm"
2. scan the target, map XML data "XXX" to element path "exx"
3. output target XML structure, output XSLT mapping of "XXX", "elm" -> "exx"

In case of conflicts manual intervention is needed. A conflict could be "XXX" in more than on place in source.

It would be nice if the tool was XSD/DTD aware also, for example to do manual "field" mappings.

Edit: clarification.

Best Solution

I doubt that even simple transformation rules are possible to be generated automatically.

For example take the XML


and the target


which should be a quite common combination. I could not even manually decide (without help from the one wanting the transformation) from which tag the target <person> has been created, from <father> or <child> so I doubt that an application would produce something sane here.

Update: If some sort of drag&drop-XSLT-generation would be ok for you, there are some commercial products available, but they cannot produce XSLT from a target file. But drag&drop should be at least a better solution than writing it completely by hand: