[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XQuery Updates in XSLT
> No, not at all. XQuery Update is 100% functional in the > strict computer science sense of the work. It returns two > types of values, an XDM and a list of updates that need to be > applied (called a pending update list, PUL). All actual > updates happen after the finish of the query, meaning that > the query still behaves functionally. A problem with that definition is that the things in the Pending Update List are not values that can be manipulated by functions within the language; indeed, an updating operation is not a function, because it cannot be composed with other functions, because the results are not accessible until the end. I think that function composition is an essential ingredient of a functional language. If you confine yourself to the copy-modify expression (called a "transform" expression for historic reasons), which creates a copy and then returns the result of updating the copy, then you do have something which is functionally well-behaved, and which indeed allows certain kinds of changes to a document to be expressed using syntax which is fairly succinct and intuitive. (I don't accept Dimitre's criticisms about the complexity of the specification; specifying the exact behaviour of "rename a as b" in terms of the namespaces that are present in the result document is always going to involve a horrendous amount of specification text to cover all corner cases, but most users will never need to care.) As for allowing updates in saxon:query(), I may well do so, with the semantics of the "copy-modify" expression - you get back a modified copy of the original, with the original unchanged. That seems cleanly functional to me. Anything else (in-situ modification) would break the XSLT execution model entirely. Michael Kay http://www.saxonica.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|