Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 9747 invoked from network); 30 Jan 2006 16:04:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Jan 2006 16:04:48 -0000 Received: (qmail 30592 invoked by uid 500); 30 Jan 2006 16:04:45 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 30529 invoked by uid 500); 30 Jan 2006 16:04:44 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 30518 invoked by uid 99); 30 Jan 2006 16:04:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jan 2006 08:04:44 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of bobharner@gmail.com designates 66.249.82.197 as permitted sender) Received: from [66.249.82.197] (HELO xproxy.gmail.com) (66.249.82.197) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jan 2006 08:04:43 -0800 Received: by xproxy.gmail.com with SMTP id s18so696434wxc for ; Mon, 30 Jan 2006 08:04:23 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=FXVQ652+SR6KiVF5AtDDm36FcUjP6O4q/tBgEq+IwrL2kNDusiq23fwXL1rp/+sPCn9IbWdkCuSCe26tddxzhAvfThiAPu/61N7CN1F1BFKGV+TyhPY+J/xxE3fc4snyr5FPiA4SM2T+jbMUcHuLWTqvRu128YjKh6zrE74m6Vo= Received: by 10.70.87.9 with SMTP id k9mr7237209wxb; Mon, 30 Jan 2006 08:04:22 -0800 (PST) Received: by 10.70.6.4 with HTTP; Mon, 30 Jan 2006 08:04:22 -0800 (PST) Message-ID: Date: Mon, 30 Jan 2006 11:04:22 -0500 From: Bob Harner To: dev@cocoon.apache.org Subject: [CRAZY IDEA] sitemaps in javascript MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello everybody, One of my coworkers recently commented that Cocoon's sitemap files were really programs in the "xmap" language, rather than documents, and that as a language xmap is awkward and not very expressive. He suggested that the sitemaps should instead be written in a general purpose server-side interpreted language, maybe javascript. I was horrified at the idea at first, but I've been thinking about it a little more and I think he just may be right. Yes, I hear you all groaning :-) I have no standing in the Cocoon community and am just a lurker on this list, but this issue hits at the core of why I think Cocoon hasn't become more popular: there is too much to learn (and especially, too many languages). So I'm going to propose this unorthodox (crazy?) idea to the community and just let you smarter folks toss it around if you think it has any merit. First, I understand that sitemaps are intended to have relatively little functionality so that the the complex activity is forced into the components themselves. But people inevitably find ways to make sitemaps complex anyway, with lots of deeply nested matches/selects and {../2} junk and "global" input module references and other nasty stuff. This leads to very complex sitemap files that are hard to follow and very fragile. Using a more complete functional or object-oriented language rather than a declarative language would help there. =3D=3D=3D A very simple example =3D=3D=3D and the javascript equivalent: if (Request.uri.match (/doclist/xdocs/.*book.xml/') { var bookpath =3D RegExp.$1; // give what matched a name document.generate.file ("xdocs/" + bookpath + "book.xml"); document.transform.xsl ("stylesheets/doclist.xsl", [uri, bookpath]); document.serialize.xml(); } This is just one way this could be done, of course. Smarter people than me can probably think of even more elegant ways to express a pipeline. A few more points: * Most Java developers already know Javascript to some degree, so this would be one less language for a user & developer to learn. * Sitemap "resources" could be real javascript functions (or methods), with clear argument lists. * Eclipse has much better editor support for Javascript than xmap, with the several quality plugins available. * Cocoon already uses server-side Javascript for scripting Java (cocoon flow using Rhino). Okay, you all think I'm crazy. I can live with that. But just give the idea a few minutes to sink in before dismissing it.