Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 90442 invoked from network); 11 Oct 2007 17:47:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Oct 2007 17:47:40 -0000 Received: (qmail 69318 invoked by uid 500); 11 Oct 2007 17:47:24 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 69240 invoked by uid 500); 11 Oct 2007 17:47:24 -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 List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 69229 invoked by uid 99); 11 Oct 2007 17:47:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Oct 2007 10:47:24 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [216.86.168.178] (HELO mxout-03.mxes.net) (216.86.168.178) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Oct 2007 17:47:26 +0000 Received: from [10.69.34.127] (unknown [212.76.37.154]) by smtp.mxes.net (Postfix) with ESMTP id D609B23E4A3 for ; Thu, 11 Oct 2007 13:47:03 -0400 (EDT) Message-ID: <470E61AB.3010803@apache.org> Date: Thu, 11 Oct 2007 19:47:23 +0200 From: Grzegorz Kossakowski User-Agent: Thunderbird 2.0.0.5 (X11/20070719) MIME-Version: 1.0 To: users@cocoon.apache.org Subject: Re: Cocoon 2.1 environment objects from a Java XSLT extension References: <20071010083057.GU21934@localhost.localdomain> <20071011132858.GC21934@localhost.localdomain> In-Reply-To: <20071011132858.GC21934@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Tobia Conforto pisze: > solprovider@apache.org wrote: >> XSLT Extensions assist formatting. Data collection belongs in the XML >> generation phase. Using XSLT Extensions to generate data is a very >> bad practice. What are the requirements? > > Let me explain better. > > I need to translate URIs in a XML document, in the middle of a pipeline, > fetching relevant information from a SQL database. "In the middle of a > pipeline" means that there are various other steps before it, so I > cannot fetch this SQL data in the initial generator. > > At first I tried to have a sub-pipeline do the job, using the document() > XPath function with a cocoon: schema, but it was too slow. > > My next (and current) idea is transforming the XML with XSLT, while > coding the actual URI transformations (including the SQL queries) as a > Java extension function, to be called from XSLT where appropriate. > > I'm hitting a wall, because I need a DataSourceComponent to be able to > make SQL queries, but a Java XSLT extension class doesn't have any > access to Cocoon's object model (that I can see.) > > I cannot pass the DataSourceComponent, or any other interesting object, > from the sitemap to my extension function, passing through the XSLT as a > parameter, because XSLT parameters get passed from the sitemap as strings. > > Suggestions are welcome. > > My last resort is doing everything as a custom transformer, but I'd like > to avoid it, as I'm not too keen on coding in Sax what can easily be > dealt with in XSLT (changing a bunch of attribute values.) Although it > wouldn't be too hard with Sax either... I'm not sure if it's going to fit in your case but I would suggest to take a look at Cocoon's quite powerful LinkRewriterTransformer[1]. Basically all you would need to do is to implement your own input module (quite simple task) and configure transformer so it uses your own input module. I strongly agree that using extension functions in your case that access external that is *NOT* a good idea. [1] http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/transformation/LinkRewriterTransformer.html -- Grzegorz Kossakowski Committer and PMC Member of Apache Cocoon http://reflectingonthevicissitudes.wordpress.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org