Robert Koberg wrote:
On Oct 29, 2008, at 4:15 PM, John Snelson wrote:
Robert Koberg wrote:
On Oct 29, 2008, at 3:48 PM, John Snelson wrote:
Robert Koberg wrote:
On Oct 29, 2008, at 3:21 PM, Scott Trenda wrote:
I think John is confusing the meaning of "functional" here. Dimitre
meant "functional" as in "based on functions/templates, like
Haskell or
Scheme (as opposed to imperative)", and perhaps John interpreted
"functional" to mean "it works, it's not broken".
I am sure John knows what functional means. I was commenting about the
use of XQuery as opposed to xsl's identity template with some
exception
templates. It sounds like he think XQuery is better at this type of
thing.
Yes. It's a few lines of easily readable XQuery Update, versus a few
complete XSLT templates and an explanation of how the identity
transform
works.
Really? Show me how you use typeswitch (or whatever you would like to
use) to handle the XSL equivalent of exception templates in a few lines.
Problem: In a copy of the original document, rename the "name" attribute
of "product" elements to "id".
XQuery Update solution:
copy $a := doc(...)
modify for $p in $a//product return rename node $p/@name as "id"
return $a
Way too simplistic for the real world.
I take that to mean that you concede for the stated problem :-).
Now the problem has changed. Also, lets imagine there were other
elements beside product involved - like a label, abstract and price. (I
am not even getting into mixed content... yet :) )
You need to
* change the name attr to an id attr
* you need to change product elem into item elem
* you need to wrap all products that start with the same letter (derived
from name attr value) with an items element
* you need to change abstract to description.
Actually those are all pretty simple in XQuery Update.
Then, you need to make it into XHTML for the web :)
That kind of whole document transform is probably better off in XSLT.
I don't expect you too actually do it, just ADMIT damnit! :)
I admit what I knew I was trying to express all along: XSLT is great for
certain things, and XQuery is great for others. I would like people to
consider using the best way to express their intent, and not to dismiss
useful technology out of hand.
BTW, you do realize you are on an XSL list, you heathen. :)
:-)
XQuery and XSLT 2.0 are such close languages - it's probably time to
start building bridges between them, rather than offhand rejection. We
have greater common enemies... ;-)
John
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--