> Question: When you create XSLT transforms or XQueries, how do you maintain a declarative mindset, and avoid slipping back into an imperative mindset?
>
> /Roger
>
>
Unfortunately I haven't reached that stage yet. I wish I have, but I'd
be lying.
Instead when my Imperative mindset hits a brick wall and what I want to
code simply is not expressible my brain starts to hurt,
until I come up with another approach that is expressible. Learning a
few "design patterns" has helped ..
Such as "When I would use iteration, instead use recursion", "When I
want to modify something, instead Use a function to create an
intermediate element/sequence and query/filter on that".
Thinking out loud, I'd definitely buy a book (RARE for me ..) that maps
imperative design patterns to declarative patterns.
I've been programming in XQuery for several years now and still find it
frustrating to do what should be simple things.
For the most part I believe its not because they are not simple in
XQuery but because I am 30 years trained in imperative/procedural
thinking and old
dogs have a hard time with new tricks.
---- To change topics (yes I'm too lazy to write a new email ) ----
Your example with XQuery with Updates has me thinking.
What is the intended use case for XQuery with Updates.
My impression is that the intended use case is to modify an existing XML
document 'in place'.
That by running insert/delete/update statements the end result is
intended to update a document.
However your examples over the last week have all been query based ...
or I think they are.
That is ... perform a (read only) query on a document using update
semantics.
Is this an intended use case of XQuery with Updates ? If so I've been
missing the boat !
-David
--
-------------------------
David A. Lee
dlee@calldei.com
http://www.calldei.comhttp://www.xmlsh.org