Return-Path: Delivered-To: apmail-incubator-abdera-dev-archive@locus.apache.org Received: (qmail 98092 invoked from network); 6 Aug 2006 23:49:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Aug 2006 23:49:24 -0000 Received: (qmail 59962 invoked by uid 500); 6 Aug 2006 23:49:24 -0000 Delivered-To: apmail-incubator-abdera-dev-archive@incubator.apache.org Received: (qmail 59923 invoked by uid 500); 6 Aug 2006 23:49:24 -0000 Mailing-List: contact abdera-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: abdera-dev@incubator.apache.org Delivered-To: mailing list abdera-dev@incubator.apache.org Received: (qmail 59914 invoked by uid 99); 6 Aug 2006 23:49:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Aug 2006 16:49:24 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of rooneg@gmail.com designates 64.233.182.191 as permitted sender) Received: from [64.233.182.191] (HELO nf-out-0910.google.com) (64.233.182.191) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Aug 2006 16:49:23 -0700 Received: by nf-out-0910.google.com with SMTP id a25so623108nfc for ; Sun, 06 Aug 2006 16:49:02 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=LCxoHlcjoO8W4XYj5QvcZSLOxZPUoFEXj8lv8DP26EknzBIk0dsjO9QUB1aca8C5OuXl2iEKvG8eAuls0J7ZPiXzlrOaumv9ZMOo/60G4jtPIq62hrEj7fA5NAp1ywmUd+kyzwTQS9gmFwZ+dJs0kwu4zky4u0iFDLJud1KNzH0= Received: by 10.78.166.7 with SMTP id o7mr2221231hue; Sun, 06 Aug 2006 16:49:02 -0700 (PDT) Received: by 10.78.37.20 with HTTP; Sun, 6 Aug 2006 16:49:02 -0700 (PDT) Message-ID: <7edfeeef0608061649s736da41do7ba84b1041712b36@mail.gmail.com> Date: Sun, 6 Aug 2006 19:49:02 -0400 From: "Garrett Rooney" Sender: rooneg@gmail.com To: abdera-dev@incubator.apache.org Subject: Re: Conneg & styling PIs In-Reply-To: <44D61609.40809@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1f2ed5cd0608060447o21185d3cke22810128a38bb57@mail.gmail.com> <44D61609.40809@gmail.com> X-Google-Sender-Auth: 6999a336f1b743e6 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On 8/6/06, James M Snell wrote: > Danny, > > There are two things you could do here. > > 1. Drop down to the Axiom APIs to add the PI (so the browser can apply > the transform) > > Factory factory = Factory.INSTANCE; > Document doc = factory.newDocument(); > > // drop down to the Axiom interfaces > OMFactory omfactory = (OMFactory) factory; > omfactory.createOMProcessingInstruction( > (OMContainer)doc, > "xml-stylesheet", > "href=\"foo.xslt\""); > > // then create the root element > factory.newFeed(doc); > > doc.writeTo(System.out); > > yields: > > > > > > 2. Apply the XSLT transform on the server. You can apply XSLT > transforms directly to the Abdera objects. > > TransformerFactory factory = TransformerFactory.newInstance(); > > // Prepare the XSLT > Document xslt = Parser.INSTANCE.parse( > XsltExample.class.getResourceAsStream("/test.xslt")); > AbderaSource xsltSource = new AbderaSource(xslt); > Transformer transformer = factory.newTransformer(xsltSource); > > // Now let's get the feed we're going to transform > Document feed = Parser.INSTANCE.parse( > XsltExample.class.getResourceAsStream("/simple.xml")); > AbderaSource feedSource = new AbderaSource(feed); > > // Transform and output > ByteArrayOutputStream out = new ByteArrayOutputStream(); > Result result = new StreamResult(out); > transformer.transform(feedSource, result); > System.out.println(out); Should we consider adding some non-axiom-specific way to do this sort of thing? Stylesheets are becoming more and more common in feeds, and it would be nice to be able to portably add one to a feed generated by Abdera. Doing so via XSLT seems like an interesting work around, but perhaps we should consider adding support for this to the core of the system. -garrett