preserving data: most urget.

I am woking on xslt. I am not using some nodes and data in my transfermation file. But now I have to get the input xml file using the output xml file(reverse of the transformation). Can anybody tell how to preserve the data in forward xml file and get the input file using the transformation.

Here is examlple:
input file:




and output after applying transformation is

maverick reticent

now can I get the input file if I apply the transfermatins to the above file.

my main objective is to preseve the data in the output file in any form so that I can use it in my reverse transformation. Can anybody hlep in this regard. it is most urgent for me.


In the example you give, I don’t think anything significant is lost in the first transformation, so the transformation appears to be completely reversible. For example:

id → number;
number → id;
name\firstname + name\lastname → name
name → name\firstname + name\lastname
[which are always separated by a single space].

So it should always be possible to reconstruct the orginal xml from the new xml in this example case.

If your real transformation loses information which is significant, you could preserve the original data as comments or cdata in the output xml. This has already been discussed in your other posts so I won’t cover it again here.

Alternatively you could keep a copy of the original xml in a separate doctype or file, linked to the new doctype by some ‘primary key’ value (such as ‘id’).

I hope this helps.

[This message was edited by Bill Leeney on 07 January 2005 at 10:18.]