[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Create XML from XPath expressions

Subject: Re: Create XML from XPath expressions
From: Michael Müller-Hillebrand <mmh@xxxxxxxxxxxxx>
Date: Tue, 18 Aug 2009 12:58:51 +0200
Re:  Create XML from XPath expressions
Hello,

There are many open questions.

E.g. the desired <item> element: Is it supposed to be created from the
<Path> information?

Or: How can I know that <Path>/item/street/@type</Path> is an
attribute of the immediately preceding <Path>/item/street</Path> and
not of some earlier <item>?

You could first process each <Difference> element by parsing the
<Path> to create elements and attributes, like

<item><street>2020 Washington Ave.</street></item>
<item><street type="business"/></item>
<item><zip>90210</zip></item>
<item><city>Los Angeles</city></item>

As far as I can see, this is the only data that is specified by the
source document. Combining this into a single <item> is an assumption
and could be handled according to the assumed logic in a second step.

- Michael M|ller-Hillebrand

PS: Which software creates such a diff report?

Am 18.08.2009 um 10:19 schrieb Heiko Niemann:

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

-- _______________________________________________________________ Michael M|ller-Hillebrand: Dokumentations-Technologie Adobe Certified Expert, FrameMaker Lvsungen und Training, FrameScript, XML/XSL, Unicode Blog: http://cap-studio.de/ - Tel. +49 (9131) 28747

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.