Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate XSLT from XML samples [closed]

Tags:

xml

xslt

xsd

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

Given 2 XML files, source:

<elm>XXX</elm>

and target:

<exx>XXX</exx>

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.

like image 982
Jan B. Kjeldsen Avatar asked Jan 27 '09 09:01

Jan B. Kjeldsen


1 Answers

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

For example take the XML

<family>
  <father>Paul</father>
  <mother>Maria</mother>
  <child>Paul</child>
</family>

and the target

<person>Paul</person>

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:

  • WYSIWYG XSLT Designer
  • Tiger XSLT Mapper (not officially available anymore)
like image 180
Kosi2801 Avatar answered Sep 20 '22 03:09

Kosi2801