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

Re: Merging attributes in one XML file with node value

Subject: Re: Merging attributes in one XML file with node values in another (identical structure)
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Thu, 22 Jun 2006 21:55:31 -0700
Re:  Merging attributes in one XML file with node value
It should be possible to write a higher-order function

 item()*  zipTrees(node() tree1, node() tree2, item()* zipnodeFun(),
item()*  ziparcFun())

where we do not know in advance what exactly the functions
zipnodeFun(), and ziparcFun() will be doing.

One application is tree merging, another obvious one is tree
differencing, yet another could produce the results of any binary
operation (boolean, arithmetic, bit-wise, ...) on any pair of
corresponding nodes, ..., etc. the possibilities are unlimited.

A word of caution is that getting agreement on the semantics of (or
even explaining well) such a function can be very problematic -- as
the experience with the F & O function deep-equal() showed...

There's already a foldl-tree() function in FXSL -- whenever there's
time I could try to write a zipTrees() function.


-- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence.




On 6/22/06, Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> wrote:
At 11:51 AM 6/22/2006, David wrote:
> > awesomely elegant solution works
>
>'course elegance, like beauty, is in the eye of the beholder. Walking
>over the tree(s) recursively carrying a bit of state with you might take
>some more lines of code, but is probably more efficient than working out
>/descendant::*[$n] each time.

Indeed, but code footprint does make a difference, and as soon as you
start passing parameters around, XSLT's syntax proves a significant
impediment to its appearing graceful -- its steps may be right, but
not light. Whether something can *be* graceful without *appearing* so
is something I leave for us to ponder ... though I acknowledge that
an algorithm may be nice even if its synactic expression is not.

Sort of like dancing in hiking boots. If everyone is doing it, we may
fail to notice. But that doesn't make it pretty.

Cheers,
Wendell

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.