Subject: Create XML from XPath expressions
From: "Heiko Niemann" <kontakt@xxxxxxxxxxxxxxxx>
Date: Tue, 18 Aug 2009 10:19:12 +0200
|
Hello,
I've an xml diff result that looks similar to this:
<XmlDiffResult>
<Difference>
<Type>update</Type>
<Path>/item/street</Path>
<NodeType>Element</NodeType>
<NodeName>street</NodeName>
<NewValue>2020 Washington Ave.</NewValue>
</Difference>
<Difference>
<Type>insert</Type>
<Path>/item/street/@type</Path>
<NodeType>Attribute</NodeType>
<NodeName>type</NodeName>
<NewValue>business</NewValue>
</Difference>
<Difference>
<Type>update</Type>
<Path>/item/zip</Path>
<NodeType>Element</NodeType>
<NodeName>zip</NodeName>
<NewValue>90210</NewValue>
</Difference>
<Difference>
<Type>update</Type>
<Path>/item/city</Path>
<NodeType>Element</NodeType>
<NodeName>city</NodeName>
<NewValue>Los Angeles</NewValue>
</Difference>
</XmlDiffResult>
Now I want to build a new xml based on the XPath expressions in each Path
element just using XSLT. So the result should look like this:
<data>
<item>
<street type="business">2020 Washington Ave.</street>
<zip>90210</zip>
<city>Los Angeles</city>
</item>
</data>
I have different processors and extensions available and I have tried
several approaches. Also available are the xml files I compared to get the
diff result.
Thank you for your help and ideas.
Heiko
|