Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 56210 invoked from network); 20 Jan 2005 05:11:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 20 Jan 2005 05:11:46 -0000 Received: (qmail 87882 invoked by uid 500); 20 Jan 2005 05:11:39 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 87858 invoked by uid 500); 20 Jan 2005 05:11:38 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: users@cocoon.apache.org Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 87844 invoked by uid 99); 20 Jan 2005 05:11:38 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from njord.oit.pdx.edu (HELO njord.oit.pdx.edu) (131.252.122.32) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 19 Jan 2005 21:11:38 -0800 Received: from [131.252.202.89] (host-202-89.pubnet.pdx.edu [131.252.202.89]) by njord.oit.pdx.edu (8.13.1+/8.13.1) with ESMTP id j0K5BZH0018426 for ; Wed, 19 Jan 2005 21:11:36 -0800 Mime-Version: 1.0 (Apple Message framework v618) In-Reply-To: References: Content-Type: multipart/alternative; boundary=Apple-Mail-34--958324600 Message-Id: From: Mark Lundquist Subject: Re: Ways to implement Dynamic XSLT in Cocoon Date: Wed, 19 Jan 2005 21:11:34 -0800 To: users@cocoon.apache.org X-Mailer: Apple Mail (2.618) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --Apple-Mail-34--958324600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=WINDOWS-1252; format=flowed On Jan 19, 2005, at 7:48 PM, Matt Robinson wrote: > Hello. > > Has anyone come across or written an transformer-based way to=20 > dynamically modify an XSLT template at processing time? The "normal" way to do that would be to process your "first order"=20 stylesheet through a "second-order" stylesheet, and use the "cocoon:"=20 pseudoprotocol to invoke the pipeline that does this, e.g. But I'm not sure it even has to be that involved... > My challenge is this: > > To facilitate Web Metric analysis, we need to embed vendor-supplied=20 > JAVA script in each page. This JAVA script (and/or vendor) may change=20= > over time, and I want to maintain separation of concerns such that the=20= > business (as opposed to the Cocoon > Development Team) can make changes to the vendor and/or JAVA script=20 > content without requiring changes to the site coding. > > The JAVA script is very dynamic and may include page-specific code=20 > that makes use of data embedded in the page, as well as common=20 > variables. In short, we cannot include the script in the XSLT=20 > directly because of it's dynamic nature and the lack of XSLT > knowledge in the business. > > I would like to implement a strategy whereby the script for the entire=20= > site is encapsulated in an XML file for each Web Metrics vendor, and a=20= > transformer uses this XML, coupled with a Page ID to add a template to=20= > the XSLT stylesheet instance being > transformed by the Xalan SAX Parser at build time. The page data to=20= > insert will be represented as XPaths embedded within the extra XSLT=20 > template. > > My investigations show that a good approach would be to make a copy of=20= > the TraxTransformer and intercept the XSLT data before it is actually=20= > transformed, adding the template (which has been added to the pipeline=20= > SAX events by my new > WebMetricsTransformer), and then passing a StringReader containing the=20= > new XSLT Source object into the transform. > Why not