Subject:XML processing Author:Rohit K Date:12 Jul 2007 12:56 PM
Hi
I have already posted a problem titled "XSL Pre processing" in this forum but have not received any replies. Just wanted to re iterate the problem statement:
Normally we have an XML (say in.xml) and then we apply XSL on it and transform it to say out.xml.
What I need is that before applying the XSL, I want to make some modifications in in.xml and that modification is dependent on some business rule (Like if value of so and so tag is X, change it to y etc).
So instead of applying my XSL on in.xml, I need to apply it on in1.xml (Which is the XML I would get after modifying my in.xml). Question is where and how should I write the logic for transforming my in.xml to in1.xml. Should this be written in the same XSL? If yes then how? I do not want to change any tag of my main input XML neither the tags are fixed. Only values of few tags needs to be modified and rest of the in.xml should remain as it is.
Eg: if my in.xml is
<address>
<name>
<first>Rohit</first>
<last>K</last>
</name>
<id>rohit1183</id>
</address>
Suppose my requirement is that if last name is K, change it to L.
My in1.xml should be
<address>
<name>
<first>Rohit</first>
<last>L</last>
</name>
<id>rohit1183</id>
</address>
Rest of the XML should be as it is. Now my XSL should be applied to the new XML (in1).